You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

301 lines
10 KiB

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