source: trunk/Cbc/src/Cbc_C_Interface.h @ 2572

Last change on this file since 2572 was 2572, checked in by unxusr, 5 months ago

new functions in C API: Cbc_deleteRows and Cbc_deleteCols

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 27.0 KB
Line 
1/* $Id: Cbc_C_Interface.h 2572 2019-05-05 16:31:18Z unxusr $ */
2/*
3  Copyright (C) 2004 International Business Machines Corporation and others.
4  All Rights Reserved.
5
6  This code is licensed under the terms of the Eclipse Public License (EPL).
7*/
8#ifndef CbcModelC_H
9#define CbcModelC_H
10
11/* include all defines and ugly stuff */
12#include "Coin_C_defines.h"
13#include <stddef.h>
14
15/*
16 * Original version contributed by Bob Entriken,
17 * significantly updated by Miles Lubin.
18 * 2018: several updates by Haroldo
19 */
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/** Current version of Cbc */
26COINLIBAPI const char *COINLINKAGE Cbc_getVersion(void);
27
28/** \name Problem creation and modification routines */
29//@{
30
31/** @brief Creates an empty problem */
32COINLIBAPI Cbc_Model *COINLINKAGE
33Cbc_newModel(void);
34
35/** @brief Sets problem name.
36     *
37     * @param model problem object
38     * @param array string with problem name
39     **/
40COINLIBAPI int COINLINKAGE
41Cbc_setProblemName(Cbc_Model *model, const char *array);
42
43/** @brief Creates a new column
44     *
45     * Creates a new column (variable)
46     *
47     * @param model problem object
48     * @param name variable name
49     * @param lb column lower bound
50     * @param ub column upper bound
51     * @param obj objective function coefficient
52     * @param isInteger 1 if variable is integral, 0 otherwise
53     * @param nz number of rows (constraints) where this column appears, can be 0 if constraints will be added later
54     * @param rows index of rows where this column appears, NULL if rows will be added later
55     * @param coefs coefficients that this column appears in its rows, NULL if rows will be added later
56     ***/
57COINLIBAPI void COINLINKAGE
58Cbc_addCol(Cbc_Model *model, const char *name, double lb,
59  double ub, double obj, char isInteger,
60  int nz, int *rows, double *coefs);
61
62
63/** @brief Deletes some columns
64     *
65     *  Deletes some columns (variables)
66     *
67     *  @param model problem object
68     *  @param numCols
69     *  @param cols columns that will be deleted
70     * */
71COINLIBAPI void COINLINKAGE
72Cbc_deleteCols(Cbc_Model *model, int numCols, const int cols[]);
73
74/** @brief Adds a new row
75     *
76     *  Adds a new row (linear constraint) to the problem
77     *
78     *  @param model problem object
79     *  @param name constraint name
80     *  @param nz number of variables with non-zero coefficients in this row
81     *  @param cols index of variables that appear in this row
82     *  @param coefs cofficients that that variables appear
83     *  @param sense constraint sense: L if <=, G if >=, E if =, R if ranged and N if free
84     *  @param rhs right hand size
85     * */
86COINLIBAPI void COINLINKAGE
87Cbc_addRow(Cbc_Model *model, const char *name, int nz,
88  const int *cols, const double *coefs, char sense, double rhs);
89
90/** @brief Deletes some rows
91     *
92     *  Deletes some rows from the model
93     *
94     *  @param model problem object
95     *  @param numRows number of rows
96     *  @param rows rows to be deleted
97     * */
98COINLIBAPI void COINLINKAGE
99Cbc_deleteRows(Cbc_Model *model, int numRows, const int rows[]);
100
101/** @brief Add SOS constraints to the model using row-order matrix */
102COINLIBAPI void COINLINKAGE
103Cbc_addSOS(Cbc_Model *model, int numRows, const int *rowStarts,
104  const int *colIndices, const double *weights, const int type);
105
106/** Loads a problem (the constraints on the
107        rows are given by lower and upper bounds). If a pointer is NULL then the
108        following values are the default:
109        <ul>
110        <li> <code>colub</code>: all columns have upper bound infinity
111        <li> <code>collb</code>: all columns have lower bound 0
112        <li> <code>rowub</code>: all rows have upper bound infinity
113        <li> <code>rowlb</code>: all rows have lower bound -infinity
114        <li> <code>obj</code>: all variables have 0 objective coefficient
115        </ul>
116
117     The constraint matrix is
118     given in standard compressed sparse column (without gaps).
119     <ul>
120     <li> <code>start[i]</code> stores the starting index of the ith column
121     <li> <code>index[k]</code> stores the row index of the kth nonzero element
122     <li> <code>value[k]</code> stores the coefficient of the kth nonzero element
123     </ul>
124    */
125COINLIBAPI void COINLINKAGE
126Cbc_loadProblem(Cbc_Model *model, const int numcols, const int numrows,
127  const CoinBigIndex *start, const int *index,
128  const double *value,
129  const double *collb, const double *colub,
130  const double *obj,
131  const double *rowlb, const double *rowub);
132
133/** @brief Set the name of a column
134     *
135     * @param model problem object
136     * @param iColumn column index
137     * @param column name
138     **/
139COINLIBAPI void COINLINKAGE
140Cbc_setColName(Cbc_Model *model, int iColumn, const char *name);
141
142/** @brief Set the name of a row
143     *
144     * @param model problem object
145     * @param iRow row index
146     * @param name row name
147     **/
148COINLIBAPI void COINLINKAGE
149Cbc_setRowName(Cbc_Model *model, int iRow, const char *name);
150
151/** @brief Sets optimization direction
152    *
153    * @param model problem object
154    * @param sense: direction of optimization (1 - minimize, -1 - maximize, 0 - ignore)
155    **/
156COINLIBAPI void COINLINKAGE
157Cbc_setObjSense(Cbc_Model *model, double sense);
158
159/** @brief Set the lower bound of a single constraint
160     *
161     * @param model problem object
162     * @param index row index
163     * @param value new row lower bound
164     **/
165COINLIBAPI void COINLINKAGE
166Cbc_setRowLower(Cbc_Model *model, int index, double value);
167
168/** @brief  Set the upper bound of a single constraint
169     *
170     * @param model problem object
171     * @param index row index
172     * @param value new row upper bound
173     **/
174COINLIBAPI void COINLINKAGE
175Cbc_setRowUpper(Cbc_Model *model, int index, double value);
176
177/** @brief Set the objective coefficient of a single variable
178     *
179     * @param model problem object
180     * @param index variable index
181     * @param value new objective function coefficient for this variable
182     **/
183COINLIBAPI void COINLINKAGE
184Cbc_setObjCoeff(Cbc_Model *model, int index, double value);
185
186/** @brief Set the lower bound of a single variable
187     *
188     * @param model problem object
189     * @param index variable index
190     * @param value variable lower bound
191     **/
192COINLIBAPI void COINLINKAGE
193Cbc_setColLower(Cbc_Model *model, int index, double value);
194
195/** @brief Set the upper bound of a single variable
196     *
197     * @param model problem object
198     * @param index variable index
199     * @param value new variable upper bound
200     **/
201COINLIBAPI void COINLINKAGE
202Cbc_setColUpper(Cbc_Model *model, int index, double value);
203
204/** @brief Set this variable to be continuous
205     *
206     * @param model problem object
207     * @param iColumn column index
208     **/
209COINLIBAPI void COINLINKAGE
210Cbc_setContinuous(Cbc_Model *model, int iColumn);
211
212/** @brief Set this variable to be integer
213     *
214     * @param model problem object
215     * @param iColumn column index
216     **/
217COINLIBAPI void COINLINKAGE
218Cbc_setInteger(Cbc_Model *model, int iColumn);
219
220/** @brief Cbc_Model destructor */
221COINLIBAPI void COINLINKAGE
222Cbc_deleteModel(Cbc_Model *model);
223
224/** @brief Enter initial feasible solution
225     *
226     * Enter an initial feasible solution. Only the non-zero main
227     * binary/integer decision variables need to be informed.
228     * Auxiliary and/or continuous variables are computed
229     * automatically.
230     *
231     * @param model problem object
232     * @param count number of variables
233     * @param colNames names of variables
234     * @param colValues variable values
235     *
236     **/
237COINLIBAPI void COINLINKAGE
238Cbc_setMIPStart(Cbc_Model *model, int count, const char **colNames, const double colValues[]);
239
240/** @brief Enter initial feasible solution
241     *
242     * Enter an initial feasible solution. Only the non-zero main
243     * binary/integer decision variables need to be informed.
244     * Auxiliary and/or continuous variables are computed
245     * automatically. Same as setMIPStart but using variable indexes.
246     *
247     * @param model problem object
248     * @param count number of variables
249     * @param colIdxs indexes of variables
250     * @param colValues variable values
251     *
252     **/
253COINLIBAPI void COINLINKAGE
254Cbc_setMIPStartI(Cbc_Model *model, int count, const int colIdxs[], const double colValues[]);
255
256/** @brief Creates a copy of the current model
257     *
258     * @param model problem object
259     * @return model copy
260     **/
261COINLIBAPI Cbc_Model *COINLINKAGE
262Cbc_clone(Cbc_Model *model);
263
264//@}
265
266/** \name Routines to query problem contents
267*/
268//@{
269
270/** @brief Queries problem name
271     *
272     * @param model problem object
273     * @param maxNumberCharacters space in string array
274     * @param array string where problem name will be saved
275     **/
276COINLIBAPI void COINLINKAGE
277Cbc_problemName(Cbc_Model *model, int maxNumberCharacters, char *array);
278
279/** @brief Number of nonzero elements in constraint matrix
280     *
281     * @param model problem object
282     * @return number of non-zero entries in constraint matrix
283     **/
284COINLIBAPI int COINLINKAGE
285Cbc_getNumElements(Cbc_Model *model);
286
287/** @brief Number of variables in the model
288     * @param model problem object
289     * @return number of columns (variables)
290     **/
291COINLIBAPI int COINLINKAGE
292Cbc_getNumCols(Cbc_Model *model);
293
294/** @brief Number of integer variables in the model
295     *
296     * @param model problem object
297     * @return number of integer variables in this model
298     **/
299COINLIBAPI int COINLINKAGE
300Cbc_getNumIntegers(Cbc_Model *model);
301
302/** Number of constraints in the model
303     * @param model problem object
304     * @return number of rows (constraints) in the model
305     **/
306COINLIBAPI int COINLINKAGE
307Cbc_getNumRows(Cbc_Model *model);
308
309/** @brief Queries row name
310     *
311     * @param model problem object
312     * @param row index
313     * @param name string where row name will be stored
314     * @param string where row name will be stored
315     **/
316COINLIBAPI void COINLINKAGE
317Cbc_getRowName(Cbc_Model *model, int iRow, char *name, size_t maxLength);
318
319/** Queries column name
320     *
321     * @param model problem object
322     * @param iColumn column index
323     * @param name where name will be stored
324     * @param maxLength maximum length of name string
325     **/
326COINLIBAPI void COINLINKAGE
327Cbc_getColName(Cbc_Model *model, int iColumn, char *name, size_t maxLength);
328
329/** @brief Number of non-zero entries in a row
330     *
331     * @param model problem object
332     * @param row row index
333     * @return number of non-zero entries in row
334     **/
335COINLIBAPI int COINLINKAGE
336Cbc_getRowNz(Cbc_Model *model, int row);
337
338/** @brief Indices of variables that appear on a row
339     *
340     * @param model problem object
341     * @param row row index
342     * @return vector with indexes of columns that appear on this row
343     **/
344COINLIBAPI const int *COINLINKAGE
345Cbc_getRowIndices(Cbc_Model *model, int row);
346
347/** @brief Coefficients of variables that appear on this row
348     *
349     * @param model problem object
350     * @param row row index
351     * @return coefficients of variables that appear on this row
352     **/
353COINLIBAPI const double *COINLINKAGE
354Cbc_getRowCoeffs(Cbc_Model *model, int row);
355
356/** @brief Number of non-zero entries in a column
357     *
358     * @param model problem object
359     * @param col column index
360     * @return numbef of rows that this column appears
361     **/
362COINLIBAPI int COINLINKAGE
363Cbc_getColNz(Cbc_Model *model, int col);
364
365/** @brief Indices of rows that a column appears
366     *
367     * @param model problem object
368     * @param col column index
369     * @return indices of rows that this column appears
370     **/
371COINLIBAPI const int *COINLINKAGE
372Cbc_getColIndices(Cbc_Model *model, int col);
373
374/** @brief Coefficients that a column appear in rows
375     *
376     * @param model problem object
377     * @param col column index
378     * @return coefficients of this column in rows
379     **/
380COINLIBAPI const double *COINLINKAGE
381Cbc_getColCoeffs(Cbc_Model *model, int col);
382
383/** @brief Right hand side of a row
384     *
385     * @param model problem object
386     * @param row row index
387     * @return row right hand side
388     **/
389COINLIBAPI double COINLINKAGE
390Cbc_getRowRHS(Cbc_Model *model, int row);
391
392/** @brief Sense a row
393     * @param model problem object
394     * @param row row index
395     * @return row sense: E for =, L for <=, G for >= and R for ranged row
396     **/
397COINLIBAPI char COINLINKAGE
398Cbc_getRowSense(Cbc_Model *model, int row);
399
400/** @brief Direction of optimization
401     *
402     * @param model problem object
403     * @return Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore)
404     **/
405COINLIBAPI double COINLINKAGE
406Cbc_getObjSense(Cbc_Model *model);
407
408/** @brief Constraint lower bounds
409     *
410     * @param model problem object
411     * @return vector with lower bounds of constraints
412     **/
413COINLIBAPI const double *COINLINKAGE
414Cbc_getRowLower(Cbc_Model *model);
415
416/** @brief Constraint upper bounds
417     *
418     * @param model problem object
419     * @return constraint upper bounds
420     **/
421COINLIBAPI const double *COINLINKAGE
422Cbc_getRowUpper(Cbc_Model *model);
423
424/** @brief Objective vector
425     *
426     * @param model problem object
427     * @return vector with coefficients of variables in the objective function
428     **/
429COINLIBAPI const double *COINLINKAGE
430Cbc_getObjCoefficients(Cbc_Model *model);
431
432/** @brief Variable lower bounds
433     *
434     * @param model problem object
435     * @return vector with lower bounds of variables
436     **/
437COINLIBAPI const double *COINLINKAGE
438Cbc_getColLower(Cbc_Model *model);
439
440/** @brief Variable upper bounds
441     *
442     * @param model problem object
443     * @return vector with column upper bounds
444     **/
445COINLIBAPI const double *COINLINKAGE
446Cbc_getColUpper(Cbc_Model *model);
447
448/** @brief Determine whether the ith variable is integer restricted
449     *
450     * @param model problem object
451     * @param i variable index
452     * @return 1 if variable is integer, 0 otherwise
453     **/
454COINLIBAPI int COINLINKAGE
455Cbc_isInteger(Cbc_Model *model, int i);
456
457
458//@}
459
460/** \name Routines to load and save problems from disk
461*/
462//@{
463
464/** @brief Read an mps file from the given filename
465    *
466    * @param model problem object
467    * @param fileName file name
468    **/
469COINLIBAPI int COINLINKAGE
470Cbc_readMps(Cbc_Model *model, const char *filename);
471
472/** @brief Read an lp file from the given filename
473     *
474     * @param model problem object
475     * @param fileName file name
476     **/
477COINLIBAPI int COINLINKAGE
478Cbc_readLp(Cbc_Model *model, const char *filename);
479
480/** @brief Write an mps file from the given filename
481     *
482     * @param model problem object
483     * @param fileName file name
484     **/
485COINLIBAPI void COINLINKAGE
486Cbc_writeMps(Cbc_Model *model, const char *filename);
487
488/** @brief Write an lp file from the given filename
489     *
490     * @param model problem object
491     * @param fileName file name
492     **/
493COINLIBAPI void COINLINKAGE
494Cbc_writeLp(Cbc_Model *model, const char *filename);
495
496//@}
497
498/**@name Getting and setting model data
499     Note that problem access and modification methods,
500       such as getColLower and setColLower,
501       are *not valid* after calling Cbc_solve().
502       Therefore it is not recommended to reuse a Cbc_Model
503       object for multiple solves. A workaround is to call Cbc_clone()
504       before solving.
505     * */
506/*@{*/
507
508/** Provide an initial feasible solution to accelerate branch-and-bound
509     Note that feasibility of the solution is *not* verified.
510    */
511COINLIBAPI void COINLINKAGE
512Cbc_setInitialSolution(Cbc_Model *model, const double *sol);
513/** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */
514COINLIBAPI const CoinBigIndex *COINLINKAGE
515Cbc_getVectorStarts(Cbc_Model *model);
516/** "Row index" vector of constraint matrix */
517COINLIBAPI const int *COINLINKAGE
518Cbc_getIndices(Cbc_Model *model);
519/** Coefficient vector of constraint matrix */
520COINLIBAPI const double *COINLINKAGE
521Cbc_getElements(Cbc_Model *model);
522
523/** Maximum lenght of a row or column name */
524COINLIBAPI size_t COINLINKAGE
525Cbc_maxNameLength(Cbc_Model *model);
526/** Print the model */
527COINLIBAPI void COINLINKAGE
528Cbc_printModel(Cbc_Model *model, const char *argPrefix);
529/*@}*/
530
531/**@name Solver parameters */
532/*@{*/
533/** Set parameter "name" to value "value". Note that this
534     * translates directly to using "-name value" as a
535     * command-line argument to Cbc.*/
536COINLIBAPI void COINLINKAGE
537Cbc_setParameter(Cbc_Model *model, const char *name, const char *value);
538
539
540/** returns the allowable gap
541 */
542COINLIBAPI double COINLINKAGE
543Cbc_getAllowableGap(Cbc_Model *model);
544
545/** sets the allowable gap
546 */
547COINLIBAPI void COINLINKAGE
548Cbc_setAllowableGap(Cbc_Model *model, double allowedGap);
549
550/** returns the allowable fraction gap
551 */
552COINLIBAPI double COINLINKAGE
553Cbc_getAllowableFractionGap(Cbc_Model *model);
554
555/** sets the allowable fraction gap
556 */
557COINLIBAPI void COINLINKAGE
558Cbc_setAllowableFractionGap(Cbc_Model *model, double allowedFracionGap);
559
560/** returns the allowable percentage gap
561 */
562COINLIBAPI double COINLINKAGE
563Cbc_getAllowablePercentageGap(Cbc_Model *model);
564
565/** sets the allowable percentage gap
566 */
567COINLIBAPI void COINLINKAGE
568Cbc_setAllowablePercentageGap(Cbc_Model *model, double allowedPercentageGap);
569
570/** returns the time limit for the search process
571 */
572COINLIBAPI double COINLINKAGE
573Cbc_getMaximumSeconds(Cbc_Model *model);
574
575/** sets the time limit for the search process
576 */
577COINLIBAPI void COINLINKAGE
578Cbc_setMaximumSeconds(Cbc_Model *model, double maxSeconds);
579
580
581/** returns the maximum number of nodes that can be explored in the search tree
582 */
583COINLIBAPI int COINLINKAGE
584Cbc_getMaximumNodes(Cbc_Model *model);
585
586/** sets the maximum number of nodes that can be explored in the search tree
587 */
588COINLIBAPI void COINLINKAGE
589Cbc_setMaximumNodes(Cbc_Model *model, int maxNodes);
590
591/** returns solution limit for the search process
592 */
593COINLIBAPI int COINLINKAGE
594Cbc_getMaximumSolutions(Cbc_Model *model);
595
596/** sets a solution limit as a stopping criterion
597 */
598COINLIBAPI void COINLINKAGE
599Cbc_setMaximumSolutions(Cbc_Model *model, int maxSolutions);
600
601/** returns the current log leven
602 */
603COINLIBAPI int COINLINKAGE
604Cbc_getLogLevel(Cbc_Model *model);
605
606/** sets the log level
607 */
608COINLIBAPI void COINLINKAGE
609Cbc_setLogLevel(Cbc_Model *model, int logLevel);
610
611
612/** returns the cutoff
613 */
614COINLIBAPI double COINLINKAGE
615Cbc_getCutoff(Cbc_Model *model);
616
617/** sets the cutoff
618 */
619COINLIBAPI void COINLINKAGE
620Cbc_setCutoff(Cbc_Model *model, double cutoff);
621
622
623
624/*@}*/
625/**@name Message handling.  Call backs are handled by ONE function */
626/*@{*/
627/** Pass in Callback function.
628     Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
629COINLIBAPI void COINLINKAGE
630Cbc_registerCallBack(Cbc_Model *model,
631  cbc_callback userCallBack);
632
633/** Unset Callback function */
634COINLIBAPI void COINLINKAGE
635Cbc_clearCallBack(Cbc_Model *model);
636
637COINLIBAPI void COINLINKAGE Cbc_addCutCallback( 
638    Cbc_Model *model, cbc_cut_callback cutcb, 
639    const char *name, void *appData );
640
641COINLIBAPI void COINLINKAGE Cbc_addIncCallback(
642    Cbc_Model *model, cbc_incumbent_callback inccb, 
643    void *appData );
644
645/*@}*/
646
647/**@name Solving the model */
648/*@{*/
649/* Solve the model with Cbc (using CbcMain1).
650    */
651COINLIBAPI int COINLINKAGE
652Cbc_solve(Cbc_Model *model);
653/*@}*/
654
655/**@name Accessing the solution and optimization status */
656/*@{*/
657
658/** @brief Best feasible solution vector
659     *
660     * @param model problem object
661     * @return vector with best solution found
662     **/
663COINLIBAPI const double *COINLINKAGE
664Cbc_getColSolution(Cbc_Model *model);
665
666
667/** @brief Best known bound on the optimal objective value
668     *
669     * @param model problem object
670     * @return best possible cost (lower bound)
671     **/
672COINLIBAPI double COINLINKAGE
673Cbc_getBestPossibleObjValue(Cbc_Model *model);
674
675/** @brief Best integer feasible solution
676     *
677     * Best integer feasible solution or NULL if no integer feas sol found
678     *
679     * @param model problem object
680     * @return vector with the best solution found or NULL if no feasible solution was found
681     **/
682COINLIBAPI double *COINLINKAGE
683Cbc_bestSolution(Cbc_Model *model);
684
685/** @brief number of integer feasible solution saved
686     *
687     * @param model problem object
688     * @return number of saved solutions
689     **/
690COINLIBAPI int COINLINKAGE
691Cbc_numberSavedSolutions(Cbc_Model *model);
692
693/** @brief Vector with the i-th saved solution
694     *
695     * @param model problem object
696     * @param whichSol index of the solution to be retrieved
697     * @return vector with integer feasible solution
698     **/
699COINLIBAPI const double *COINLINKAGE
700Cbc_savedSolution(Cbc_Model *model, int whichSol);
701
702/** @brief Cost of the whichSol solution
703     *
704     * @param model problem object
705     * @param whichSol solution index
706     * @return solution cost
707     **/
708COINLIBAPI double COINLINKAGE
709Cbc_savedSolutionObj(Cbc_Model *model, int whichSol);
710
711/** @brief Queries vector of reduced costs
712     *
713     * @param model problem object
714     * @return reduced cost vector
715     **/
716COINLIBAPI const double *COINLINKAGE
717Cbc_getReducedCost(Cbc_Model *model);
718
719/** If optimization was abandoned due to numerical difficulties
720     *
721     * @param model problem object
722     * @return 1 if numerical difficulties interrupted the optimization, 0 otherwise
723     * */
724COINLIBAPI int COINLINKAGE
725Cbc_isAbandoned(Cbc_Model *model);
726
727/** @brief If the optimal solution was found
728     *
729     * @param model problem object
730     * @return 1 if optimal solution was found, 0 otherwise
731     **/
732COINLIBAPI int COINLINKAGE
733Cbc_isProvenOptimal(Cbc_Model *model);
734
735/** @brief If infeasibility was proven
736     *
737     * If model is infeasible, please note that infeasibility can also be declared
738     * if cutoff is informed and no solution better than the cutoff exists.
739     *
740     * @param model problem object
741     * @return 1 if model is infeasible, 0 otherwise
742     **/
743COINLIBAPI int COINLINKAGE
744Cbc_isProvenInfeasible(Cbc_Model *model);
745
746/** @brief Is continuous model unbounded ?
747    *
748    * @param model problem object
749    * @return 1 if model is unbounded, 0 otherwise
750    * */
751COINLIBAPI int COINLINKAGE
752Cbc_isContinuousUnbounded(Cbc_Model *model);
753
754/** Objective value of best feasible solution
755     *
756     * @param model problem object
757     * @return cost of the best solution found
758     * */
759COINLIBAPI double COINLINKAGE
760Cbc_getObjValue(Cbc_Model *model);
761
762/** @brief Final optimization status
763     *
764     * Returns the optimization status. For more info check function
765     * isProvenOptimal, isProvenInfeasible, etc. Check also secondary status.
766     * Possible status are:
767     *
768     * -1 before branchAndBound
769     * 0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found (or check value of best solution)
770     * 1 stopped - on maxnodes, maxsols, maxtime
771     * 2 execution abandoned due to numerical dificulties
772     * 5 user programmed interruption
773     *
774     * @param model problem object
775     * @return problem status
776    */
777COINLIBAPI int COINLINKAGE Cbc_status(Cbc_Model *model);
778
779/** @brief Secondary status of problem
780     *
781     * Returns additional information regarding the optimization status
782     *
783     * -1 unset (status_ will also be -1)
784     *  0 search completed with solution
785     *  1 linear relaxation not feasible (or worse than cutoff)
786     *  2 stopped on gap
787     *  3 stopped on nodes
788     *  4 stopped on time
789     *  5 stopped on user event
790     *  6 stopped on solutions
791     *  7 linear relaxation unbounded
792     *  8 stopped on iteration limit
793     *
794     *  @model problem object
795     *  @return optimization status
796    */
797COINLIBAPI int COINLINKAGE
798Cbc_secondaryStatus(Cbc_Model *model);
799
800/** Sum of primal infeasibilities */
801COINLIBAPI double COINLINKAGE
802Cbc_sumPrimalInfeasibilities(Cbc_Model *model);
803
804/** Number of primal infeasibilities */
805COINLIBAPI int COINLINKAGE
806Cbc_numberPrimalInfeasibilities(Cbc_Model *model);
807
808/** Just check solution (for external use) - sets sum of
809        infeasibilities etc */
810COINLIBAPI void COINLINKAGE
811Cbc_checkSolution(Cbc_Model *model);
812
813/** Number of iterations */
814COINLIBAPI int COINLINKAGE
815Cbc_getIterationCount(Cbc_Model *model);
816
817/** Node limit reached? */
818COINLIBAPI int COINLINKAGE
819Cbc_isNodeLimitReached(Cbc_Model *model);
820/** Time limit reached? */
821COINLIBAPI int COINLINKAGE
822Cbc_isSecondsLimitReached(Cbc_Model *model);
823/** Solution limit reached? */
824COINLIBAPI int COINLINKAGE
825Cbc_isSolutionLimitReached(Cbc_Model *model);
826/** Are there numerical difficulties (for initialSolve) ? */
827COINLIBAPI int COINLINKAGE
828Cbc_isInitialSolveAbandoned(Cbc_Model *model);
829/** Is optimality proven (for initialSolve) ? */
830COINLIBAPI int COINLINKAGE
831Cbc_isInitialSolveProvenOptimal(Cbc_Model *model);
832/** Is primal infeasiblity proven (for initialSolve) ? */
833COINLIBAPI int COINLINKAGE
834Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model *model);
835/** "row" solution
836     *  This is the vector A*x, where A is the constraint matrix
837     *  and x is the current solution. */
838COINLIBAPI const double *COINLINKAGE
839Cbc_getRowActivity(Cbc_Model *model);
840/** Number of nodes explored in B&B tree */
841COINLIBAPI int COINLINKAGE
842Cbc_getNodeCount(Cbc_Model *model);
843/** Print the solution */
844COINLIBAPI void COINLINKAGE
845Cbc_printSolution(Cbc_Model *model);
846
847/*@}*/
848
849/** \name OsiSolverInterface related routines (used in callbacks) */
850//@{
851
852/** @brief Returns number of cols in OsiSolverInterface object */
853COINLIBAPI int COINLINKAGE
854Osi_getNumCols( void *osi );
855
856/** @brief Returns column name in OsiSolverInterface object */
857COINLIBAPI void COINLINKAGE
858Osi_getColName( void *osi, int i, char *name, int maxLen );
859
860/** @brief Returns column lower bounds in OsiSolverInterface object */
861COINLIBAPI const double * COINLINKAGE
862Osi_getColLower( void *osi );
863
864/** @brief Returns column upper bounds in OsiSolverInterface object */
865COINLIBAPI const double * COINLINKAGE
866Osi_getColUpper( void *osi );
867
868/** @brief Returns integrality information for columns in OsiSolverInterface object */
869COINLIBAPI int COINLINKAGE
870Osi_isInteger( void *osi, int col );
871
872/** @brief Returns number of rows in OsiSolverInterface object */
873COINLIBAPI int COINLINKAGE
874Osi_getNumRows( void *osi );
875
876COINLIBAPI int COINLINKAGE
877Osi_getRowNz(void *osi, int row);
878
879/** @brief Indices of variables that appear on a row */
880COINLIBAPI const int *COINLINKAGE
881Osi_getRowIndices(void *osi, int row);
882
883/** @brief Coefficients of variables that appear on this row
884     *
885     * @param model problem object
886     * @param row row index
887     * @return coefficients of variables that appear on this row
888     **/
889COINLIBAPI const double *COINLINKAGE
890Osi_getRowCoeffs(void *osi, int row);
891
892/** @brief Right hand side of a row
893     *
894     * @param model problem object
895     * @param row row index
896     * @return row right hand side
897     **/
898COINLIBAPI double COINLINKAGE
899Osi_getRowRHS(void *osi, int row);
900
901/** @brief Sense a row
902     * @param model problem object
903     * @param row row index
904     * @return row sense: E for =, L for <=, G for >= and R for ranged row
905     **/
906COINLIBAPI char COINLINKAGE
907Osi_getRowSense(void *osi, int row);
908
909/** @brief Returns solution vector in OsiSolverInterface object */
910COINLIBAPI const double * COINLINKAGE
911Osi_getColSolution( void *osi );
912
913
914/*@}*/
915
916/** \name OsiCuts related routines (used in callbacks) */
917//@{
918
919/** adds a row cut (used in callback) */
920COINLIBAPI void COINLINKAGE
921OsiCuts_addRowCut( void *osiCuts, int nz, const int *idx, const double *coef, char sense, double rhs );
922
923/*@}*/
924
925#ifdef __cplusplus
926}
927#endif
928#endif
929
930/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
931*/
Note: See TracBrowser for help on using the repository browser.