1 | /* cplex.h (CPLEX-like interface to GLPK API) */ |
---|
2 | |
---|
3 | /*********************************************************************** |
---|
4 | * This code is part of GLPK (GNU Linear Programming Kit). |
---|
5 | * |
---|
6 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
---|
7 | * 2009, 2010 Andrew Makhorin, Department for Applied Informatics, |
---|
8 | * Moscow Aviation Institute, Moscow, Russia. All rights reserved. |
---|
9 | * E-mail: <mao@gnu.org>. |
---|
10 | * |
---|
11 | * GLPK is free software: you can redistribute it and/or modify it |
---|
12 | * under the terms of the GNU General Public License as published by |
---|
13 | * the Free Software Foundation, either version 3 of the License, or |
---|
14 | * (at your option) any later version. |
---|
15 | * |
---|
16 | * GLPK is distributed in the hope that it will be useful, but WITHOUT |
---|
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
18 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
---|
19 | * License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU General Public License |
---|
22 | * along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | ***********************************************************************/ |
---|
24 | |
---|
25 | #ifndef _CPLEX_H |
---|
26 | #define _CPLEX_H |
---|
27 | |
---|
28 | #ifdef __cplusplus |
---|
29 | extern "C" { |
---|
30 | #endif |
---|
31 | |
---|
32 | typedef struct CPXENV CPXENV, *CPXENVptr; |
---|
33 | typedef struct CPXLP CPXLP, *CPXLPptr; |
---|
34 | |
---|
35 | #define CPX_VERSION 900 |
---|
36 | |
---|
37 | #define CPX_OFF 0 |
---|
38 | #define CPX_ON 1 |
---|
39 | |
---|
40 | #define CPX_INFBOUND 1e20 |
---|
41 | |
---|
42 | /* error codes: */ |
---|
43 | #define CPXERR_NO_MEMORY 1001 |
---|
44 | #define CPXERR_NO_ENVIRONMENT 1002 |
---|
45 | #define CPXERR_BAD_ARGUMENT 1003 |
---|
46 | #define CPXERR_NULL_POINTER 1004 |
---|
47 | #define CPXERR_NO_PROBLEM 1009 |
---|
48 | #define CPXERR_BAD_PARAM_NUM 1013 |
---|
49 | #define CPXERR_PARAM_TOO_SMALL 1014 |
---|
50 | #define CPXERR_PARAM_TOO_BIG 1015 |
---|
51 | #define CPXERR_INDEX_RANGE 1200 |
---|
52 | #define CPXERR_COL_INDEX_RANGE 1201 |
---|
53 | #define CPXERR_ROW_INDEX_RANGE 1203 |
---|
54 | #define CPXERR_NEGATIVE_SURPLUS 1207 |
---|
55 | #define CPXERR_BAD_SENSE 1215 |
---|
56 | #define CPXERR_NO_SOLN 1217 |
---|
57 | #define CPXERR_NOT_FIXED 1221 |
---|
58 | #define CPXERR_DUP_ENTRY 1222 |
---|
59 | #define CPXERR_NULL_NAME 1224 |
---|
60 | #define CPXERR_ARRAY_NOT_ASCENDING 1226 |
---|
61 | #define CPXERR_COUNT_RANGE 1227 |
---|
62 | #define CPXERR_BAD_LUB 1229 |
---|
63 | #define CPXERR_BAD_STATUS 1253 |
---|
64 | #define CPXERR_NO_BASIC_SOLN 1261 |
---|
65 | #define CPXERR_NO_FILENAME 1421 |
---|
66 | #define CPXERR_FAIL_OPEN_WRITE 1422 |
---|
67 | #define CPXERR_BAD_FILETYPE 1424 |
---|
68 | #define CPXERR_BAD_CTYPE 3021 |
---|
69 | |
---|
70 | /* control parameters: */ |
---|
71 | #define CPX_PARAM_ADVIND 1001 |
---|
72 | #define CPX_PARAM_AGGIND 1003 |
---|
73 | #define CPX_PARAM_DPRIIND 1009 |
---|
74 | #define CPX_PARAM_EPOPT 1014 |
---|
75 | #define CPX_PARAM_EPPER 1015 |
---|
76 | #define CPX_PARAM_EPRHS 1016 |
---|
77 | #define CPX_PARAM_FASTMIP 1017 /* ??? */ |
---|
78 | #define CPX_PARAM_SIMDISPLAY 1019 |
---|
79 | #define CPX_PARAM_ITLIM 1020 |
---|
80 | #define CPX_PARAM_OBJLLIM 1025 |
---|
81 | #define CPX_PARAM_OBJULIM 1026 |
---|
82 | #define CPX_PARAM_PERIND 1027 |
---|
83 | #define CPX_PARAM_PPRIIND 1029 |
---|
84 | #define CPX_PARAM_PREIND 1030 |
---|
85 | #define CPX_PARAM_REINV 1031 |
---|
86 | #define CPX_PARAM_SCRIND 1035 |
---|
87 | #define CPX_PARAM_DATACHECK 1056 |
---|
88 | |
---|
89 | /* CPX_PARAM_DPRIIND: */ |
---|
90 | #define CPX_DPRIIND_AUTO 0 |
---|
91 | #define CPX_DPRIIND_FULL 1 |
---|
92 | #define CPX_DPRIIND_STEEP 2 |
---|
93 | #define CPX_DPRIIND_FULL_STEEP 3 |
---|
94 | #define CPX_DPRIIND_STEEPQSTART 4 |
---|
95 | #define CPX_DPRIIND_DEVEX 5 |
---|
96 | |
---|
97 | /* CPX_PARAM_PPRIIND: */ |
---|
98 | #define CPX_PPRIIND_PARTIAL (-1) |
---|
99 | #define CPX_PPRIIND_AUTO 0 |
---|
100 | #define CPX_PPRIIND_DEVEX 1 |
---|
101 | #define CPX_PPRIIND_STEEP 2 |
---|
102 | #define CPX_PPRIIND_STEEPQSTART 3 |
---|
103 | #define CPX_PPRIIND_FULL 4 |
---|
104 | |
---|
105 | /* CPXgetprobtype: */ |
---|
106 | #define CPXPROB_LP 0 |
---|
107 | #define CPXPROB_MIP 1 |
---|
108 | #define CPXPROB_RELAXED 2 |
---|
109 | #define CPXPROB_FIXED 3 |
---|
110 | #define CPXPROB_QP 5 |
---|
111 | #define CPXPROB_ZEROEDQP 6 |
---|
112 | |
---|
113 | /* CPXgetobjsen: */ |
---|
114 | #define CPX_MIN 1 |
---|
115 | #define CPX_MAX (-1) |
---|
116 | |
---|
117 | /* CPXgetbase: */ |
---|
118 | #define CPX_AT_LOWER 0 |
---|
119 | #define CPX_BASIC 1 |
---|
120 | #define CPX_AT_UPPER 2 |
---|
121 | #define CPX_FREE_SUPER 3 |
---|
122 | |
---|
123 | /* CPXgetstat: */ |
---|
124 | #define CPX_STAT_OPTIMAL 1 |
---|
125 | #define CPX_STAT_UNBOUNDED 2 |
---|
126 | #define CPX_STAT_INFEASIBLE 3 |
---|
127 | #define CPX_STAT_INForUNBD 4 |
---|
128 | #define CPX_STAT_OPTIMAL_INFEAS 5 |
---|
129 | #define CPX_STAT_ABORT_IT_LIM 10 |
---|
130 | #define CPX_STAT_ABORT_OBJ_LIM 12 |
---|
131 | |
---|
132 | /* CPXgetmethod: */ |
---|
133 | #define CPX_ALG_NONE 0 |
---|
134 | #define CPX_ALG_PRIMAL 1 |
---|
135 | #define CPX_ALG_DUAL 2 |
---|
136 | #define CPX_ALG_BARRIER 4 |
---|
137 | |
---|
138 | /* CPXsolninfo: */ |
---|
139 | #define CPX_NO_SOLN 0 |
---|
140 | #define CPX_BASIC_SOLN 1 |
---|
141 | #define CPX_NONBASIC_SOLN 2 |
---|
142 | #define CPX_PRIMAL_SOLN 3 |
---|
143 | |
---|
144 | int CPXaddcols(CPXENV *env, CPXLP *lp, int ccnt, int nzcnt, |
---|
145 | const double obj[], const int cmatbeg[], const int cmatind[], |
---|
146 | const double cmatval[], const double lb[], const double ub[], |
---|
147 | char *colname[]); |
---|
148 | |
---|
149 | int CPXaddrows(CPXENV *env, CPXLP *lp, int ccnt, int rcnt, int nzcnt, |
---|
150 | const double rhs[], const char sense[], const int rmatbeg[], |
---|
151 | const int rmatind[], const double rmatval[], char *colname[], |
---|
152 | char *rowname[]); |
---|
153 | |
---|
154 | int CPXbaropt(CPXENV *env, CPXLP *lp); |
---|
155 | |
---|
156 | int CPXbinvrow(CPXENV *env, CPXLP *lp, int i, double y[]); |
---|
157 | |
---|
158 | int CPXchgbds(CPXENV *env, CPXLP *lp, int cnt, const int indices[], |
---|
159 | const char lu[], const double bd[]); |
---|
160 | |
---|
161 | int CPXchgcoeflist(CPXENV *env, CPXLP *lp, int numcoefs, |
---|
162 | const int rowlist[], const int collist[], const double vallist[]); |
---|
163 | |
---|
164 | void CPXchgobjsen(CPXENV *env, CPXLP *lp, int maxormin); |
---|
165 | |
---|
166 | int CPXchgsense(CPXENV *env, CPXLP *lp, int cnt, const int indices[], |
---|
167 | const char sense[]); |
---|
168 | |
---|
169 | int CPXcloseCPLEX(CPXENV **env); |
---|
170 | |
---|
171 | int CPXcopybase(CPXENV *env, CPXLP *lp, const int cstat[], |
---|
172 | const int rstat[]); |
---|
173 | |
---|
174 | int CPXcopybasednorms(CPXENV *env, CPXLP *lp, const int cstat[], |
---|
175 | const int rstat[], const double dnorm[]); |
---|
176 | |
---|
177 | int CPXcopylp(CPXENV *env, CPXLP *lp, int numcols, int numrows, |
---|
178 | int objsen, const double obj[], const double rhs[], |
---|
179 | const char sense[], const int matbeg[], const int matcnt[], |
---|
180 | const int matind[], const double matval[], const double lb[], |
---|
181 | const double ub[], const double rngval[]); |
---|
182 | |
---|
183 | int CPXcopylpwnames(CPXENV *env, CPXLP *lp, int numcols, int numrows, |
---|
184 | int objsen, const double obj[], const double rhs[], |
---|
185 | const char sense[], const int matbeg[], const int matcnt[], |
---|
186 | const int matind[], const double matval[], const double lb[], |
---|
187 | const double ub[], const double rngval[], char *colname[], |
---|
188 | char *rowname[]); |
---|
189 | |
---|
190 | CPXLP *CPXcreateprob(CPXENV *env, int *status, const char *probname); |
---|
191 | |
---|
192 | int CPXdelcols(CPXENV *env, CPXLP *lp, int begin, int end); |
---|
193 | |
---|
194 | int CPXdelrows(CPXENV *env, CPXLP *lp, int begin, int end); |
---|
195 | |
---|
196 | int CPXdelsetcols(CPXENV *env, CPXLP *lp, int delstat[]); |
---|
197 | |
---|
198 | int CPXdelsetrows(CPXENV *env, CPXLP *lp, int delstat[]); |
---|
199 | |
---|
200 | int CPXdualopt(CPXENV *env, CPXLP *lp); |
---|
201 | |
---|
202 | int CPXfreeprob(CPXENV *env, CPXLP **lp); |
---|
203 | |
---|
204 | int CPXgetbase(CPXENV *env, CPXLP *lp, int cstat[], int rstat[]); |
---|
205 | |
---|
206 | int CPXgetbasednorms(CPXENV *env, CPXLP *lp, int cstat[], int rstat[], |
---|
207 | double dnorm[]); |
---|
208 | |
---|
209 | int CPXgetbhead(CPXENV *env, CPXLP *lp, int head[], double x[]); |
---|
210 | |
---|
211 | int CPXgetdblparam(CPXENV *env, int whichparam, double *value); |
---|
212 | |
---|
213 | int CPXgetdj(CPXENV *env, CPXLP *lp, double dj[], int begin, int end); |
---|
214 | |
---|
215 | char *CPXgeterrorstring(CPXENV *env, int errcode, char *buffer); |
---|
216 | |
---|
217 | int CPXgetijdiv(CPXENV *env, CPXLP *lp, int *idiv, int *jdiv); |
---|
218 | |
---|
219 | int CPXgetintparam(CPXENV *env, int whichparam, int *value); |
---|
220 | |
---|
221 | int CPXgetlb(CPXENV *env, CPXLP *lp, double lb[], int begin, int end); |
---|
222 | |
---|
223 | int CPXgetmethod(CPXENV *env, CPXLP *lp); |
---|
224 | |
---|
225 | int CPXgetnumcols(CPXENV *env, CPXLP *lp); |
---|
226 | |
---|
227 | int CPXgetnumnz(CPXENV *env, CPXLP *lp); |
---|
228 | |
---|
229 | int CPXgetnumrows(CPXENV *env, CPXLP *lp); |
---|
230 | |
---|
231 | int CPXgetobjval(CPXENV *env, CPXLP *lp, double *objval); |
---|
232 | |
---|
233 | int CPXgetpi(CPXENV *env, CPXLP *lp, double pi[], int begin, int end); |
---|
234 | |
---|
235 | int CPXgetsense(CPXENV *env, CPXLP *lp, char sense[], int begin, |
---|
236 | int end); |
---|
237 | |
---|
238 | int CPXgetslack(CPXENV *env, CPXLP *lp, double slack[], int begin, |
---|
239 | int end); |
---|
240 | |
---|
241 | int CPXgetstat(CPXENV *env, CPXLP *lp); |
---|
242 | |
---|
243 | int CPXgetub(CPXENV *env, CPXLP *lp, double ub[], int begin, int end); |
---|
244 | |
---|
245 | int CPXgetweight(CPXENV *env, CPXLP *lp, int rcnt, const int rmatbeg[], |
---|
246 | const int rmatind[], const double rmatval[], double weight[], |
---|
247 | int dpriind); |
---|
248 | |
---|
249 | int CPXgetx(CPXENV *env, CPXLP *lp, double x[], int begin, int end); |
---|
250 | |
---|
251 | int CPXinfodblparam(CPXENV *env, int whichparam, double *defvalue, |
---|
252 | double *minvalue, double *maxvalue); |
---|
253 | |
---|
254 | int CPXinfointparam(CPXENV *env, int whichparam, int *defvalue, |
---|
255 | int *minvalue, int *maxvalue); |
---|
256 | |
---|
257 | int CPXlpopt(CPXENV *env, CPXLP *lp); |
---|
258 | |
---|
259 | int CPXmdleave(const CPXENV *env, CPXLP *lp, const int goodlist[], |
---|
260 | int goodlen, double downratio[], double upratio[]); |
---|
261 | |
---|
262 | int CPXnewcols(CPXENV *env, CPXLP *lp, int ccnt, const double obj[], |
---|
263 | const double lb[], const double ub[], const char ctype[], |
---|
264 | char *colname[]); |
---|
265 | |
---|
266 | int CPXnewrows(CPXENV *env, CPXLP *lp, int rcnt, const double rhs[], |
---|
267 | const char sense[], const double rngval[], char *rowname[]); |
---|
268 | |
---|
269 | CPXENV *CPXopenCPLEX(int *status); |
---|
270 | |
---|
271 | int CPXpivotin(CPXENV *env, CPXLP *lp, const int rlist[], int rlen); |
---|
272 | |
---|
273 | int CPXpivotout(CPXENV *env, CPXLP *lp, const int clist[], int clen); |
---|
274 | |
---|
275 | int CPXprimopt(CPXENV *env, CPXLP *lp); |
---|
276 | |
---|
277 | int CPXsavwrite(CPXENV *env, CPXLP *lp, const char *filename); |
---|
278 | |
---|
279 | int CPXsetdblparam(CPXENV *env, int whichparam, double newvalue); |
---|
280 | |
---|
281 | int CPXsetintparam(CPXENV *env, int whichparam, int newvalue); |
---|
282 | |
---|
283 | int CPXsolninfo(CPXENV *env, CPXLP *lp, int *solnmethod, int *solntype, |
---|
284 | int *pfeasind, int *dfeasind); |
---|
285 | |
---|
286 | int CPXsolution(CPXENV *env, CPXLP *lp, int *lpstat, double *objval, |
---|
287 | double x[], double pi[], double slack[], double dj[]); |
---|
288 | |
---|
289 | int CPXstrongbranch(CPXENV *env, CPXLP *lp, const int goodlist[], |
---|
290 | int goodlen, double downpen[], double uppen[], int itlim); |
---|
291 | |
---|
292 | int CPXwriteprob(CPXENV *env, CPXLP *lp, const char *filename, |
---|
293 | const char *filetype); |
---|
294 | |
---|
295 | #ifdef __cplusplus |
---|
296 | } |
---|
297 | #endif |
---|
298 | |
---|
299 | #endif |
---|
300 | |
---|
301 | /* eof */ |
---|