1 /* cplex.h (CPLEX-like interface to GLPK API) */
3 /***********************************************************************
4 * This code is part of GLPK (GNU Linear Programming Kit).
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>.
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.
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.
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 ***********************************************************************/
32 typedef struct CPXENV CPXENV, *CPXENVptr;
33 typedef struct CPXLP CPXLP, *CPXLPptr;
35 #define CPX_VERSION 900
40 #define CPX_INFBOUND 1e20
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
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
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
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
105 /* CPXgetprobtype: */
107 #define CPXPROB_MIP 1
108 #define CPXPROB_RELAXED 2
109 #define CPXPROB_FIXED 3
111 #define CPXPROB_ZEROEDQP 6
118 #define CPX_AT_LOWER 0
120 #define CPX_AT_UPPER 2
121 #define CPX_FREE_SUPER 3
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
133 #define CPX_ALG_NONE 0
134 #define CPX_ALG_PRIMAL 1
135 #define CPX_ALG_DUAL 2
136 #define CPX_ALG_BARRIER 4
139 #define CPX_NO_SOLN 0
140 #define CPX_BASIC_SOLN 1
141 #define CPX_NONBASIC_SOLN 2
142 #define CPX_PRIMAL_SOLN 3
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[],
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[],
154 int CPXbaropt(CPXENV *env, CPXLP *lp);
156 int CPXbinvrow(CPXENV *env, CPXLP *lp, int i, double y[]);
158 int CPXchgbds(CPXENV *env, CPXLP *lp, int cnt, const int indices[],
159 const char lu[], const double bd[]);
161 int CPXchgcoeflist(CPXENV *env, CPXLP *lp, int numcoefs,
162 const int rowlist[], const int collist[], const double vallist[]);
164 void CPXchgobjsen(CPXENV *env, CPXLP *lp, int maxormin);
166 int CPXchgsense(CPXENV *env, CPXLP *lp, int cnt, const int indices[],
169 int CPXcloseCPLEX(CPXENV **env);
171 int CPXcopybase(CPXENV *env, CPXLP *lp, const int cstat[],
174 int CPXcopybasednorms(CPXENV *env, CPXLP *lp, const int cstat[],
175 const int rstat[], const double dnorm[]);
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[]);
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[],
190 CPXLP *CPXcreateprob(CPXENV *env, int *status, const char *probname);
192 int CPXdelcols(CPXENV *env, CPXLP *lp, int begin, int end);
194 int CPXdelrows(CPXENV *env, CPXLP *lp, int begin, int end);
196 int CPXdelsetcols(CPXENV *env, CPXLP *lp, int delstat[]);
198 int CPXdelsetrows(CPXENV *env, CPXLP *lp, int delstat[]);
200 int CPXdualopt(CPXENV *env, CPXLP *lp);
202 int CPXfreeprob(CPXENV *env, CPXLP **lp);
204 int CPXgetbase(CPXENV *env, CPXLP *lp, int cstat[], int rstat[]);
206 int CPXgetbasednorms(CPXENV *env, CPXLP *lp, int cstat[], int rstat[],
209 int CPXgetbhead(CPXENV *env, CPXLP *lp, int head[], double x[]);
211 int CPXgetdblparam(CPXENV *env, int whichparam, double *value);
213 int CPXgetdj(CPXENV *env, CPXLP *lp, double dj[], int begin, int end);
215 char *CPXgeterrorstring(CPXENV *env, int errcode, char *buffer);
217 int CPXgetijdiv(CPXENV *env, CPXLP *lp, int *idiv, int *jdiv);
219 int CPXgetintparam(CPXENV *env, int whichparam, int *value);
221 int CPXgetlb(CPXENV *env, CPXLP *lp, double lb[], int begin, int end);
223 int CPXgetmethod(CPXENV *env, CPXLP *lp);
225 int CPXgetnumcols(CPXENV *env, CPXLP *lp);
227 int CPXgetnumnz(CPXENV *env, CPXLP *lp);
229 int CPXgetnumrows(CPXENV *env, CPXLP *lp);
231 int CPXgetobjval(CPXENV *env, CPXLP *lp, double *objval);
233 int CPXgetpi(CPXENV *env, CPXLP *lp, double pi[], int begin, int end);
235 int CPXgetsense(CPXENV *env, CPXLP *lp, char sense[], int begin,
238 int CPXgetslack(CPXENV *env, CPXLP *lp, double slack[], int begin,
241 int CPXgetstat(CPXENV *env, CPXLP *lp);
243 int CPXgetub(CPXENV *env, CPXLP *lp, double ub[], int begin, int end);
245 int CPXgetweight(CPXENV *env, CPXLP *lp, int rcnt, const int rmatbeg[],
246 const int rmatind[], const double rmatval[], double weight[],
249 int CPXgetx(CPXENV *env, CPXLP *lp, double x[], int begin, int end);
251 int CPXinfodblparam(CPXENV *env, int whichparam, double *defvalue,
252 double *minvalue, double *maxvalue);
254 int CPXinfointparam(CPXENV *env, int whichparam, int *defvalue,
255 int *minvalue, int *maxvalue);
257 int CPXlpopt(CPXENV *env, CPXLP *lp);
259 int CPXmdleave(const CPXENV *env, CPXLP *lp, const int goodlist[],
260 int goodlen, double downratio[], double upratio[]);
262 int CPXnewcols(CPXENV *env, CPXLP *lp, int ccnt, const double obj[],
263 const double lb[], const double ub[], const char ctype[],
266 int CPXnewrows(CPXENV *env, CPXLP *lp, int rcnt, const double rhs[],
267 const char sense[], const double rngval[], char *rowname[]);
269 CPXENV *CPXopenCPLEX(int *status);
271 int CPXpivotin(CPXENV *env, CPXLP *lp, const int rlist[], int rlen);
273 int CPXpivotout(CPXENV *env, CPXLP *lp, const int clist[], int clen);
275 int CPXprimopt(CPXENV *env, CPXLP *lp);
277 int CPXsavwrite(CPXENV *env, CPXLP *lp, const char *filename);
279 int CPXsetdblparam(CPXENV *env, int whichparam, double newvalue);
281 int CPXsetintparam(CPXENV *env, int whichparam, int newvalue);
283 int CPXsolninfo(CPXENV *env, CPXLP *lp, int *solnmethod, int *solntype,
284 int *pfeasind, int *dfeasind);
286 int CPXsolution(CPXENV *env, CPXLP *lp, int *lpstat, double *objval,
287 double x[], double pi[], double slack[], double dj[]);
289 int CPXstrongbranch(CPXENV *env, CPXLP *lp, const int goodlist[],
290 int goodlen, double downpen[], double uppen[], int itlim);
292 int CPXwriteprob(CPXENV *env, CPXLP *lp, const char *filename,
293 const char *filetype);