glpk.h 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. /* glpk.h */
  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 Andrew Makhorin, Department for Applied Informatics,
  7. * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
  8. * 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 GLPK_H
  24. #define GLPK_H
  25. #include <stdarg.h>
  26. #include <stddef.h>
  27. #if defined (__MINGW32__) && ! defined (DBL_EPSILON)
  28. #define DBL_EPSILON 2.2204460492503131e-16 // ppgb 20110903
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* library version numbers: */
  34. #define GLP_MAJOR_VERSION 4
  35. #define GLP_MINOR_VERSION 44
  36. #ifndef GLP_PROB_DEFINED
  37. #define GLP_PROB_DEFINED
  38. typedef struct { double _opaque_prob[100]; } glp_prob;
  39. /* LP/MIP problem object */
  40. #endif
  41. /* optimization direction flag: */
  42. #define GLP_MIN 1 /* minimization */
  43. #define GLP_MAX 2 /* maximization */
  44. /* kind of structural variable: */
  45. #define GLP_CV 1 /* continuous variable */
  46. #define GLP_IV 2 /* integer variable */
  47. #define GLP_BV 3 /* binary variable */
  48. /* type of auxiliary/structural variable: */
  49. #define GLP_FR 1 /* free variable */
  50. #define GLP_LO 2 /* variable with lower bound */
  51. #define GLP_UP 3 /* variable with upper bound */
  52. #define GLP_DB 4 /* double-bounded variable */
  53. #define GLP_FX 5 /* fixed variable */
  54. /* status of auxiliary/structural variable: */
  55. #define GLP_BS 1 /* basic variable */
  56. #define GLP_NL 2 /* non-basic variable on lower bound */
  57. #define GLP_NU 3 /* non-basic variable on upper bound */
  58. #define GLP_NF 4 /* non-basic free variable */
  59. #define GLP_NS 5 /* non-basic fixed variable */
  60. /* scaling options: */
  61. #define GLP_SF_GM 0x01 /* perform geometric mean scaling */
  62. #define GLP_SF_EQ 0x10 /* perform equilibration scaling */
  63. #define GLP_SF_2N 0x20 /* round scale factors to power of two */
  64. #define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */
  65. #define GLP_SF_AUTO 0x80 /* choose scaling options automatically */
  66. /* solution indicator: */
  67. #define GLP_SOL 1 /* basic solution */
  68. #define GLP_IPT 2 /* interior-point solution */
  69. #define GLP_MIP 3 /* mixed integer solution */
  70. /* solution status: */
  71. #define GLP_UNDEF 1 /* solution is undefined */
  72. #define GLP_FEAS 2 /* solution is feasible */
  73. #define GLP_INFEAS 3 /* solution is infeasible */
  74. #define GLP_NOFEAS 4 /* no feasible solution exists */
  75. #define GLP_OPT 5 /* solution is optimal */
  76. #define GLP_UNBND 6 /* solution is unbounded */
  77. typedef struct
  78. { /* basis factorization control parameters */
  79. int msg_lev; /* (reserved) */
  80. int type; /* factorization type: */
  81. #define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */
  82. #define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */
  83. #define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */
  84. int lu_size; /* luf.sv_size */
  85. double piv_tol; /* luf.piv_tol */
  86. int piv_lim; /* luf.piv_lim */
  87. int suhl; /* luf.suhl */
  88. double eps_tol; /* luf.eps_tol */
  89. double max_gro; /* luf.max_gro */
  90. int nfs_max; /* fhv.hh_max */
  91. double upd_tol; /* fhv.upd_tol */
  92. int nrs_max; /* lpf.n_max */
  93. int rs_size; /* lpf.v_size */
  94. double foo_bar[38]; /* (reserved) */
  95. } glp_bfcp;
  96. typedef struct
  97. { /* simplex method control parameters */
  98. int msg_lev; /* message level: */
  99. #define GLP_MSG_OFF 0 /* no output */
  100. #define GLP_MSG_ERR 1 /* warning and error messages only */
  101. #define GLP_MSG_ON 2 /* normal output */
  102. #define GLP_MSG_ALL 3 /* full output */
  103. #define GLP_MSG_DBG 4 /* debug output */
  104. int meth; /* simplex method option: */
  105. #define GLP_PRIMAL 1 /* use primal simplex */
  106. #define GLP_DUALP 2 /* use dual; if it fails, use primal */
  107. #define GLP_DUAL 3 /* use dual simplex */
  108. int pricing; /* pricing technique: */
  109. #define GLP_PT_STD 0x11 /* standard (Dantzig rule) */
  110. #define GLP_PT_PSE 0x22 /* projected steepest edge */
  111. int r_test; /* ratio test technique: */
  112. #define GLP_RT_STD 0x11 /* standard (textbook) */
  113. #define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */
  114. double tol_bnd; /* spx.tol_bnd */
  115. double tol_dj; /* spx.tol_dj */
  116. double tol_piv; /* spx.tol_piv */
  117. double obj_ll; /* spx.obj_ll */
  118. double obj_ul; /* spx.obj_ul */
  119. int it_lim; /* spx.it_lim */
  120. int tm_lim; /* spx.tm_lim (milliseconds) */
  121. int out_frq; /* spx.out_frq */
  122. int out_dly; /* spx.out_dly (milliseconds) */
  123. int presolve; /* enable/disable using LP presolver */
  124. double foo_bar[36]; /* (reserved) */
  125. } glp_smcp;
  126. typedef struct
  127. { /* interior-point solver control parameters */
  128. int msg_lev; /* message level (see glp_smcp) */
  129. int ord_alg; /* ordering algorithm: */
  130. #define GLP_ORD_NONE 0 /* natural (original) ordering */
  131. #define GLP_ORD_QMD 1 /* quotient minimum degree (QMD) */
  132. #define GLP_ORD_AMD 2 /* approx. minimum degree (AMD) */
  133. #define GLP_ORD_SYMAMD 3 /* approx. minimum degree (SYMAMD) */
  134. double foo_bar[48]; /* (reserved) */
  135. } glp_iptcp;
  136. #ifndef GLP_TREE_DEFINED
  137. #define GLP_TREE_DEFINED
  138. typedef struct { double _opaque_tree[100]; } glp_tree;
  139. /* branch-and-bound tree */
  140. #endif
  141. typedef struct
  142. { /* integer optimizer control parameters */
  143. int msg_lev; /* message level (see glp_smcp) */
  144. int br_tech; /* branching technique: */
  145. #define GLP_BR_FFV 1 /* first fractional variable */
  146. #define GLP_BR_LFV 2 /* last fractional variable */
  147. #define GLP_BR_MFV 3 /* most fractional variable */
  148. #define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */
  149. #define GLP_BR_PCH 5 /* hybrid pseudocost heuristic */
  150. int bt_tech; /* backtracking technique: */
  151. #define GLP_BT_DFS 1 /* depth first search */
  152. #define GLP_BT_BFS 2 /* breadth first search */
  153. #define GLP_BT_BLB 3 /* best local bound */
  154. #define GLP_BT_BPH 4 /* best projection heuristic */
  155. double tol_int; /* mip.tol_int */
  156. double tol_obj; /* mip.tol_obj */
  157. int tm_lim; /* mip.tm_lim (milliseconds) */
  158. int out_frq; /* mip.out_frq (milliseconds) */
  159. int out_dly; /* mip.out_dly (milliseconds) */
  160. void (*cb_func)(glp_tree *T, void *info);
  161. /* mip.cb_func */
  162. void *cb_info; /* mip.cb_info */
  163. int cb_size; /* mip.cb_size */
  164. int pp_tech; /* preprocessing technique: */
  165. #define GLP_PP_NONE 0 /* disable preprocessing */
  166. #define GLP_PP_ROOT 1 /* preprocessing only on root level */
  167. #define GLP_PP_ALL 2 /* preprocessing on all levels */
  168. double mip_gap; /* relative MIP gap tolerance */
  169. int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */
  170. int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */
  171. int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */
  172. int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */
  173. int presolve; /* enable/disable using MIP presolver */
  174. int binarize; /* try to binarize integer variables */
  175. int fp_heur; /* feasibility pump heuristic */
  176. #if 1 /* 28/V-2010 */
  177. int alien; /* use alien solver */
  178. #endif
  179. double foo_bar[29]; /* (reserved) */
  180. } glp_iocp;
  181. typedef struct
  182. { /* additional row attributes */
  183. int level;
  184. /* subproblem level at which the row was added */
  185. int origin;
  186. /* row origin flag: */
  187. #define GLP_RF_REG 0 /* regular constraint */
  188. #define GLP_RF_LAZY 1 /* "lazy" constraint */
  189. #define GLP_RF_CUT 2 /* cutting plane constraint */
  190. int klass;
  191. /* row class descriptor: */
  192. #define GLP_RF_GMI 1 /* Gomory's mixed integer cut */
  193. #define GLP_RF_MIR 2 /* mixed integer rounding cut */
  194. #define GLP_RF_COV 3 /* mixed cover cut */
  195. #define GLP_RF_CLQ 4 /* clique cut */
  196. double foo_bar[7];
  197. /* (reserved) */
  198. } glp_attr;
  199. /* enable/disable flag: */
  200. #define GLP_ON 1 /* enable something */
  201. #define GLP_OFF 0 /* disable something */
  202. /* reason codes: */
  203. #define GLP_IROWGEN 0x01 /* request for row generation */
  204. #define GLP_IBINGO 0x02 /* better integer solution found */
  205. #define GLP_IHEUR 0x03 /* request for heuristic solution */
  206. #define GLP_ICUTGEN 0x04 /* request for cut generation */
  207. #define GLP_IBRANCH 0x05 /* request for branching */
  208. #define GLP_ISELECT 0x06 /* request for subproblem selection */
  209. #define GLP_IPREPRO 0x07 /* request for preprocessing */
  210. /* branch selection indicator: */
  211. #define GLP_NO_BRNCH 0 /* select no branch */
  212. #define GLP_DN_BRNCH 1 /* select down-branch */
  213. #define GLP_UP_BRNCH 2 /* select up-branch */
  214. /* return codes: */
  215. #define GLP_EBADB 0x01 /* invalid basis */
  216. #define GLP_ESING 0x02 /* singular matrix */
  217. #define GLP_ECOND 0x03 /* ill-conditioned matrix */
  218. #define GLP_EBOUND 0x04 /* invalid bounds */
  219. #define GLP_EFAIL 0x05 /* solver failed */
  220. #define GLP_EOBJLL 0x06 /* objective lower limit reached */
  221. #define GLP_EOBJUL 0x07 /* objective upper limit reached */
  222. #define GLP_EITLIM 0x08 /* iteration limit exceeded */
  223. #define GLP_ETMLIM 0x09 /* time limit exceeded */
  224. #define GLP_ENOPFS 0x0A /* no primal feasible solution */
  225. #define GLP_ENODFS 0x0B /* no dual feasible solution */
  226. #define GLP_EROOT 0x0C /* root LP optimum not provided */
  227. #define GLP_ESTOP 0x0D /* search terminated by application */
  228. #define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */
  229. #define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */
  230. #define GLP_ENOCVG 0x10 /* no convergence */
  231. #define GLP_EINSTAB 0x11 /* numerical instability */
  232. #define GLP_EDATA 0x12 /* invalid data */
  233. #define GLP_ERANGE 0x13 /* result out of range */
  234. /* condition indicator: */
  235. #define GLP_KKT_PE 1 /* primal equalities */
  236. #define GLP_KKT_PB 2 /* primal bounds */
  237. #define GLP_KKT_DE 3 /* dual equalities */
  238. #define GLP_KKT_DB 4 /* dual bounds */
  239. #define GLP_KKT_CS 5 /* complementary slackness */
  240. /* MPS file format: */
  241. #define GLP_MPS_DECK 1 /* fixed (ancient) */
  242. #define GLP_MPS_FILE 2 /* free (modern) */
  243. typedef struct
  244. { /* MPS format control parameters */
  245. int blank;
  246. /* character code to replace blanks in symbolic names */
  247. char *obj_name;
  248. /* objective row name */
  249. double tol_mps;
  250. /* zero tolerance for MPS data */
  251. double foo_bar[17];
  252. /* (reserved for use in the future) */
  253. } glp_mpscp;
  254. typedef struct
  255. { /* CPLEX LP format control parameters */
  256. double foo_bar[20];
  257. /* (reserved for use in the future) */
  258. } glp_cpxcp;
  259. #ifndef GLP_TRAN_DEFINED
  260. #define GLP_TRAN_DEFINED
  261. typedef struct { double _opaque_tran[100]; } glp_tran;
  262. /* MathProg translator workspace */
  263. #endif
  264. glp_prob *glp_create_prob(void);
  265. /* create problem object */
  266. void glp_set_prob_name(glp_prob *P, const char *name);
  267. /* assign (change) problem name */
  268. void glp_set_obj_name(glp_prob *P, const char *name);
  269. /* assign (change) objective function name */
  270. void glp_set_obj_dir(glp_prob *P, int dir);
  271. /* set (change) optimization direction flag */
  272. int glp_add_rows(glp_prob *P, int nrs);
  273. /* add new rows to problem object */
  274. int glp_add_cols(glp_prob *P, int ncs);
  275. /* add new columns to problem object */
  276. void glp_set_row_name(glp_prob *P, int i, const char *name);
  277. /* assign (change) row name */
  278. void glp_set_col_name(glp_prob *P, int j, const char *name);
  279. /* assign (change) column name */
  280. void glp_set_row_bnds(glp_prob *P, int i, int type, double lb,
  281. double ub);
  282. /* set (change) row bounds */
  283. void glp_set_col_bnds(glp_prob *P, int j, int type, double lb,
  284. double ub);
  285. /* set (change) column bounds */
  286. void glp_set_obj_coef(glp_prob *P, int j, double coef);
  287. /* set (change) obj. coefficient or constant term */
  288. void glp_set_mat_row(glp_prob *P, int i, int len, const int ind[],
  289. const double val[]);
  290. /* set (replace) row of the constraint matrix */
  291. void glp_set_mat_col(glp_prob *P, int j, int len, const int ind[],
  292. const double val[]);
  293. /* set (replace) column of the constraint matrix */
  294. void glp_load_matrix(glp_prob *P, int ne, const int ia[],
  295. const int ja[], const double ar[]);
  296. /* load (replace) the whole constraint matrix */
  297. int glp_check_dup(int m, int n, int ne, const int ia[], const int ja[]);
  298. /* check for duplicate elements in sparse matrix */
  299. void glp_sort_matrix(glp_prob *P);
  300. /* sort elements of the constraint matrix */
  301. void glp_del_rows(glp_prob *P, int nrs, const int num[]);
  302. /* delete specified rows from problem object */
  303. void glp_del_cols(glp_prob *P, int ncs, const int num[]);
  304. /* delete specified columns from problem object */
  305. void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names);
  306. /* copy problem object content */
  307. void glp_erase_prob(glp_prob *P);
  308. /* erase problem object content */
  309. void glp_delete_prob(glp_prob *P);
  310. /* delete problem object */
  311. const char *glp_get_prob_name(glp_prob *P);
  312. /* retrieve problem name */
  313. const char *glp_get_obj_name(glp_prob *P);
  314. /* retrieve objective function name */
  315. int glp_get_obj_dir(glp_prob *P);
  316. /* retrieve optimization direction flag */
  317. int glp_get_num_rows(glp_prob *P);
  318. /* retrieve number of rows */
  319. int glp_get_num_cols(glp_prob *P);
  320. /* retrieve number of columns */
  321. const char *glp_get_row_name(glp_prob *P, int i);
  322. /* retrieve row name */
  323. const char *glp_get_col_name(glp_prob *P, int j);
  324. /* retrieve column name */
  325. int glp_get_row_type(glp_prob *P, int i);
  326. /* retrieve row type */
  327. double glp_get_row_lb(glp_prob *P, int i);
  328. /* retrieve row lower bound */
  329. double glp_get_row_ub(glp_prob *P, int i);
  330. /* retrieve row upper bound */
  331. int glp_get_col_type(glp_prob *P, int j);
  332. /* retrieve column type */
  333. double glp_get_col_lb(glp_prob *P, int j);
  334. /* retrieve column lower bound */
  335. double glp_get_col_ub(glp_prob *P, int j);
  336. /* retrieve column upper bound */
  337. double glp_get_obj_coef(glp_prob *P, int j);
  338. /* retrieve obj. coefficient or constant term */
  339. int glp_get_num_nz(glp_prob *P);
  340. /* retrieve number of constraint coefficients */
  341. int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]);
  342. /* retrieve row of the constraint matrix */
  343. int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]);
  344. /* retrieve column of the constraint matrix */
  345. void glp_create_index(glp_prob *P);
  346. /* create the name index */
  347. int glp_find_row(glp_prob *P, const char *name);
  348. /* find row by its name */
  349. int glp_find_col(glp_prob *P, const char *name);
  350. /* find column by its name */
  351. void glp_delete_index(glp_prob *P);
  352. /* delete the name index */
  353. void glp_set_rii(glp_prob *P, int i, double rii);
  354. /* set (change) row scale factor */
  355. void glp_set_sjj(glp_prob *P, int j, double sjj);
  356. /* set (change) column scale factor */
  357. double glp_get_rii(glp_prob *P, int i);
  358. /* retrieve row scale factor */
  359. double glp_get_sjj(glp_prob *P, int j);
  360. /* retrieve column scale factor */
  361. void glp_scale_prob(glp_prob *P, int flags);
  362. /* scale problem data */
  363. void glp_unscale_prob(glp_prob *P);
  364. /* unscale problem data */
  365. void glp_set_row_stat(glp_prob *P, int i, int stat);
  366. /* set (change) row status */
  367. void glp_set_col_stat(glp_prob *P, int j, int stat);
  368. /* set (change) column status */
  369. void glp_std_basis(glp_prob *P);
  370. /* construct standard initial LP basis */
  371. void glp_adv_basis(glp_prob *P, int flags);
  372. /* construct advanced initial LP basis */
  373. void glp_cpx_basis(glp_prob *P);
  374. /* construct Bixby's initial LP basis */
  375. int glp_simplex(glp_prob *P, const glp_smcp *parm);
  376. /* solve LP problem with the simplex method */
  377. int glp_exact(glp_prob *P, const glp_smcp *parm);
  378. /* solve LP problem in exact arithmetic */
  379. void glp_init_smcp(glp_smcp *parm);
  380. /* initialize simplex method control parameters */
  381. int glp_get_status(glp_prob *P);
  382. /* retrieve generic status of basic solution */
  383. int glp_get_prim_stat(glp_prob *P);
  384. /* retrieve status of primal basic solution */
  385. int glp_get_dual_stat(glp_prob *P);
  386. /* retrieve status of dual basic solution */
  387. double glp_get_obj_val(glp_prob *P);
  388. /* retrieve objective value (basic solution) */
  389. int glp_get_row_stat(glp_prob *P, int i);
  390. /* retrieve row status */
  391. double glp_get_row_prim(glp_prob *P, int i);
  392. /* retrieve row primal value (basic solution) */
  393. double glp_get_row_dual(glp_prob *P, int i);
  394. /* retrieve row dual value (basic solution) */
  395. int glp_get_col_stat(glp_prob *P, int j);
  396. /* retrieve column status */
  397. double glp_get_col_prim(glp_prob *P, int j);
  398. /* retrieve column primal value (basic solution) */
  399. double glp_get_col_dual(glp_prob *P, int j);
  400. /* retrieve column dual value (basic solution) */
  401. int glp_get_unbnd_ray(glp_prob *P);
  402. /* determine variable causing unboundedness */
  403. int glp_interior(glp_prob *P, const glp_iptcp *parm);
  404. /* solve LP problem with the interior-point method */
  405. void glp_init_iptcp(glp_iptcp *parm);
  406. /* initialize interior-point solver control parameters */
  407. int glp_ipt_status(glp_prob *P);
  408. /* retrieve status of interior-point solution */
  409. double glp_ipt_obj_val(glp_prob *P);
  410. /* retrieve objective value (interior point) */
  411. double glp_ipt_row_prim(glp_prob *P, int i);
  412. /* retrieve row primal value (interior point) */
  413. double glp_ipt_row_dual(glp_prob *P, int i);
  414. /* retrieve row dual value (interior point) */
  415. double glp_ipt_col_prim(glp_prob *P, int j);
  416. /* retrieve column primal value (interior point) */
  417. double glp_ipt_col_dual(glp_prob *P, int j);
  418. /* retrieve column dual value (interior point) */
  419. void glp_set_col_kind(glp_prob *P, int j, int kind);
  420. /* set (change) column kind */
  421. int glp_get_col_kind(glp_prob *P, int j);
  422. /* retrieve column kind */
  423. int glp_get_num_int(glp_prob *P);
  424. /* retrieve number of integer columns */
  425. int glp_get_num_bin(glp_prob *P);
  426. /* retrieve number of binary columns */
  427. int glp_intopt(glp_prob *P, const glp_iocp *parm);
  428. /* solve MIP problem with the branch-and-bound method */
  429. void glp_init_iocp(glp_iocp *parm);
  430. /* initialize integer optimizer control parameters */
  431. int glp_mip_status(glp_prob *P);
  432. /* retrieve status of MIP solution */
  433. double glp_mip_obj_val(glp_prob *P);
  434. /* retrieve objective value (MIP solution) */
  435. double glp_mip_row_val(glp_prob *P, int i);
  436. /* retrieve row value (MIP solution) */
  437. double glp_mip_col_val(glp_prob *P, int j);
  438. /* retrieve column value (MIP solution) */
  439. int glp_print_sol(glp_prob *P, const char *fname);
  440. /* write basic solution in printable format */
  441. int glp_read_sol(glp_prob *P, const char *fname);
  442. /* read basic solution from text file */
  443. int glp_write_sol(glp_prob *P, const char *fname);
  444. /* write basic solution to text file */
  445. int glp_print_ranges(glp_prob *P, int len, const int list[],
  446. int flags, const char *fname);
  447. /* print sensitivity analysis report */
  448. int glp_print_ipt(glp_prob *P, const char *fname);
  449. /* write interior-point solution in printable format */
  450. int glp_read_ipt(glp_prob *P, const char *fname);
  451. /* read interior-point solution from text file */
  452. int glp_write_ipt(glp_prob *P, const char *fname);
  453. /* write interior-point solution to text file */
  454. int glp_print_mip(glp_prob *P, const char *fname);
  455. /* write MIP solution in printable format */
  456. int glp_read_mip(glp_prob *P, const char *fname);
  457. /* read MIP solution from text file */
  458. int glp_write_mip(glp_prob *P, const char *fname);
  459. /* write MIP solution to text file */
  460. int glp_bf_exists(glp_prob *P);
  461. /* check if the basis factorization exists */
  462. int glp_factorize(glp_prob *P);
  463. /* compute the basis factorization */
  464. int glp_bf_updated(glp_prob *P);
  465. /* check if the basis factorization has been updated */
  466. void glp_get_bfcp(glp_prob *P, glp_bfcp *parm);
  467. /* retrieve basis factorization control parameters */
  468. void glp_set_bfcp(glp_prob *P, const glp_bfcp *parm);
  469. /* change basis factorization control parameters */
  470. int glp_get_bhead(glp_prob *P, int k);
  471. /* retrieve the basis header information */
  472. int glp_get_row_bind(glp_prob *P, int i);
  473. /* retrieve row index in the basis header */
  474. int glp_get_col_bind(glp_prob *P, int j);
  475. /* retrieve column index in the basis header */
  476. void glp_ftran(glp_prob *P, double x[]);
  477. /* perform forward transformation (solve system B*x = b) */
  478. void glp_btran(glp_prob *P, double x[]);
  479. /* perform backward transformation (solve system B'*x = b) */
  480. int glp_warm_up(glp_prob *P);
  481. /* "warm up" LP basis */
  482. int glp_eval_tab_row(glp_prob *P, int k, int ind[], double val[]);
  483. /* compute row of the simplex tableau */
  484. int glp_eval_tab_col(glp_prob *P, int k, int ind[], double val[]);
  485. /* compute column of the simplex tableau */
  486. int glp_transform_row(glp_prob *P, int len, int ind[], double val[]);
  487. /* transform explicitly specified row */
  488. int glp_transform_col(glp_prob *P, int len, int ind[], double val[]);
  489. /* transform explicitly specified column */
  490. int glp_prim_rtest(glp_prob *P, int len, const int ind[],
  491. const double val[], int dir, double eps);
  492. /* perform primal ratio test */
  493. int glp_dual_rtest(glp_prob *P, int len, const int ind[],
  494. const double val[], int dir, double eps);
  495. /* perform dual ratio test */
  496. void glp_analyze_bound(glp_prob *P, int k, double *value1, int *var1,
  497. double *value2, int *var2);
  498. /* analyze active bound of non-basic variable */
  499. void glp_analyze_coef(glp_prob *P, int k, double *coef1, int *var1,
  500. double *value1, double *coef2, int *var2, double *value2);
  501. /* analyze objective coefficient at basic variable */
  502. int glp_ios_reason(glp_tree *T);
  503. /* determine reason for calling the callback routine */
  504. glp_prob *glp_ios_get_prob(glp_tree *T);
  505. /* access the problem object */
  506. void glp_ios_tree_size(glp_tree *T, int *a_cnt, int *n_cnt,
  507. int *t_cnt);
  508. /* determine size of the branch-and-bound tree */
  509. int glp_ios_curr_node(glp_tree *T);
  510. /* determine current active subproblem */
  511. int glp_ios_next_node(glp_tree *T, int p);
  512. /* determine next active subproblem */
  513. int glp_ios_prev_node(glp_tree *T, int p);
  514. /* determine previous active subproblem */
  515. int glp_ios_up_node(glp_tree *T, int p);
  516. /* determine parent subproblem */
  517. int glp_ios_node_level(glp_tree *T, int p);
  518. /* determine subproblem level */
  519. double glp_ios_node_bound(glp_tree *T, int p);
  520. /* determine subproblem local bound */
  521. int glp_ios_best_node(glp_tree *T);
  522. /* find active subproblem with best local bound */
  523. double glp_ios_mip_gap(glp_tree *T);
  524. /* compute relative MIP gap */
  525. void *glp_ios_node_data(glp_tree *T, int p);
  526. /* access subproblem application-specific data */
  527. void glp_ios_row_attr(glp_tree *T, int i, glp_attr *attr);
  528. /* retrieve additional row attributes */
  529. int glp_ios_pool_size(glp_tree *T);
  530. /* determine current size of the cut pool */
  531. int glp_ios_add_row(glp_tree *T,
  532. const char *name, int klass, int flags, int len, const int ind[],
  533. const double val[], int type, double rhs);
  534. /* add row (constraint) to the cut pool */
  535. void glp_ios_del_row(glp_tree *T, int i);
  536. /* remove row (constraint) from the cut pool */
  537. void glp_ios_clear_pool(glp_tree *T);
  538. /* remove all rows (constraints) from the cut pool */
  539. int glp_ios_can_branch(glp_tree *T, int j);
  540. /* check if can branch upon specified variable */
  541. void glp_ios_branch_upon(glp_tree *T, int j, int sel);
  542. /* choose variable to branch upon */
  543. void glp_ios_select_node(glp_tree *T, int p);
  544. /* select subproblem to continue the search */
  545. int glp_ios_heur_sol(glp_tree *T, const double x[]);
  546. /* provide solution found by heuristic */
  547. void glp_ios_terminate(glp_tree *T);
  548. /* terminate the solution process */
  549. void glp_init_mpscp(glp_mpscp *parm);
  550. /* initialize MPS format control parameters */
  551. int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm,
  552. const char *fname);
  553. /* read problem data in MPS format */
  554. int glp_write_mps(glp_prob *P, int fmt, const glp_mpscp *parm,
  555. const char *fname);
  556. /* write problem data in MPS format */
  557. void glp_init_cpxcp(glp_cpxcp *parm);
  558. /* initialize CPLEX LP format control parameters */
  559. int glp_read_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname);
  560. /* read problem data in CPLEX LP format */
  561. int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname);
  562. /* write problem data in CPLEX LP format */
  563. int glp_read_prob(glp_prob *P, int flags, const char *fname);
  564. /* read problem data in GLPK format */
  565. int glp_write_prob(glp_prob *P, int flags, const char *fname);
  566. /* write problem data in GLPK format */
  567. glp_tran *glp_mpl_alloc_wksp(void);
  568. /* allocate the MathProg translator workspace */
  569. int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip);
  570. /* read and translate model section */
  571. int glp_mpl_read_data(glp_tran *tran, const char *fname);
  572. /* read and translate data section */
  573. int glp_mpl_generate(glp_tran *tran, const char *fname);
  574. /* generate the model */
  575. void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob);
  576. /* build LP/MIP problem instance from the model */
  577. int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol);
  578. /* postsolve the model */
  579. void glp_mpl_free_wksp(glp_tran *tran);
  580. /* free the MathProg translator workspace */
  581. int glp_main(int argc, const char *argv[]);
  582. /* stand-alone LP/MIP solver */
  583. /**********************************************************************/
  584. #ifndef GLP_LONG_DEFINED
  585. #define GLP_LONG_DEFINED
  586. typedef struct { int lo, hi; } glp_long;
  587. /* long integer data type */
  588. #endif
  589. int glp_init_env(void);
  590. /* initialize GLPK environment */
  591. const char *glp_version(void);
  592. /* determine library version */
  593. int glp_free_env(void);
  594. /* free GLPK environment */
  595. void glp_printf(const char *fmt, ...);
  596. /* write formatted output to terminal */
  597. void glp_vprintf(const char *fmt, va_list arg);
  598. /* write formatted output to terminal */
  599. int glp_term_out(int flag);
  600. /* enable/disable terminal output */
  601. void glp_term_hook(int (*func)(void *info, const char *s), void *info);
  602. /* install hook to intercept terminal output */
  603. int glp_open_tee(const char *fname);
  604. /* start copying terminal output to text file */
  605. int glp_close_tee(void);
  606. /* stop copying terminal output to text file */
  607. #ifndef GLP_ERROR_DEFINED
  608. #define GLP_ERROR_DEFINED
  609. typedef void (*_glp_error)(const char *fmt, ...);
  610. #endif
  611. #define glp_error glp_error_(__FILE__, __LINE__)
  612. _glp_error glp_error_(const char *file, int line);
  613. /* display error message and terminate execution */
  614. #define glp_assert(expr) \
  615. ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1)))
  616. void glp_assert_(const char *expr, const char *file, int line);
  617. /* check for logical condition */
  618. void glp_error_hook(void (*func)(void *info), void *info);
  619. /* install hook to intercept abnormal termination */
  620. void *glp_malloc(int size);
  621. /* allocate memory block */
  622. void *glp_calloc(int n, int size);
  623. /* allocate memory block */
  624. void glp_free(void *ptr);
  625. /* free memory block */
  626. void glp_mem_limit(int limit);
  627. /* set memory usage limit */
  628. void glp_mem_usage(int *count, int *cpeak, glp_long *total,
  629. glp_long *tpeak);
  630. /* get memory usage information */
  631. glp_long glp_time(void);
  632. /* determine current universal time */
  633. double glp_difftime(glp_long t1, glp_long t0);
  634. /* compute difference between two time values */
  635. /**********************************************************************/
  636. #ifndef GLP_DATA_DEFINED
  637. #define GLP_DATA_DEFINED
  638. typedef struct { double _opaque_data[100]; } glp_data;
  639. /* plain data file */
  640. #endif
  641. glp_data *glp_sdf_open_file(const char *fname);
  642. /* open plain data file */
  643. void glp_sdf_set_jump(glp_data *data, void *jump);
  644. /* set up error handling */
  645. void glp_sdf_error(glp_data *data, const char *fmt, ...);
  646. /* print error message */
  647. void glp_sdf_warning(glp_data *data, const char *fmt, ...);
  648. /* print warning message */
  649. int glp_sdf_read_int(glp_data *data);
  650. /* read integer number */
  651. double glp_sdf_read_num(glp_data *data);
  652. /* read floating-point number */
  653. const char *glp_sdf_read_item(glp_data *data);
  654. /* read data item */
  655. const char *glp_sdf_read_text(glp_data *data);
  656. /* read text until end of line */
  657. int glp_sdf_line(glp_data *data);
  658. /* determine current line number */
  659. void glp_sdf_close_file(glp_data *data);
  660. /* close plain data file */
  661. /**********************************************************************/
  662. typedef struct _glp_graph glp_graph;
  663. typedef struct _glp_vertex glp_vertex;
  664. typedef struct _glp_arc glp_arc;
  665. struct _glp_graph
  666. { /* graph descriptor */
  667. void *pool; /* DMP *pool; */
  668. /* memory pool to store graph components */
  669. char *name;
  670. /* graph name (1 to 255 chars); NULL means no name is assigned
  671. to the graph */
  672. int nv_max;
  673. /* length of the vertex list (enlarged automatically) */
  674. int nv;
  675. /* number of vertices in the graph, 0 <= nv <= nv_max */
  676. int na;
  677. /* number of arcs in the graph, na >= 0 */
  678. glp_vertex **v; /* glp_vertex *v[1+nv_max]; */
  679. /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */
  680. void *index; /* AVL *index; */
  681. /* vertex index to find vertices by their names; NULL means the
  682. index does not exist */
  683. int v_size;
  684. /* size of data associated with each vertex (0 to 256 bytes) */
  685. int a_size;
  686. /* size of data associated with each arc (0 to 256 bytes) */
  687. };
  688. struct _glp_vertex
  689. { /* vertex descriptor */
  690. int i;
  691. /* vertex ordinal number, 1 <= i <= nv */
  692. char *name;
  693. /* vertex name (1 to 255 chars); NULL means no name is assigned
  694. to the vertex */
  695. void *entry; /* AVLNODE *entry; */
  696. /* pointer to corresponding entry in the vertex index; NULL means
  697. that either the index does not exist or the vertex has no name
  698. assigned */
  699. void *data;
  700. /* pointer to data associated with the vertex */
  701. void *temp;
  702. /* working pointer */
  703. glp_arc *in;
  704. /* pointer to the (unordered) list of incoming arcs */
  705. glp_arc *out;
  706. /* pointer to the (unordered) list of outgoing arcs */
  707. };
  708. struct _glp_arc
  709. { /* arc descriptor */
  710. glp_vertex *tail;
  711. /* pointer to the tail endpoint */
  712. glp_vertex *head;
  713. /* pointer to the head endpoint */
  714. void *data;
  715. /* pointer to data associated with the arc */
  716. void *temp;
  717. /* working pointer */
  718. glp_arc *t_prev;
  719. /* pointer to previous arc having the same tail endpoint */
  720. glp_arc *t_next;
  721. /* pointer to next arc having the same tail endpoint */
  722. glp_arc *h_prev;
  723. /* pointer to previous arc having the same head endpoint */
  724. glp_arc *h_next;
  725. /* pointer to next arc having the same head endpoint */
  726. };
  727. glp_graph *glp_create_graph(int v_size, int a_size);
  728. /* create graph */
  729. void glp_set_graph_name(glp_graph *G, const char *name);
  730. /* assign (change) graph name */
  731. int glp_add_vertices(glp_graph *G, int nadd);
  732. /* add new vertices to graph */
  733. void glp_set_vertex_name(glp_graph *G, int i, const char *name);
  734. /* assign (change) vertex name */
  735. glp_arc *glp_add_arc(glp_graph *G, int i, int j);
  736. /* add new arc to graph */
  737. void glp_del_vertices(glp_graph *G, int ndel, const int num[]);
  738. /* delete vertices from graph */
  739. void glp_del_arc(glp_graph *G, glp_arc *a);
  740. /* delete arc from graph */
  741. void glp_erase_graph(glp_graph *G, int v_size, int a_size);
  742. /* erase graph content */
  743. void glp_delete_graph(glp_graph *G);
  744. /* delete graph */
  745. void glp_create_v_index(glp_graph *G);
  746. /* create vertex name index */
  747. int glp_find_vertex(glp_graph *G, const char *name);
  748. /* find vertex by its name */
  749. void glp_delete_v_index(glp_graph *G);
  750. /* delete vertex name index */
  751. int glp_read_graph(glp_graph *G, const char *fname);
  752. /* read graph from plain text file */
  753. int glp_write_graph(glp_graph *G, const char *fname);
  754. /* write graph to plain text file */
  755. void glp_mincost_lp(glp_prob *P, glp_graph *G, int names, int v_rhs,
  756. int a_low, int a_cap, int a_cost);
  757. /* convert minimum cost flow problem to LP */
  758. int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap,
  759. int a_cost, double *sol, int a_x, int v_pi);
  760. /* find minimum-cost flow with out-of-kilter algorithm */
  761. void glp_maxflow_lp(glp_prob *P, glp_graph *G, int names, int s,
  762. int t, int a_cap);
  763. /* convert maximum flow problem to LP */
  764. int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap,
  765. double *sol, int a_x, int v_cut);
  766. /* find maximal flow with Ford-Fulkerson algorithm */
  767. int glp_check_asnprob(glp_graph *G, int v_set);
  768. /* check correctness of assignment problem data */
  769. /* assignment problem formulation: */
  770. #define GLP_ASN_MIN 1 /* perfect matching (minimization) */
  771. #define GLP_ASN_MAX 2 /* perfect matching (maximization) */
  772. #define GLP_ASN_MMP 3 /* maximum matching */
  773. int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names,
  774. int v_set, int a_cost);
  775. /* convert assignment problem to LP */
  776. int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost,
  777. double *sol, int a_x);
  778. /* solve assignment problem with out-of-kilter algorithm */
  779. int glp_asnprob_hall(glp_graph *G, int v_set, int a_x);
  780. /* find bipartite matching of maximum cardinality */
  781. double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls);
  782. /* solve critical path problem */
  783. int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap,
  784. int a_cost, const char *fname);
  785. /* read min-cost flow problem data in DIMACS format */
  786. int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap,
  787. int a_cost, const char *fname);
  788. /* write min-cost flow problem data in DIMACS format */
  789. int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap,
  790. const char *fname);
  791. /* read maximum flow problem data in DIMACS format */
  792. int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap,
  793. const char *fname);
  794. /* write maximum flow problem data in DIMACS format */
  795. int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char
  796. *fname);
  797. /* read assignment problem data in DIMACS format */
  798. int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char
  799. *fname);
  800. /* write assignment problem data in DIMACS format */
  801. int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname);
  802. /* read graph in DIMACS clique/coloring format */
  803. int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname);
  804. /* write graph in DIMACS clique/coloring format */
  805. int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost,
  806. const int parm[1+15]);
  807. /* Klingman's network problem generator */
  808. int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost,
  809. const int parm[1+14]);
  810. /* grid-like network problem generator */
  811. int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap,
  812. const int parm[1+5]);
  813. /* Goldfarb's maximum flow problem generator */
  814. int glp_weak_comp(glp_graph *G, int v_num);
  815. /* find all weakly connected components of graph */
  816. int glp_strong_comp(glp_graph *G, int v_num);
  817. /* find all strongly connected components of graph */
  818. int glp_top_sort(glp_graph *G, int v_num);
  819. /* topological sorting of acyclic digraph */
  820. int glp_wclique_exact(glp_graph *G, int v_wgt, double *sol, int v_set);
  821. /* find maximum weight clique with exact algorithm */
  822. /***********************************************************************
  823. * NOTE: All symbols defined below are obsolete and kept here only for
  824. * backward compatibility.
  825. ***********************************************************************/
  826. #define LPX glp_prob
  827. /* problem class: */
  828. #define LPX_LP 100 /* linear programming (LP) */
  829. #define LPX_MIP 101 /* mixed integer programming (MIP) */
  830. /* type of auxiliary/structural variable: */
  831. #define LPX_FR 110 /* free variable */
  832. #define LPX_LO 111 /* variable with lower bound */
  833. #define LPX_UP 112 /* variable with upper bound */
  834. #define LPX_DB 113 /* double-bounded variable */
  835. #define LPX_FX 114 /* fixed variable */
  836. /* optimization direction flag: */
  837. #define LPX_MIN 120 /* minimization */
  838. #define LPX_MAX 121 /* maximization */
  839. /* status of primal basic solution: */
  840. #define LPX_P_UNDEF 132 /* primal solution is undefined */
  841. #define LPX_P_FEAS 133 /* solution is primal feasible */
  842. #define LPX_P_INFEAS 134 /* solution is primal infeasible */
  843. #define LPX_P_NOFEAS 135 /* no primal feasible solution exists */
  844. /* status of dual basic solution: */
  845. #define LPX_D_UNDEF 136 /* dual solution is undefined */
  846. #define LPX_D_FEAS 137 /* solution is dual feasible */
  847. #define LPX_D_INFEAS 138 /* solution is dual infeasible */
  848. #define LPX_D_NOFEAS 139 /* no dual feasible solution exists */
  849. /* status of auxiliary/structural variable: */
  850. #define LPX_BS 140 /* basic variable */
  851. #define LPX_NL 141 /* non-basic variable on lower bound */
  852. #define LPX_NU 142 /* non-basic variable on upper bound */
  853. #define LPX_NF 143 /* non-basic free variable */
  854. #define LPX_NS 144 /* non-basic fixed variable */
  855. /* status of interior-point solution: */
  856. #define LPX_T_UNDEF 150 /* interior solution is undefined */
  857. #define LPX_T_OPT 151 /* interior solution is optimal */
  858. /* kind of structural variable: */
  859. #define LPX_CV 160 /* continuous variable */
  860. #define LPX_IV 161 /* integer variable */
  861. /* status of integer solution: */
  862. #define LPX_I_UNDEF 170 /* integer solution is undefined */
  863. #define LPX_I_OPT 171 /* integer solution is optimal */
  864. #define LPX_I_FEAS 172 /* integer solution is feasible */
  865. #define LPX_I_NOFEAS 173 /* no integer solution exists */
  866. /* status codes reported by the routine lpx_get_status: */
  867. #define LPX_OPT 180 /* optimal */
  868. #define LPX_FEAS 181 /* feasible */
  869. #define LPX_INFEAS 182 /* infeasible */
  870. #define LPX_NOFEAS 183 /* no feasible */
  871. #define LPX_UNBND 184 /* unbounded */
  872. #define LPX_UNDEF 185 /* undefined */
  873. /* exit codes returned by solver routines: */
  874. #define LPX_E_OK 200 /* success */
  875. #define LPX_E_EMPTY 201 /* empty problem */
  876. #define LPX_E_BADB 202 /* invalid initial basis */
  877. #define LPX_E_INFEAS 203 /* infeasible initial solution */
  878. #define LPX_E_FAULT 204 /* unable to start the search */
  879. #define LPX_E_OBJLL 205 /* objective lower limit reached */
  880. #define LPX_E_OBJUL 206 /* objective upper limit reached */
  881. #define LPX_E_ITLIM 207 /* iterations limit exhausted */
  882. #define LPX_E_TMLIM 208 /* time limit exhausted */
  883. #define LPX_E_NOFEAS 209 /* no feasible solution */
  884. #define LPX_E_INSTAB 210 /* numerical instability */
  885. #define LPX_E_SING 211 /* problems with basis matrix */
  886. #define LPX_E_NOCONV 212 /* no convergence (interior) */
  887. #define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */
  888. #define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */
  889. #define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached */
  890. /* control parameter identifiers: */
  891. #define LPX_K_MSGLEV 300 /* lp->msg_lev */
  892. #define LPX_K_SCALE 301 /* lp->scale */
  893. #define LPX_K_DUAL 302 /* lp->dual */
  894. #define LPX_K_PRICE 303 /* lp->price */
  895. #define LPX_K_RELAX 304 /* lp->relax */
  896. #define LPX_K_TOLBND 305 /* lp->tol_bnd */
  897. #define LPX_K_TOLDJ 306 /* lp->tol_dj */
  898. #define LPX_K_TOLPIV 307 /* lp->tol_piv */
  899. #define LPX_K_ROUND 308 /* lp->round */
  900. #define LPX_K_OBJLL 309 /* lp->obj_ll */
  901. #define LPX_K_OBJUL 310 /* lp->obj_ul */
  902. #define LPX_K_ITLIM 311 /* lp->it_lim */
  903. #define LPX_K_ITCNT 312 /* lp->it_cnt */
  904. #define LPX_K_TMLIM 313 /* lp->tm_lim */
  905. #define LPX_K_OUTFRQ 314 /* lp->out_frq */
  906. #define LPX_K_OUTDLY 315 /* lp->out_dly */
  907. #define LPX_K_BRANCH 316 /* lp->branch */
  908. #define LPX_K_BTRACK 317 /* lp->btrack */
  909. #define LPX_K_TOLINT 318 /* lp->tol_int */
  910. #define LPX_K_TOLOBJ 319 /* lp->tol_obj */
  911. #define LPX_K_MPSINFO 320 /* lp->mps_info */
  912. #define LPX_K_MPSOBJ 321 /* lp->mps_obj */
  913. #define LPX_K_MPSORIG 322 /* lp->mps_orig */
  914. #define LPX_K_MPSWIDE 323 /* lp->mps_wide */
  915. #define LPX_K_MPSFREE 324 /* lp->mps_free */
  916. #define LPX_K_MPSSKIP 325 /* lp->mps_skip */
  917. #define LPX_K_LPTORIG 326 /* lp->lpt_orig */
  918. #define LPX_K_PRESOL 327 /* lp->presol */
  919. #define LPX_K_BINARIZE 328 /* lp->binarize */
  920. #define LPX_K_USECUTS 329 /* lp->use_cuts */
  921. #define LPX_K_BFTYPE 330 /* lp->bfcp->type */
  922. #define LPX_K_MIPGAP 331 /* lp->mip_gap */
  923. #define LPX_C_COVER 0x01 /* mixed cover cuts */
  924. #define LPX_C_CLIQUE 0x02 /* clique cuts */
  925. #define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */
  926. #define LPX_C_MIR 0x08 /* mixed integer rounding cuts */
  927. #define LPX_C_ALL 0xFF /* all cuts */
  928. typedef struct
  929. { /* this structure contains results reported by the routines which
  930. checks Karush-Kuhn-Tucker conditions (for details see comments
  931. to those routines) */
  932. /*--------------------------------------------------------------*/
  933. /* xR - A * xS = 0 (KKT.PE) */
  934. double pe_ae_max;
  935. /* largest absolute error */
  936. int pe_ae_row;
  937. /* number of row with largest absolute error */
  938. double pe_re_max;
  939. /* largest relative error */
  940. int pe_re_row;
  941. /* number of row with largest relative error */
  942. int pe_quality;
  943. /* quality of primal solution:
  944. 'H' - high
  945. 'M' - medium
  946. 'L' - low
  947. '?' - primal solution is wrong */
  948. /*--------------------------------------------------------------*/
  949. /* l[k] <= x[k] <= u[k] (KKT.PB) */
  950. double pb_ae_max;
  951. /* largest absolute error */
  952. int pb_ae_ind;
  953. /* number of variable with largest absolute error */
  954. double pb_re_max;
  955. /* largest relative error */
  956. int pb_re_ind;
  957. /* number of variable with largest relative error */
  958. int pb_quality;
  959. /* quality of primal feasibility:
  960. 'H' - high
  961. 'M' - medium
  962. 'L' - low
  963. '?' - primal solution is infeasible */
  964. /*--------------------------------------------------------------*/
  965. /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */
  966. double de_ae_max;
  967. /* largest absolute error */
  968. int de_ae_col;
  969. /* number of column with largest absolute error */
  970. double de_re_max;
  971. /* largest relative error */
  972. int de_re_col;
  973. /* number of column with largest relative error */
  974. int de_quality;
  975. /* quality of dual solution:
  976. 'H' - high
  977. 'M' - medium
  978. 'L' - low
  979. '?' - dual solution is wrong */
  980. /*--------------------------------------------------------------*/
  981. /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */
  982. double db_ae_max;
  983. /* largest absolute error */
  984. int db_ae_ind;
  985. /* number of variable with largest absolute error */
  986. double db_re_max;
  987. /* largest relative error */
  988. int db_re_ind;
  989. /* number of variable with largest relative error */
  990. int db_quality;
  991. /* quality of dual feasibility:
  992. 'H' - high
  993. 'M' - medium
  994. 'L' - low
  995. '?' - dual solution is infeasible */
  996. /*--------------------------------------------------------------*/
  997. /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */
  998. double cs_ae_max;
  999. /* largest absolute error */
  1000. int cs_ae_ind;
  1001. /* number of variable with largest absolute error */
  1002. double cs_re_max;
  1003. /* largest relative error */
  1004. int cs_re_ind;
  1005. /* number of variable with largest relative error */
  1006. int cs_quality;
  1007. /* quality of complementary slackness:
  1008. 'H' - high
  1009. 'M' - medium
  1010. 'L' - low
  1011. '?' - primal and dual solutions are not complementary */
  1012. } LPXKKT;
  1013. #define lpx_create_prob _glp_lpx_create_prob
  1014. LPX *lpx_create_prob(void);
  1015. /* create problem object */
  1016. #define lpx_set_prob_name _glp_lpx_set_prob_name
  1017. void lpx_set_prob_name(LPX *lp, const char *name);
  1018. /* assign (change) problem name */
  1019. #define lpx_set_obj_name _glp_lpx_set_obj_name
  1020. void lpx_set_obj_name(LPX *lp, const char *name);
  1021. /* assign (change) objective function name */
  1022. #define lpx_set_obj_dir _glp_lpx_set_obj_dir
  1023. void lpx_set_obj_dir(LPX *lp, int dir);
  1024. /* set (change) optimization direction flag */
  1025. #define lpx_add_rows _glp_lpx_add_rows
  1026. int lpx_add_rows(LPX *lp, int nrs);
  1027. /* add new rows to problem object */
  1028. #define lpx_add_cols _glp_lpx_add_cols
  1029. int lpx_add_cols(LPX *lp, int ncs);
  1030. /* add new columns to problem object */
  1031. #define lpx_set_row_name _glp_lpx_set_row_name
  1032. void lpx_set_row_name(LPX *lp, int i, const char *name);
  1033. /* assign (change) row name */
  1034. #define lpx_set_col_name _glp_lpx_set_col_name
  1035. void lpx_set_col_name(LPX *lp, int j, const char *name);
  1036. /* assign (change) column name */
  1037. #define lpx_set_row_bnds _glp_lpx_set_row_bnds
  1038. void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub);
  1039. /* set (change) row bounds */
  1040. #define lpx_set_col_bnds _glp_lpx_set_col_bnds
  1041. void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub);
  1042. /* set (change) column bounds */
  1043. #define lpx_set_obj_coef _glp_lpx_set_obj_coef
  1044. void lpx_set_obj_coef(glp_prob *lp, int j, double coef);
  1045. /* set (change) obj. coefficient or constant term */
  1046. #define lpx_set_mat_row _glp_lpx_set_mat_row
  1047. void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[],
  1048. const double val[]);
  1049. /* set (replace) row of the constraint matrix */
  1050. #define lpx_set_mat_col _glp_lpx_set_mat_col
  1051. void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[],
  1052. const double val[]);
  1053. /* set (replace) column of the constraint matrix */
  1054. #define lpx_load_matrix _glp_lpx_load_matrix
  1055. void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[],
  1056. const double ar[]);
  1057. /* load (replace) the whole constraint matrix */
  1058. #define lpx_del_rows _glp_lpx_del_rows
  1059. void lpx_del_rows(LPX *lp, int nrs, const int num[]);
  1060. /* delete specified rows from problem object */
  1061. #define lpx_del_cols _glp_lpx_del_cols
  1062. void lpx_del_cols(LPX *lp, int ncs, const int num[]);
  1063. /* delete specified columns from problem object */
  1064. #define lpx_delete_prob _glp_lpx_delete_prob
  1065. void lpx_delete_prob(LPX *lp);
  1066. /* delete problem object */
  1067. #define lpx_get_prob_name _glp_lpx_get_prob_name
  1068. const char *lpx_get_prob_name(LPX *lp);
  1069. /* retrieve problem name */
  1070. #define lpx_get_obj_name _glp_lpx_get_obj_name
  1071. const char *lpx_get_obj_name(LPX *lp);
  1072. /* retrieve objective function name */
  1073. #define lpx_get_obj_dir _glp_lpx_get_obj_dir
  1074. int lpx_get_obj_dir(LPX *lp);
  1075. /* retrieve optimization direction flag */
  1076. #define lpx_get_num_rows _glp_lpx_get_num_rows
  1077. int lpx_get_num_rows(LPX *lp);
  1078. /* retrieve number of rows */
  1079. #define lpx_get_num_cols _glp_lpx_get_num_cols
  1080. int lpx_get_num_cols(LPX *lp);
  1081. /* retrieve number of columns */
  1082. #define lpx_get_row_name _glp_lpx_get_row_name
  1083. const char *lpx_get_row_name(LPX *lp, int i);
  1084. /* retrieve row name */
  1085. #define lpx_get_col_name _glp_lpx_get_col_name
  1086. const char *lpx_get_col_name(LPX *lp, int j);
  1087. /* retrieve column name */
  1088. #define lpx_get_row_type _glp_lpx_get_row_type
  1089. int lpx_get_row_type(LPX *lp, int i);
  1090. /* retrieve row type */
  1091. #define lpx_get_row_lb _glp_lpx_get_row_lb
  1092. double lpx_get_row_lb(LPX *lp, int i);
  1093. /* retrieve row lower bound */
  1094. #define lpx_get_row_ub _glp_lpx_get_row_ub
  1095. double lpx_get_row_ub(LPX *lp, int i);
  1096. /* retrieve row upper bound */
  1097. #define lpx_get_row_bnds _glp_lpx_get_row_bnds
  1098. void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb,
  1099. double *ub);
  1100. /* retrieve row bounds */
  1101. #define lpx_get_col_type _glp_lpx_get_col_type
  1102. int lpx_get_col_type(LPX *lp, int j);
  1103. /* retrieve column type */
  1104. #define lpx_get_col_lb _glp_lpx_get_col_lb
  1105. double lpx_get_col_lb(LPX *lp, int j);
  1106. /* retrieve column lower bound */
  1107. #define lpx_get_col_ub _glp_lpx_get_col_ub
  1108. double lpx_get_col_ub(LPX *lp, int j);
  1109. /* retrieve column upper bound */
  1110. #define lpx_get_col_bnds _glp_lpx_get_col_bnds
  1111. void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb,
  1112. double *ub);
  1113. /* retrieve column bounds */
  1114. #define lpx_get_obj_coef _glp_lpx_get_obj_coef
  1115. double lpx_get_obj_coef(LPX *lp, int j);
  1116. /* retrieve obj. coefficient or constant term */
  1117. #define lpx_get_num_nz _glp_lpx_get_num_nz
  1118. int lpx_get_num_nz(LPX *lp);
  1119. /* retrieve number of constraint coefficients */
  1120. #define lpx_get_mat_row _glp_lpx_get_mat_row
  1121. int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]);
  1122. /* retrieve row of the constraint matrix */
  1123. #define lpx_get_mat_col _glp_lpx_get_mat_col
  1124. int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]);
  1125. /* retrieve column of the constraint matrix */
  1126. #define lpx_create_index _glp_lpx_create_index
  1127. void lpx_create_index(LPX *lp);
  1128. /* create the name index */
  1129. #define lpx_find_row _glp_lpx_find_row
  1130. int lpx_find_row(LPX *lp, const char *name);
  1131. /* find row by its name */
  1132. #define lpx_find_col _glp_lpx_find_col
  1133. int lpx_find_col(LPX *lp, const char *name);
  1134. /* find column by its name */
  1135. #define lpx_delete_index _glp_lpx_delete_index
  1136. void lpx_delete_index(LPX *lp);
  1137. /* delete the name index */
  1138. #define lpx_scale_prob _glp_lpx_scale_prob
  1139. void lpx_scale_prob(LPX *lp);
  1140. /* scale problem data */
  1141. #define lpx_unscale_prob _glp_lpx_unscale_prob
  1142. void lpx_unscale_prob(LPX *lp);
  1143. /* unscale problem data */
  1144. #define lpx_set_row_stat _glp_lpx_set_row_stat
  1145. void lpx_set_row_stat(LPX *lp, int i, int stat);
  1146. /* set (change) row status */
  1147. #define lpx_set_col_stat _glp_lpx_set_col_stat
  1148. void lpx_set_col_stat(LPX *lp, int j, int stat);
  1149. /* set (change) column status */
  1150. #define lpx_std_basis _glp_lpx_std_basis
  1151. void lpx_std_basis(LPX *lp);
  1152. /* construct standard initial LP basis */
  1153. #define lpx_adv_basis _glp_lpx_adv_basis
  1154. void lpx_adv_basis(LPX *lp);
  1155. /* construct advanced initial LP basis */
  1156. #define lpx_cpx_basis _glp_lpx_cpx_basis
  1157. void lpx_cpx_basis(LPX *lp);
  1158. /* construct Bixby's initial LP basis */
  1159. #define lpx_simplex _glp_lpx_simplex
  1160. int lpx_simplex(LPX *lp);
  1161. /* easy-to-use driver to the simplex method */
  1162. #define lpx_exact _glp_lpx_exact
  1163. int lpx_exact(LPX *lp);
  1164. /* easy-to-use driver to the exact simplex method */
  1165. #define lpx_get_status _glp_lpx_get_status
  1166. int lpx_get_status(LPX *lp);
  1167. /* retrieve generic status of basic solution */
  1168. #define lpx_get_prim_stat _glp_lpx_get_prim_stat
  1169. int lpx_get_prim_stat(LPX *lp);
  1170. /* retrieve primal status of basic solution */
  1171. #define lpx_get_dual_stat _glp_lpx_get_dual_stat
  1172. int lpx_get_dual_stat(LPX *lp);
  1173. /* retrieve dual status of basic solution */
  1174. #define lpx_get_obj_val _glp_lpx_get_obj_val
  1175. double lpx_get_obj_val(LPX *lp);
  1176. /* retrieve objective value (basic solution) */
  1177. #define lpx_get_row_stat _glp_lpx_get_row_stat
  1178. int lpx_get_row_stat(LPX *lp, int i);
  1179. /* retrieve row status (basic solution) */
  1180. #define lpx_get_row_prim _glp_lpx_get_row_prim
  1181. double lpx_get_row_prim(LPX *lp, int i);
  1182. /* retrieve row primal value (basic solution) */
  1183. #define lpx_get_row_dual _glp_lpx_get_row_dual
  1184. double lpx_get_row_dual(LPX *lp, int i);
  1185. /* retrieve row dual value (basic solution) */
  1186. #define lpx_get_row_info _glp_lpx_get_row_info
  1187. void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx,
  1188. double *dx);
  1189. /* obtain row solution information */
  1190. #define lpx_get_col_stat _glp_lpx_get_col_stat
  1191. int lpx_get_col_stat(LPX *lp, int j);
  1192. /* retrieve column status (basic solution) */
  1193. #define lpx_get_col_prim _glp_lpx_get_col_prim
  1194. double lpx_get_col_prim(LPX *lp, int j);
  1195. /* retrieve column primal value (basic solution) */
  1196. #define lpx_get_col_dual _glp_lpx_get_col_dual
  1197. double lpx_get_col_dual(glp_prob *lp, int j);
  1198. /* retrieve column dual value (basic solution) */
  1199. #define lpx_get_col_info _glp_lpx_get_col_info
  1200. void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx,
  1201. double *dx);
  1202. /* obtain column solution information (obsolete) */
  1203. #define lpx_get_ray_info _glp_lpx_get_ray_info
  1204. int lpx_get_ray_info(LPX *lp);
  1205. /* determine what causes primal unboundness */
  1206. #define lpx_check_kkt _glp_lpx_check_kkt
  1207. void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt);
  1208. /* check Karush-Kuhn-Tucker conditions */
  1209. #define lpx_warm_up _glp_lpx_warm_up
  1210. int lpx_warm_up(LPX *lp);
  1211. /* "warm up" LP basis */
  1212. #define lpx_eval_tab_row _glp_lpx_eval_tab_row
  1213. int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]);
  1214. /* compute row of the simplex table */
  1215. #define lpx_eval_tab_col _glp_lpx_eval_tab_col
  1216. int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]);
  1217. /* compute column of the simplex table */
  1218. #define lpx_transform_row _glp_lpx_transform_row
  1219. int lpx_transform_row(LPX *lp, int len, int ind[], double val[]);
  1220. /* transform explicitly specified row */
  1221. #define lpx_transform_col _glp_lpx_transform_col
  1222. int lpx_transform_col(LPX *lp, int len, int ind[], double val[]);
  1223. /* transform explicitly specified column */
  1224. #define lpx_prim_ratio_test _glp_lpx_prim_ratio_test
  1225. int lpx_prim_ratio_test(LPX *lp, int len, const int ind[],
  1226. const double val[], int how, double tol);
  1227. /* perform primal ratio test */
  1228. #define lpx_dual_ratio_test _glp_lpx_dual_ratio_test
  1229. int lpx_dual_ratio_test(LPX *lp, int len, const int ind[],
  1230. const double val[], int how, double tol);
  1231. /* perform dual ratio test */
  1232. #define lpx_interior _glp_lpx_interior
  1233. int lpx_interior(LPX *lp);
  1234. /* easy-to-use driver to the interior point method */
  1235. #define lpx_ipt_status _glp_lpx_ipt_status
  1236. int lpx_ipt_status(LPX *lp);
  1237. /* retrieve status of interior-point solution */
  1238. #define lpx_ipt_obj_val _glp_lpx_ipt_obj_val
  1239. double lpx_ipt_obj_val(LPX *lp);
  1240. /* retrieve objective value (interior point) */
  1241. #define lpx_ipt_row_prim _glp_lpx_ipt_row_prim
  1242. double lpx_ipt_row_prim(LPX *lp, int i);
  1243. /* retrieve row primal value (interior point) */
  1244. #define lpx_ipt_row_dual _glp_lpx_ipt_row_dual
  1245. double lpx_ipt_row_dual(LPX *lp, int i);
  1246. /* retrieve row dual value (interior point) */
  1247. #define lpx_ipt_col_prim _glp_lpx_ipt_col_prim
  1248. double lpx_ipt_col_prim(LPX *lp, int j);
  1249. /* retrieve column primal value (interior point) */
  1250. #define lpx_ipt_col_dual _glp_lpx_ipt_col_dual
  1251. double lpx_ipt_col_dual(LPX *lp, int j);
  1252. /* retrieve column dual value (interior point) */
  1253. #define lpx_set_class _glp_lpx_set_class
  1254. void lpx_set_class(LPX *lp, int klass);
  1255. /* set problem class */
  1256. #define lpx_get_class _glp_lpx_get_class
  1257. int lpx_get_class(LPX *lp);
  1258. /* determine problem klass */
  1259. #define lpx_set_col_kind _glp_lpx_set_col_kind
  1260. void lpx_set_col_kind(LPX *lp, int j, int kind);
  1261. /* set (change) column kind */
  1262. #define lpx_get_col_kind _glp_lpx_get_col_kind
  1263. int lpx_get_col_kind(LPX *lp, int j);
  1264. /* retrieve column kind */
  1265. #define lpx_get_num_int _glp_lpx_get_num_int
  1266. int lpx_get_num_int(LPX *lp);
  1267. /* retrieve number of integer columns */
  1268. #define lpx_get_num_bin _glp_lpx_get_num_bin
  1269. int lpx_get_num_bin(LPX *lp);
  1270. /* retrieve number of binary columns */
  1271. #define lpx_integer _glp_lpx_integer
  1272. int lpx_integer(LPX *lp);
  1273. /* easy-to-use driver to the branch-and-bound method */
  1274. #define lpx_intopt _glp_lpx_intopt
  1275. int lpx_intopt(LPX *lp);
  1276. /* easy-to-use driver to the branch-and-bound method */
  1277. #define lpx_mip_status _glp_lpx_mip_status
  1278. int lpx_mip_status(LPX *lp);
  1279. /* retrieve status of MIP solution */
  1280. #define lpx_mip_obj_val _glp_lpx_mip_obj_val
  1281. double lpx_mip_obj_val(LPX *lp);
  1282. /* retrieve objective value (MIP solution) */
  1283. #define lpx_mip_row_val _glp_lpx_mip_row_val
  1284. double lpx_mip_row_val(LPX *lp, int i);
  1285. /* retrieve row value (MIP solution) */
  1286. #define lpx_mip_col_val _glp_lpx_mip_col_val
  1287. double lpx_mip_col_val(LPX *lp, int j);
  1288. /* retrieve column value (MIP solution) */
  1289. #define lpx_check_int _glp_lpx_check_int
  1290. void lpx_check_int(LPX *lp, LPXKKT *kkt);
  1291. /* check integer feasibility conditions */
  1292. #define lpx_reset_parms _glp_lpx_reset_parms
  1293. void lpx_reset_parms(LPX *lp);
  1294. /* reset control parameters to default values */
  1295. #define lpx_set_int_parm _glp_lpx_set_int_parm
  1296. void lpx_set_int_parm(LPX *lp, int parm, int val);
  1297. /* set (change) integer control parameter */
  1298. #define lpx_get_int_parm _glp_lpx_get_int_parm
  1299. int lpx_get_int_parm(LPX *lp, int parm);
  1300. /* query integer control parameter */
  1301. #define lpx_set_real_parm _glp_lpx_set_real_parm
  1302. void lpx_set_real_parm(LPX *lp, int parm, double val);
  1303. /* set (change) real control parameter */
  1304. #define lpx_get_real_parm _glp_lpx_get_real_parm
  1305. double lpx_get_real_parm(LPX *lp, int parm);
  1306. /* query real control parameter */
  1307. #define lpx_read_mps _glp_lpx_read_mps
  1308. LPX *lpx_read_mps(const char *fname);
  1309. /* read problem data in fixed MPS format */
  1310. #define lpx_write_mps _glp_lpx_write_mps
  1311. int lpx_write_mps(LPX *lp, const char *fname);
  1312. /* write problem data in fixed MPS format */
  1313. #define lpx_read_bas _glp_lpx_read_bas
  1314. int lpx_read_bas(LPX *lp, const char *fname);
  1315. /* read LP basis in fixed MPS format */
  1316. #define lpx_write_bas _glp_lpx_write_bas
  1317. int lpx_write_bas(LPX *lp, const char *fname);
  1318. /* write LP basis in fixed MPS format */
  1319. #define lpx_read_freemps _glp_lpx_read_freemps
  1320. LPX *lpx_read_freemps(const char *fname);
  1321. /* read problem data in free MPS format */
  1322. #define lpx_write_freemps _glp_lpx_write_freemps
  1323. int lpx_write_freemps(LPX *lp, const char *fname);
  1324. /* write problem data in free MPS format */
  1325. #define lpx_read_cpxlp _glp_lpx_read_cpxlp
  1326. LPX *lpx_read_cpxlp(const char *fname);
  1327. /* read problem data in CPLEX LP format */
  1328. #define lpx_write_cpxlp _glp_lpx_write_cpxlp
  1329. int lpx_write_cpxlp(LPX *lp, const char *fname);
  1330. /* write problem data in CPLEX LP format */
  1331. #define lpx_read_model _glp_lpx_read_model
  1332. LPX *lpx_read_model(const char *model, const char *data,
  1333. const char *output);
  1334. /* read LP/MIP model written in GNU MathProg language */
  1335. #define lpx_print_prob _glp_lpx_print_prob
  1336. int lpx_print_prob(LPX *lp, const char *fname);
  1337. /* write problem data in plain text format */
  1338. #define lpx_print_sol _glp_lpx_print_sol
  1339. int lpx_print_sol(LPX *lp, const char *fname);
  1340. /* write LP problem solution in printable format */
  1341. #define lpx_print_sens_bnds _glp_lpx_print_sens_bnds
  1342. int lpx_print_sens_bnds(LPX *lp, const char *fname);
  1343. /* write bounds sensitivity information */
  1344. #define lpx_print_ips _glp_lpx_print_ips
  1345. int lpx_print_ips(LPX *lp, const char *fname);
  1346. /* write interior point solution in printable format */
  1347. #define lpx_print_mip _glp_lpx_print_mip
  1348. int lpx_print_mip(LPX *lp, const char *fname);
  1349. /* write MIP problem solution in printable format */
  1350. #define lpx_is_b_avail _glp_lpx_is_b_avail
  1351. int lpx_is_b_avail(LPX *lp);
  1352. /* check if LP basis is available */
  1353. #define lpx_write_pb _glp_lpx_write_pb
  1354. int lpx_write_pb(LPX *lp, const char *fname, int normalized,
  1355. int binarize);
  1356. /* write problem data in (normalized) OPB format */
  1357. #define lpx_main _glp_lpx_main
  1358. int lpx_main(int argc, const char *argv[]);
  1359. /* stand-alone LP/MIP solver */
  1360. #ifdef __cplusplus
  1361. }
  1362. #endif
  1363. #endif
  1364. /* eof */