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

Last change on this file since 2026 was 2026, checked in by mlubin, 5 years ago

remove some unimplemented functions from C interface

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.1 KB
Line 
1/* $Id: Cbc_C_Interface.h 2026 2014-03-30 04:54:14Z mlubin $ */
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/** This is a "C" interface to Cbc.
16    Original verison contributed by Bob Entriken,
17    significantly updated by Miles Lubin.
18*/
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24    /**@name Constructors and destructor
25       The user does not need to know structure of Cbc_Model.
26    */
27    /*@{*/
28
29    /** Default Cbc_Model constructor */
30    COINLIBAPI Cbc_Model * COINLINKAGE
31    Cbc_newModel(void)
32    ;
33    /** Cbc_Model Destructor */
34    COINLIBAPI void COINLINKAGE
35    Cbc_deleteModel(Cbc_Model * model)
36    ;
37    /** Current version of Cbc */
38    COINLIBAPI const char* COINLINKAGE Cbc_getVersion(void)
39    ;
40    /*@}*/
41
42    /**@name Getting and setting model data */
43    /*@{*/
44    /** Loads a problem (the constraints on the
45        rows are given by lower and upper bounds). If a pointer is NULL then the
46        following values are the default:
47        <ul>
48        <li> <code>colub</code>: all columns have upper bound infinity
49        <li> <code>collb</code>: all columns have lower bound 0
50        <li> <code>rowub</code>: all rows have upper bound infinity
51        <li> <code>rowlb</code>: all rows have lower bound -infinity
52        <li> <code>obj</code>: all variables have 0 objective coefficient
53        </ul>
54
55     The constraint matrix is
56     given in standard compressed sparse column (without gaps).
57     <ul>
58     <li> <code>start[i]</code> stores the starting index of the ith column
59     <li> <code>index[k]</code> stores the row index of the kth nonzero element
60     <li> <code>value[k]</code> stores the coefficient of the kth nonzero element
61     </ul>
62    */
63    COINLIBAPI void COINLINKAGE
64    Cbc_loadProblem (Cbc_Model * model,  const int numcols, const int numrows,
65                     const CoinBigIndex * start, const int* index,
66                     const double* value,
67                     const double* collb, const double* colub,
68                     const double* obj,
69                     const double* rowlb, const double* rowub)
70    ;
71    /** Read an mps file from the given filename */
72    COINLIBAPI int COINLINKAGE
73    Cbc_readMps(Cbc_Model * model, const char *filename)
74    ;
75    /** Write an mps file from the given filename */
76    COINLIBAPI void COINLINKAGE
77    Cbc_writeMps(Cbc_Model * model, const char *filename)
78    ;
79    /** Deletes rows */
80    COINLIBAPI void COINLINKAGE
81    Cbc_deleteRows(Cbc_Model * model, int number, const int * which)
82    ;
83    /** Add rows */
84    COINLIBAPI void COINLINKAGE
85    Cbc_addRows(Cbc_Model * model, const int number, const double * rowLower,
86                const double * rowUpper,
87                const int * rowStarts, const int * columns,
88                const double * elements)
89    ;
90
91    /** Deletes columns */
92    COINLIBAPI void COINLINKAGE
93    Cbc_deleteColumns(Cbc_Model * model, int number, const int * which)
94    ;
95    /** Add columns */
96    COINLIBAPI void COINLINKAGE
97    Cbc_addColumns(Cbc_Model * model, int number, const double * columnLower,
98                   const double * columnUpper,
99                   const double * objective,
100                   const int * columnStarts, const int * rows,
101                   const double * elements);
102    /** Fills in array with problem name  */
103    COINLIBAPI void COINLINKAGE
104    Cbc_problemName(Cbc_Model * model, int maxNumberCharacters, char * array)
105    ;
106    /** Sets problem name.
107   
108      \p array must be a null-terminated string.
109    */
110    COINLIBAPI int COINLINKAGE
111    Cbc_setProblemName(Cbc_Model * model, const char * array)
112    ;
113
114    /** Number of nonzero elements in constraint matrix */
115    COINLIBAPI int COINLINKAGE
116    Cbc_getNumElements(Cbc_Model * model)
117    ;
118    /** "Column start" vector of constraint matrix. Same format as Cbc_loadProblem() */
119    COINLIBAPI const CoinBigIndex * COINLINKAGE
120    Cbc_getVectorStarts(Cbc_Model * model)
121    ;
122    /** "Row index" vector of constraint matrix */
123    COINLIBAPI const int * COINLINKAGE
124    Cbc_getIndices(Cbc_Model * model)
125    ;
126    /** Coefficient vector of constraint matrix */
127    COINLIBAPI const double * COINLINKAGE
128    Cbc_getElements(Cbc_Model * model)
129    ;
130
131    /** Maximum lenght of a row or column name */
132    COINLIBAPI size_t COINLINKAGE
133    Cbc_maxNameLength(Cbc_Model * model)
134    ;
135    /** Fill in first maxLength bytes of name array with a row name */
136    COINLIBAPI void COINLINKAGE
137    Cbc_getRowName(Cbc_Model * model, int iRow, char * name, size_t maxLength)
138    ;
139    /** Fill in first maxLength bytes of name array with a column name */
140    COINLIBAPI void COINLINKAGE
141    Cbc_getColName(Cbc_Model * model, int iColumn, char * name, size_t maxLength)
142    ;
143    /** Set the name of a column */
144    COINLIBAPI void COINLINKAGE
145    Cbc_setColName(Cbc_Model * model, int iColumn, const char * name)
146    ;
147    /** Set the name of a row */
148    COINLIBAPI void COINLINKAGE
149    Cbc_setRowName(Cbc_Model * model, int iRow, const char * name)
150    ;
151    /** Number of constraints in the model */
152    COINLIBAPI int COINLINKAGE
153    Cbc_getNumRows(Cbc_Model * model)
154    ;
155    /** Number of variables in the model */
156    COINLIBAPI int COINLINKAGE
157    Cbc_getNumCols(Cbc_Model * model)
158    ;
159    /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
160    COINLIBAPI void COINLINKAGE
161    Cbc_setObjSense(Cbc_Model * model, double sense)
162    ;
163    /** Direction of optimization (1 - minimize, -1 - maximize, 0 - ignore) */
164    COINLIBAPI double COINLINKAGE
165    Cbc_getObjSense(Cbc_Model * model)
166    ;
167    /** Constraint lower bounds */
168    COINLIBAPI const double* COINLINKAGE
169    Cbc_getRowLower(Cbc_Model * model)
170    ;
171    /** Constraint upper bounds */
172    COINLIBAPI const double* COINLINKAGE
173    Cbc_getRowUpper(Cbc_Model * model)
174    ;
175    /** Objective vector */
176    COINLIBAPI const double * COINLINKAGE
177    Cbc_getObjCoefficients(Cbc_Model * model)
178    ;
179    /** Variable lower bounds */
180    COINLIBAPI const double * COINLINKAGE
181    Cbc_getColLower(Cbc_Model * model)
182    ;
183    /** Variable upper bounds */
184    COINLIBAPI const double * COINLINKAGE
185    Cbc_getColUpper(Cbc_Model * model)
186    ;
187    /** Determine whether the ith variable is integer restricted */
188    COINLIBAPI int COINLINKAGE
189    Cbc_isInteger(Cbc_Model * model, int i)
190    ;
191    /** Set this variable to be continuous */
192    COINLIBAPI Cbc_Model * COINLINKAGE
193    Cbc_setContinuous(Cbc_Model * model, int iColumn)
194    ;
195    /** Set this variable to be integer */
196    COINLIBAPI Cbc_Model * COINLINKAGE
197    Cbc_setInteger(Cbc_Model * model, int iColumn)
198    ;
199    /** Add SOS constraints to the model using dense matrix */
200    COINLIBAPI void  COINLINKAGE
201    Cbc_addSOS_Dense(Cbc_Model * model, int numObjects, const int * len,
202                     const int * const * which, const double * weights, const int type)
203    ;
204    /** Add SOS constraints to the model using row-order matrix */
205    COINLIBAPI void  COINLINKAGE
206    Cbc_addSOS_Sparse(Cbc_Model * model, const int * rowStarts,
207                      const int * rowIndices, const double * weights, const int type)
208    ;
209    /** Print the model */
210    COINLIBAPI void COINLINKAGE
211    Cbc_printModel(Cbc_Model * model, const char * argPrefix)
212    ;
213    /** Return a copy of this model */
214    COINLIBAPI Cbc_Model * COINLINKAGE
215    Cbc_clone(Cbc_Model * model)
216    ;
217    /*@}*/
218    /**@name Solver parameters */
219    /*@{*/
220    /** Set parameter "name" to value "value". Note that this
221     * translates directly to using "-name value" as a
222     * command-line argument to Cbc.*/
223    COINLIBAPI void COINLINKAGE
224    Cbc_setParameter(Cbc_Model * model, const char * name, const char * value)
225    ;
226
227   
228    /*@}*/
229    /**@name Message handling.  Call backs are handled by ONE function */
230    /*@{*/
231    /** Pass in Callback function.
232     Message numbers up to 1000000 are Clp, Coin ones have 1000000 added */
233    COINLIBAPI void COINLINKAGE
234    Cbc_registerCallBack(Cbc_Model * model,
235                         cbc_callback userCallBack)
236    ;
237    /** Unset Callback function */
238    COINLIBAPI void COINLINKAGE
239    Cbc_clearCallBack(Cbc_Model * model)
240    ;
241
242    /*@}*/
243
244
245    /**@name Solving the model */
246    /*@{*/
247    /* Solve the model with Cbc (using CbcMain1).
248    */
249    COINLIBAPI int COINLINKAGE
250    Cbc_solve(Cbc_Model * model)
251    ;
252    /*@}*/
253
254
255    /**@name Accessing the solution and solution status */
256    /*@{*/
257
258    /** Sum of primal infeasibilities */
259    COINLIBAPI double COINLINKAGE
260    Cbc_sumPrimalInfeasibilities(Cbc_Model * model)
261    ;
262    /** Number of primal infeasibilities */
263    COINLIBAPI int COINLINKAGE
264    Cbc_numberPrimalInfeasibilities(Cbc_Model * model)
265    ;
266
267    /** Just check solution (for external use) - sets sum of
268        infeasibilities etc */
269    COINLIBAPI void COINLINKAGE
270    Cbc_checkSolution(Cbc_Model * model)
271    ;
272
273    /** Number of iterations */
274    COINLIBAPI int COINLINKAGE
275    Cbc_getIterationCount(Cbc_Model * model)
276    ;
277    /** Are there a numerical difficulties? */
278    COINLIBAPI int COINLINKAGE
279    Cbc_isAbandoned(Cbc_Model * model)
280    ;
281    /** Is optimality proven? */
282    COINLIBAPI int COINLINKAGE
283    Cbc_isProvenOptimal(Cbc_Model * model)
284    ;
285    /** Is infeasiblity proven (or none better than cutoff)? */
286    COINLIBAPI int COINLINKAGE
287    Cbc_isProvenInfeasible(Cbc_Model * model)
288    ;
289    /** Was continuous solution unbounded? */
290    COINLIBAPI int COINLINKAGE
291    Cbc_isContinuousUnbounded(Cbc_Model * model)
292    ;
293    /** Node limit reached? */
294    COINLIBAPI int COINLINKAGE
295    Cbc_isNodeLimitReached(Cbc_Model * model)
296    ;
297    /** Time limit reached? */
298    COINLIBAPI int COINLINKAGE
299    Cbc_isSecondsLimitReached(Cbc_Model * model)
300    ;
301    /** Solution limit reached? */
302    COINLIBAPI int COINLINKAGE
303    Cbc_isSolutionLimitReached(Cbc_Model * model)
304    ;
305    /** Are there numerical difficulties (for initialSolve) ? */
306    COINLIBAPI int COINLINKAGE
307    Cbc_isInitialSolveAbandoned(Cbc_Model * model)
308    ;
309    /** Is optimality proven (for initialSolve) ? */
310    COINLIBAPI int COINLINKAGE
311    Cbc_isInitialSolveProvenOptimal(Cbc_Model * model)
312    ;
313    /** Is primal infeasiblity proven (for initialSolve) ? */
314    COINLIBAPI int COINLINKAGE
315    Cbc_isInitialSolveProvenPrimalInfeasible(Cbc_Model * model)
316    ;
317    /** "row" solution
318     *  This is the vector A*x, where A is the constraint matrix
319     *  and x is the current solution. */
320    COINLIBAPI const double * COINLINKAGE
321    Cbc_getRowActivity(Cbc_Model * model)
322    ;
323    /** Best feasible solution vector */
324    COINLIBAPI const double * COINLINKAGE
325    Cbc_getColSolution(Cbc_Model * model)
326    ;
327    /** Objective value of best feasible solution */
328    COINLIBAPI double COINLINKAGE
329    Cbc_getObjValue(Cbc_Model * model)
330    ;
331    /** Best known bound on the optimal objective value */
332    COINLIBAPI double COINLINKAGE
333    Cbc_getBestPossibleObjValue(Cbc_Model * model)
334    ;
335    /** Number of nodes explored in B&B tree */
336    COINLIBAPI int COINLINKAGE
337    Cbc_getNodeCount(Cbc_Model * model)
338    ;
339    /** Print the solution */
340    COINLIBAPI void  COINLINKAGE
341    Cbc_printSolution(Cbc_Model * model)
342    ;
343    /** Final status of problem
344        Some of these can be found out by is...... functions
345        -1 before branchAndBound
346        0 finished - check isProvenOptimal or isProvenInfeasible to see if solution found
347        (or check value of best solution)
348        1 stopped - on maxnodes, maxsols, maxtime
349        2 difficulties so run was abandoned
350        (5 event user programmed event occurred)
351    */
352    COINLIBAPI int COINLINKAGE
353    Cbc_status(Cbc_Model * model)
354    ;
355    /** Secondary status of problem
356        -1 unset (status_ will also be -1)
357        0 search completed with solution
358        1 linear relaxation not feasible (or worse than cutoff)
359        2 stopped on gap
360        3 stopped on nodes
361        4 stopped on time
362        5 stopped on user event
363        6 stopped on solutions
364        7 linear relaxation unbounded
365        8 stopped on iteration limit
366    */
367    COINLIBAPI int COINLINKAGE
368    Cbc_secondaryStatus(Cbc_Model * model)
369    ;
370    /*@}*/
371#ifdef __cplusplus
372}
373#endif
374#endif
Note: See TracBrowser for help on using the repository browser.