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

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

option to store maps for fast search of column/row names in C API

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