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