1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/include/glpk.h Mon Dec 06 13:09:21 2010 +0100
1.3 @@ -0,0 +1,1750 @@
1.4 +/* glpk.h */
1.5 +
1.6 +/***********************************************************************
1.7 +* This code is part of GLPK (GNU Linear Programming Kit).
1.8 +*
1.9 +* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
1.10 +* 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
1.11 +* Moscow Aviation Institute, Moscow, Russia. All rights reserved.
1.12 +* E-mail: <mao@gnu.org>.
1.13 +*
1.14 +* GLPK is free software: you can redistribute it and/or modify it
1.15 +* under the terms of the GNU General Public License as published by
1.16 +* the Free Software Foundation, either version 3 of the License, or
1.17 +* (at your option) any later version.
1.18 +*
1.19 +* GLPK is distributed in the hope that it will be useful, but WITHOUT
1.20 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1.21 +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1.22 +* License for more details.
1.23 +*
1.24 +* You should have received a copy of the GNU General Public License
1.25 +* along with GLPK. If not, see <http://www.gnu.org/licenses/>.
1.26 +***********************************************************************/
1.27 +
1.28 +#ifndef GLPK_H
1.29 +#define GLPK_H
1.30 +
1.31 +#include <stdarg.h>
1.32 +#include <stddef.h>
1.33 +
1.34 +#ifdef __cplusplus
1.35 +extern "C" {
1.36 +#endif
1.37 +
1.38 +/* library version numbers: */
1.39 +#define GLP_MAJOR_VERSION 4
1.40 +#define GLP_MINOR_VERSION 45
1.41 +
1.42 +#ifndef GLP_PROB_DEFINED
1.43 +#define GLP_PROB_DEFINED
1.44 +typedef struct { double _opaque_prob[100]; } glp_prob;
1.45 +/* LP/MIP problem object */
1.46 +#endif
1.47 +
1.48 +/* optimization direction flag: */
1.49 +#define GLP_MIN 1 /* minimization */
1.50 +#define GLP_MAX 2 /* maximization */
1.51 +
1.52 +/* kind of structural variable: */
1.53 +#define GLP_CV 1 /* continuous variable */
1.54 +#define GLP_IV 2 /* integer variable */
1.55 +#define GLP_BV 3 /* binary variable */
1.56 +
1.57 +/* type of auxiliary/structural variable: */
1.58 +#define GLP_FR 1 /* free variable */
1.59 +#define GLP_LO 2 /* variable with lower bound */
1.60 +#define GLP_UP 3 /* variable with upper bound */
1.61 +#define GLP_DB 4 /* double-bounded variable */
1.62 +#define GLP_FX 5 /* fixed variable */
1.63 +
1.64 +/* status of auxiliary/structural variable: */
1.65 +#define GLP_BS 1 /* basic variable */
1.66 +#define GLP_NL 2 /* non-basic variable on lower bound */
1.67 +#define GLP_NU 3 /* non-basic variable on upper bound */
1.68 +#define GLP_NF 4 /* non-basic free variable */
1.69 +#define GLP_NS 5 /* non-basic fixed variable */
1.70 +
1.71 +/* scaling options: */
1.72 +#define GLP_SF_GM 0x01 /* perform geometric mean scaling */
1.73 +#define GLP_SF_EQ 0x10 /* perform equilibration scaling */
1.74 +#define GLP_SF_2N 0x20 /* round scale factors to power of two */
1.75 +#define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */
1.76 +#define GLP_SF_AUTO 0x80 /* choose scaling options automatically */
1.77 +
1.78 +/* solution indicator: */
1.79 +#define GLP_SOL 1 /* basic solution */
1.80 +#define GLP_IPT 2 /* interior-point solution */
1.81 +#define GLP_MIP 3 /* mixed integer solution */
1.82 +
1.83 +/* solution status: */
1.84 +#define GLP_UNDEF 1 /* solution is undefined */
1.85 +#define GLP_FEAS 2 /* solution is feasible */
1.86 +#define GLP_INFEAS 3 /* solution is infeasible */
1.87 +#define GLP_NOFEAS 4 /* no feasible solution exists */
1.88 +#define GLP_OPT 5 /* solution is optimal */
1.89 +#define GLP_UNBND 6 /* solution is unbounded */
1.90 +
1.91 +typedef struct
1.92 +{ /* basis factorization control parameters */
1.93 + int msg_lev; /* (reserved) */
1.94 + int type; /* factorization type: */
1.95 +#define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */
1.96 +#define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */
1.97 +#define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */
1.98 + int lu_size; /* luf.sv_size */
1.99 + double piv_tol; /* luf.piv_tol */
1.100 + int piv_lim; /* luf.piv_lim */
1.101 + int suhl; /* luf.suhl */
1.102 + double eps_tol; /* luf.eps_tol */
1.103 + double max_gro; /* luf.max_gro */
1.104 + int nfs_max; /* fhv.hh_max */
1.105 + double upd_tol; /* fhv.upd_tol */
1.106 + int nrs_max; /* lpf.n_max */
1.107 + int rs_size; /* lpf.v_size */
1.108 + double foo_bar[38]; /* (reserved) */
1.109 +} glp_bfcp;
1.110 +
1.111 +typedef struct
1.112 +{ /* simplex method control parameters */
1.113 + int msg_lev; /* message level: */
1.114 +#define GLP_MSG_OFF 0 /* no output */
1.115 +#define GLP_MSG_ERR 1 /* warning and error messages only */
1.116 +#define GLP_MSG_ON 2 /* normal output */
1.117 +#define GLP_MSG_ALL 3 /* full output */
1.118 +#define GLP_MSG_DBG 4 /* debug output */
1.119 + int meth; /* simplex method option: */
1.120 +#define GLP_PRIMAL 1 /* use primal simplex */
1.121 +#define GLP_DUALP 2 /* use dual; if it fails, use primal */
1.122 +#define GLP_DUAL 3 /* use dual simplex */
1.123 + int pricing; /* pricing technique: */
1.124 +#define GLP_PT_STD 0x11 /* standard (Dantzig rule) */
1.125 +#define GLP_PT_PSE 0x22 /* projected steepest edge */
1.126 + int r_test; /* ratio test technique: */
1.127 +#define GLP_RT_STD 0x11 /* standard (textbook) */
1.128 +#define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */
1.129 + double tol_bnd; /* spx.tol_bnd */
1.130 + double tol_dj; /* spx.tol_dj */
1.131 + double tol_piv; /* spx.tol_piv */
1.132 + double obj_ll; /* spx.obj_ll */
1.133 + double obj_ul; /* spx.obj_ul */
1.134 + int it_lim; /* spx.it_lim */
1.135 + int tm_lim; /* spx.tm_lim (milliseconds) */
1.136 + int out_frq; /* spx.out_frq */
1.137 + int out_dly; /* spx.out_dly (milliseconds) */
1.138 + int presolve; /* enable/disable using LP presolver */
1.139 + double foo_bar[36]; /* (reserved) */
1.140 +} glp_smcp;
1.141 +
1.142 +typedef struct
1.143 +{ /* interior-point solver control parameters */
1.144 + int msg_lev; /* message level (see glp_smcp) */
1.145 + int ord_alg; /* ordering algorithm: */
1.146 +#define GLP_ORD_NONE 0 /* natural (original) ordering */
1.147 +#define GLP_ORD_QMD 1 /* quotient minimum degree (QMD) */
1.148 +#define GLP_ORD_AMD 2 /* approx. minimum degree (AMD) */
1.149 +#define GLP_ORD_SYMAMD 3 /* approx. minimum degree (SYMAMD) */
1.150 + double foo_bar[48]; /* (reserved) */
1.151 +} glp_iptcp;
1.152 +
1.153 +#ifndef GLP_TREE_DEFINED
1.154 +#define GLP_TREE_DEFINED
1.155 +typedef struct { double _opaque_tree[100]; } glp_tree;
1.156 +/* branch-and-bound tree */
1.157 +#endif
1.158 +
1.159 +typedef struct
1.160 +{ /* integer optimizer control parameters */
1.161 + int msg_lev; /* message level (see glp_smcp) */
1.162 + int br_tech; /* branching technique: */
1.163 +#define GLP_BR_FFV 1 /* first fractional variable */
1.164 +#define GLP_BR_LFV 2 /* last fractional variable */
1.165 +#define GLP_BR_MFV 3 /* most fractional variable */
1.166 +#define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */
1.167 +#define GLP_BR_PCH 5 /* hybrid pseudocost heuristic */
1.168 + int bt_tech; /* backtracking technique: */
1.169 +#define GLP_BT_DFS 1 /* depth first search */
1.170 +#define GLP_BT_BFS 2 /* breadth first search */
1.171 +#define GLP_BT_BLB 3 /* best local bound */
1.172 +#define GLP_BT_BPH 4 /* best projection heuristic */
1.173 + double tol_int; /* mip.tol_int */
1.174 + double tol_obj; /* mip.tol_obj */
1.175 + int tm_lim; /* mip.tm_lim (milliseconds) */
1.176 + int out_frq; /* mip.out_frq (milliseconds) */
1.177 + int out_dly; /* mip.out_dly (milliseconds) */
1.178 + void (*cb_func)(glp_tree *T, void *info);
1.179 + /* mip.cb_func */
1.180 + void *cb_info; /* mip.cb_info */
1.181 + int cb_size; /* mip.cb_size */
1.182 + int pp_tech; /* preprocessing technique: */
1.183 +#define GLP_PP_NONE 0 /* disable preprocessing */
1.184 +#define GLP_PP_ROOT 1 /* preprocessing only on root level */
1.185 +#define GLP_PP_ALL 2 /* preprocessing on all levels */
1.186 + double mip_gap; /* relative MIP gap tolerance */
1.187 + int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */
1.188 + int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */
1.189 + int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */
1.190 + int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */
1.191 + int presolve; /* enable/disable using MIP presolver */
1.192 + int binarize; /* try to binarize integer variables */
1.193 + int fp_heur; /* feasibility pump heuristic */
1.194 +#if 1 /* 28/V-2010 */
1.195 + int alien; /* use alien solver */
1.196 +#endif
1.197 + double foo_bar[29]; /* (reserved) */
1.198 +} glp_iocp;
1.199 +
1.200 +typedef struct
1.201 +{ /* additional row attributes */
1.202 + int level;
1.203 + /* subproblem level at which the row was added */
1.204 + int origin;
1.205 + /* row origin flag: */
1.206 +#define GLP_RF_REG 0 /* regular constraint */
1.207 +#define GLP_RF_LAZY 1 /* "lazy" constraint */
1.208 +#define GLP_RF_CUT 2 /* cutting plane constraint */
1.209 + int klass;
1.210 + /* row class descriptor: */
1.211 +#define GLP_RF_GMI 1 /* Gomory's mixed integer cut */
1.212 +#define GLP_RF_MIR 2 /* mixed integer rounding cut */
1.213 +#define GLP_RF_COV 3 /* mixed cover cut */
1.214 +#define GLP_RF_CLQ 4 /* clique cut */
1.215 + double foo_bar[7];
1.216 + /* (reserved) */
1.217 +} glp_attr;
1.218 +
1.219 +/* enable/disable flag: */
1.220 +#define GLP_ON 1 /* enable something */
1.221 +#define GLP_OFF 0 /* disable something */
1.222 +
1.223 +/* reason codes: */
1.224 +#define GLP_IROWGEN 0x01 /* request for row generation */
1.225 +#define GLP_IBINGO 0x02 /* better integer solution found */
1.226 +#define GLP_IHEUR 0x03 /* request for heuristic solution */
1.227 +#define GLP_ICUTGEN 0x04 /* request for cut generation */
1.228 +#define GLP_IBRANCH 0x05 /* request for branching */
1.229 +#define GLP_ISELECT 0x06 /* request for subproblem selection */
1.230 +#define GLP_IPREPRO 0x07 /* request for preprocessing */
1.231 +
1.232 +/* branch selection indicator: */
1.233 +#define GLP_NO_BRNCH 0 /* select no branch */
1.234 +#define GLP_DN_BRNCH 1 /* select down-branch */
1.235 +#define GLP_UP_BRNCH 2 /* select up-branch */
1.236 +
1.237 +/* return codes: */
1.238 +#define GLP_EBADB 0x01 /* invalid basis */
1.239 +#define GLP_ESING 0x02 /* singular matrix */
1.240 +#define GLP_ECOND 0x03 /* ill-conditioned matrix */
1.241 +#define GLP_EBOUND 0x04 /* invalid bounds */
1.242 +#define GLP_EFAIL 0x05 /* solver failed */
1.243 +#define GLP_EOBJLL 0x06 /* objective lower limit reached */
1.244 +#define GLP_EOBJUL 0x07 /* objective upper limit reached */
1.245 +#define GLP_EITLIM 0x08 /* iteration limit exceeded */
1.246 +#define GLP_ETMLIM 0x09 /* time limit exceeded */
1.247 +#define GLP_ENOPFS 0x0A /* no primal feasible solution */
1.248 +#define GLP_ENODFS 0x0B /* no dual feasible solution */
1.249 +#define GLP_EROOT 0x0C /* root LP optimum not provided */
1.250 +#define GLP_ESTOP 0x0D /* search terminated by application */
1.251 +#define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */
1.252 +#define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */
1.253 +#define GLP_ENOCVG 0x10 /* no convergence */
1.254 +#define GLP_EINSTAB 0x11 /* numerical instability */
1.255 +#define GLP_EDATA 0x12 /* invalid data */
1.256 +#define GLP_ERANGE 0x13 /* result out of range */
1.257 +
1.258 +/* condition indicator: */
1.259 +#define GLP_KKT_PE 1 /* primal equalities */
1.260 +#define GLP_KKT_PB 2 /* primal bounds */
1.261 +#define GLP_KKT_DE 3 /* dual equalities */
1.262 +#define GLP_KKT_DB 4 /* dual bounds */
1.263 +#define GLP_KKT_CS 5 /* complementary slackness */
1.264 +
1.265 +/* MPS file format: */
1.266 +#define GLP_MPS_DECK 1 /* fixed (ancient) */
1.267 +#define GLP_MPS_FILE 2 /* free (modern) */
1.268 +
1.269 +typedef struct
1.270 +{ /* MPS format control parameters */
1.271 + int blank;
1.272 + /* character code to replace blanks in symbolic names */
1.273 + char *obj_name;
1.274 + /* objective row name */
1.275 + double tol_mps;
1.276 + /* zero tolerance for MPS data */
1.277 + double foo_bar[17];
1.278 + /* (reserved for use in the future) */
1.279 +} glp_mpscp;
1.280 +
1.281 +typedef struct
1.282 +{ /* CPLEX LP format control parameters */
1.283 + double foo_bar[20];
1.284 + /* (reserved for use in the future) */
1.285 +} glp_cpxcp;
1.286 +
1.287 +#ifndef GLP_TRAN_DEFINED
1.288 +#define GLP_TRAN_DEFINED
1.289 +typedef struct { double _opaque_tran[100]; } glp_tran;
1.290 +/* MathProg translator workspace */
1.291 +#endif
1.292 +
1.293 +glp_prob *glp_create_prob(void);
1.294 +/* create problem object */
1.295 +
1.296 +void glp_set_prob_name(glp_prob *P, const char *name);
1.297 +/* assign (change) problem name */
1.298 +
1.299 +void glp_set_obj_name(glp_prob *P, const char *name);
1.300 +/* assign (change) objective function name */
1.301 +
1.302 +void glp_set_obj_dir(glp_prob *P, int dir);
1.303 +/* set (change) optimization direction flag */
1.304 +
1.305 +int glp_add_rows(glp_prob *P, int nrs);
1.306 +/* add new rows to problem object */
1.307 +
1.308 +int glp_add_cols(glp_prob *P, int ncs);
1.309 +/* add new columns to problem object */
1.310 +
1.311 +void glp_set_row_name(glp_prob *P, int i, const char *name);
1.312 +/* assign (change) row name */
1.313 +
1.314 +void glp_set_col_name(glp_prob *P, int j, const char *name);
1.315 +/* assign (change) column name */
1.316 +
1.317 +void glp_set_row_bnds(glp_prob *P, int i, int type, double lb,
1.318 + double ub);
1.319 +/* set (change) row bounds */
1.320 +
1.321 +void glp_set_col_bnds(glp_prob *P, int j, int type, double lb,
1.322 + double ub);
1.323 +/* set (change) column bounds */
1.324 +
1.325 +void glp_set_obj_coef(glp_prob *P, int j, double coef);
1.326 +/* set (change) obj. coefficient or constant term */
1.327 +
1.328 +void glp_set_mat_row(glp_prob *P, int i, int len, const int ind[],
1.329 + const double val[]);
1.330 +/* set (replace) row of the constraint matrix */
1.331 +
1.332 +void glp_set_mat_col(glp_prob *P, int j, int len, const int ind[],
1.333 + const double val[]);
1.334 +/* set (replace) column of the constraint matrix */
1.335 +
1.336 +void glp_load_matrix(glp_prob *P, int ne, const int ia[],
1.337 + const int ja[], const double ar[]);
1.338 +/* load (replace) the whole constraint matrix */
1.339 +
1.340 +int glp_check_dup(int m, int n, int ne, const int ia[], const int ja[]);
1.341 +/* check for duplicate elements in sparse matrix */
1.342 +
1.343 +void glp_sort_matrix(glp_prob *P);
1.344 +/* sort elements of the constraint matrix */
1.345 +
1.346 +void glp_del_rows(glp_prob *P, int nrs, const int num[]);
1.347 +/* delete specified rows from problem object */
1.348 +
1.349 +void glp_del_cols(glp_prob *P, int ncs, const int num[]);
1.350 +/* delete specified columns from problem object */
1.351 +
1.352 +void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names);
1.353 +/* copy problem object content */
1.354 +
1.355 +void glp_erase_prob(glp_prob *P);
1.356 +/* erase problem object content */
1.357 +
1.358 +void glp_delete_prob(glp_prob *P);
1.359 +/* delete problem object */
1.360 +
1.361 +const char *glp_get_prob_name(glp_prob *P);
1.362 +/* retrieve problem name */
1.363 +
1.364 +const char *glp_get_obj_name(glp_prob *P);
1.365 +/* retrieve objective function name */
1.366 +
1.367 +int glp_get_obj_dir(glp_prob *P);
1.368 +/* retrieve optimization direction flag */
1.369 +
1.370 +int glp_get_num_rows(glp_prob *P);
1.371 +/* retrieve number of rows */
1.372 +
1.373 +int glp_get_num_cols(glp_prob *P);
1.374 +/* retrieve number of columns */
1.375 +
1.376 +const char *glp_get_row_name(glp_prob *P, int i);
1.377 +/* retrieve row name */
1.378 +
1.379 +const char *glp_get_col_name(glp_prob *P, int j);
1.380 +/* retrieve column name */
1.381 +
1.382 +int glp_get_row_type(glp_prob *P, int i);
1.383 +/* retrieve row type */
1.384 +
1.385 +double glp_get_row_lb(glp_prob *P, int i);
1.386 +/* retrieve row lower bound */
1.387 +
1.388 +double glp_get_row_ub(glp_prob *P, int i);
1.389 +/* retrieve row upper bound */
1.390 +
1.391 +int glp_get_col_type(glp_prob *P, int j);
1.392 +/* retrieve column type */
1.393 +
1.394 +double glp_get_col_lb(glp_prob *P, int j);
1.395 +/* retrieve column lower bound */
1.396 +
1.397 +double glp_get_col_ub(glp_prob *P, int j);
1.398 +/* retrieve column upper bound */
1.399 +
1.400 +double glp_get_obj_coef(glp_prob *P, int j);
1.401 +/* retrieve obj. coefficient or constant term */
1.402 +
1.403 +int glp_get_num_nz(glp_prob *P);
1.404 +/* retrieve number of constraint coefficients */
1.405 +
1.406 +int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]);
1.407 +/* retrieve row of the constraint matrix */
1.408 +
1.409 +int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]);
1.410 +/* retrieve column of the constraint matrix */
1.411 +
1.412 +void glp_create_index(glp_prob *P);
1.413 +/* create the name index */
1.414 +
1.415 +int glp_find_row(glp_prob *P, const char *name);
1.416 +/* find row by its name */
1.417 +
1.418 +int glp_find_col(glp_prob *P, const char *name);
1.419 +/* find column by its name */
1.420 +
1.421 +void glp_delete_index(glp_prob *P);
1.422 +/* delete the name index */
1.423 +
1.424 +void glp_set_rii(glp_prob *P, int i, double rii);
1.425 +/* set (change) row scale factor */
1.426 +
1.427 +void glp_set_sjj(glp_prob *P, int j, double sjj);
1.428 +/* set (change) column scale factor */
1.429 +
1.430 +double glp_get_rii(glp_prob *P, int i);
1.431 +/* retrieve row scale factor */
1.432 +
1.433 +double glp_get_sjj(glp_prob *P, int j);
1.434 +/* retrieve column scale factor */
1.435 +
1.436 +void glp_scale_prob(glp_prob *P, int flags);
1.437 +/* scale problem data */
1.438 +
1.439 +void glp_unscale_prob(glp_prob *P);
1.440 +/* unscale problem data */
1.441 +
1.442 +void glp_set_row_stat(glp_prob *P, int i, int stat);
1.443 +/* set (change) row status */
1.444 +
1.445 +void glp_set_col_stat(glp_prob *P, int j, int stat);
1.446 +/* set (change) column status */
1.447 +
1.448 +void glp_std_basis(glp_prob *P);
1.449 +/* construct standard initial LP basis */
1.450 +
1.451 +void glp_adv_basis(glp_prob *P, int flags);
1.452 +/* construct advanced initial LP basis */
1.453 +
1.454 +void glp_cpx_basis(glp_prob *P);
1.455 +/* construct Bixby's initial LP basis */
1.456 +
1.457 +int glp_simplex(glp_prob *P, const glp_smcp *parm);
1.458 +/* solve LP problem with the simplex method */
1.459 +
1.460 +int glp_exact(glp_prob *P, const glp_smcp *parm);
1.461 +/* solve LP problem in exact arithmetic */
1.462 +
1.463 +void glp_init_smcp(glp_smcp *parm);
1.464 +/* initialize simplex method control parameters */
1.465 +
1.466 +int glp_get_status(glp_prob *P);
1.467 +/* retrieve generic status of basic solution */
1.468 +
1.469 +int glp_get_prim_stat(glp_prob *P);
1.470 +/* retrieve status of primal basic solution */
1.471 +
1.472 +int glp_get_dual_stat(glp_prob *P);
1.473 +/* retrieve status of dual basic solution */
1.474 +
1.475 +double glp_get_obj_val(glp_prob *P);
1.476 +/* retrieve objective value (basic solution) */
1.477 +
1.478 +int glp_get_row_stat(glp_prob *P, int i);
1.479 +/* retrieve row status */
1.480 +
1.481 +double glp_get_row_prim(glp_prob *P, int i);
1.482 +/* retrieve row primal value (basic solution) */
1.483 +
1.484 +double glp_get_row_dual(glp_prob *P, int i);
1.485 +/* retrieve row dual value (basic solution) */
1.486 +
1.487 +int glp_get_col_stat(glp_prob *P, int j);
1.488 +/* retrieve column status */
1.489 +
1.490 +double glp_get_col_prim(glp_prob *P, int j);
1.491 +/* retrieve column primal value (basic solution) */
1.492 +
1.493 +double glp_get_col_dual(glp_prob *P, int j);
1.494 +/* retrieve column dual value (basic solution) */
1.495 +
1.496 +int glp_get_unbnd_ray(glp_prob *P);
1.497 +/* determine variable causing unboundedness */
1.498 +
1.499 +int glp_interior(glp_prob *P, const glp_iptcp *parm);
1.500 +/* solve LP problem with the interior-point method */
1.501 +
1.502 +void glp_init_iptcp(glp_iptcp *parm);
1.503 +/* initialize interior-point solver control parameters */
1.504 +
1.505 +int glp_ipt_status(glp_prob *P);
1.506 +/* retrieve status of interior-point solution */
1.507 +
1.508 +double glp_ipt_obj_val(glp_prob *P);
1.509 +/* retrieve objective value (interior point) */
1.510 +
1.511 +double glp_ipt_row_prim(glp_prob *P, int i);
1.512 +/* retrieve row primal value (interior point) */
1.513 +
1.514 +double glp_ipt_row_dual(glp_prob *P, int i);
1.515 +/* retrieve row dual value (interior point) */
1.516 +
1.517 +double glp_ipt_col_prim(glp_prob *P, int j);
1.518 +/* retrieve column primal value (interior point) */
1.519 +
1.520 +double glp_ipt_col_dual(glp_prob *P, int j);
1.521 +/* retrieve column dual value (interior point) */
1.522 +
1.523 +void glp_set_col_kind(glp_prob *P, int j, int kind);
1.524 +/* set (change) column kind */
1.525 +
1.526 +int glp_get_col_kind(glp_prob *P, int j);
1.527 +/* retrieve column kind */
1.528 +
1.529 +int glp_get_num_int(glp_prob *P);
1.530 +/* retrieve number of integer columns */
1.531 +
1.532 +int glp_get_num_bin(glp_prob *P);
1.533 +/* retrieve number of binary columns */
1.534 +
1.535 +int glp_intopt(glp_prob *P, const glp_iocp *parm);
1.536 +/* solve MIP problem with the branch-and-bound method */
1.537 +
1.538 +void glp_init_iocp(glp_iocp *parm);
1.539 +/* initialize integer optimizer control parameters */
1.540 +
1.541 +int glp_mip_status(glp_prob *P);
1.542 +/* retrieve status of MIP solution */
1.543 +
1.544 +double glp_mip_obj_val(glp_prob *P);
1.545 +/* retrieve objective value (MIP solution) */
1.546 +
1.547 +double glp_mip_row_val(glp_prob *P, int i);
1.548 +/* retrieve row value (MIP solution) */
1.549 +
1.550 +double glp_mip_col_val(glp_prob *P, int j);
1.551 +/* retrieve column value (MIP solution) */
1.552 +
1.553 +int glp_print_sol(glp_prob *P, const char *fname);
1.554 +/* write basic solution in printable format */
1.555 +
1.556 +int glp_read_sol(glp_prob *P, const char *fname);
1.557 +/* read basic solution from text file */
1.558 +
1.559 +int glp_write_sol(glp_prob *P, const char *fname);
1.560 +/* write basic solution to text file */
1.561 +
1.562 +int glp_print_ranges(glp_prob *P, int len, const int list[],
1.563 + int flags, const char *fname);
1.564 +/* print sensitivity analysis report */
1.565 +
1.566 +int glp_print_ipt(glp_prob *P, const char *fname);
1.567 +/* write interior-point solution in printable format */
1.568 +
1.569 +int glp_read_ipt(glp_prob *P, const char *fname);
1.570 +/* read interior-point solution from text file */
1.571 +
1.572 +int glp_write_ipt(glp_prob *P, const char *fname);
1.573 +/* write interior-point solution to text file */
1.574 +
1.575 +int glp_print_mip(glp_prob *P, const char *fname);
1.576 +/* write MIP solution in printable format */
1.577 +
1.578 +int glp_read_mip(glp_prob *P, const char *fname);
1.579 +/* read MIP solution from text file */
1.580 +
1.581 +int glp_write_mip(glp_prob *P, const char *fname);
1.582 +/* write MIP solution to text file */
1.583 +
1.584 +int glp_bf_exists(glp_prob *P);
1.585 +/* check if the basis factorization exists */
1.586 +
1.587 +int glp_factorize(glp_prob *P);
1.588 +/* compute the basis factorization */
1.589 +
1.590 +int glp_bf_updated(glp_prob *P);
1.591 +/* check if the basis factorization has been updated */
1.592 +
1.593 +void glp_get_bfcp(glp_prob *P, glp_bfcp *parm);
1.594 +/* retrieve basis factorization control parameters */
1.595 +
1.596 +void glp_set_bfcp(glp_prob *P, const glp_bfcp *parm);
1.597 +/* change basis factorization control parameters */
1.598 +
1.599 +int glp_get_bhead(glp_prob *P, int k);
1.600 +/* retrieve the basis header information */
1.601 +
1.602 +int glp_get_row_bind(glp_prob *P, int i);
1.603 +/* retrieve row index in the basis header */
1.604 +
1.605 +int glp_get_col_bind(glp_prob *P, int j);
1.606 +/* retrieve column index in the basis header */
1.607 +
1.608 +void glp_ftran(glp_prob *P, double x[]);
1.609 +/* perform forward transformation (solve system B*x = b) */
1.610 +
1.611 +void glp_btran(glp_prob *P, double x[]);
1.612 +/* perform backward transformation (solve system B'*x = b) */
1.613 +
1.614 +int glp_warm_up(glp_prob *P);
1.615 +/* "warm up" LP basis */
1.616 +
1.617 +int glp_eval_tab_row(glp_prob *P, int k, int ind[], double val[]);
1.618 +/* compute row of the simplex tableau */
1.619 +
1.620 +int glp_eval_tab_col(glp_prob *P, int k, int ind[], double val[]);
1.621 +/* compute column of the simplex tableau */
1.622 +
1.623 +int glp_transform_row(glp_prob *P, int len, int ind[], double val[]);
1.624 +/* transform explicitly specified row */
1.625 +
1.626 +int glp_transform_col(glp_prob *P, int len, int ind[], double val[]);
1.627 +/* transform explicitly specified column */
1.628 +
1.629 +int glp_prim_rtest(glp_prob *P, int len, const int ind[],
1.630 + const double val[], int dir, double eps);
1.631 +/* perform primal ratio test */
1.632 +
1.633 +int glp_dual_rtest(glp_prob *P, int len, const int ind[],
1.634 + const double val[], int dir, double eps);
1.635 +/* perform dual ratio test */
1.636 +
1.637 +void glp_analyze_bound(glp_prob *P, int k, double *value1, int *var1,
1.638 + double *value2, int *var2);
1.639 +/* analyze active bound of non-basic variable */
1.640 +
1.641 +void glp_analyze_coef(glp_prob *P, int k, double *coef1, int *var1,
1.642 + double *value1, double *coef2, int *var2, double *value2);
1.643 +/* analyze objective coefficient at basic variable */
1.644 +
1.645 +int glp_ios_reason(glp_tree *T);
1.646 +/* determine reason for calling the callback routine */
1.647 +
1.648 +glp_prob *glp_ios_get_prob(glp_tree *T);
1.649 +/* access the problem object */
1.650 +
1.651 +void glp_ios_tree_size(glp_tree *T, int *a_cnt, int *n_cnt,
1.652 + int *t_cnt);
1.653 +/* determine size of the branch-and-bound tree */
1.654 +
1.655 +int glp_ios_curr_node(glp_tree *T);
1.656 +/* determine current active subproblem */
1.657 +
1.658 +int glp_ios_next_node(glp_tree *T, int p);
1.659 +/* determine next active subproblem */
1.660 +
1.661 +int glp_ios_prev_node(glp_tree *T, int p);
1.662 +/* determine previous active subproblem */
1.663 +
1.664 +int glp_ios_up_node(glp_tree *T, int p);
1.665 +/* determine parent subproblem */
1.666 +
1.667 +int glp_ios_node_level(glp_tree *T, int p);
1.668 +/* determine subproblem level */
1.669 +
1.670 +double glp_ios_node_bound(glp_tree *T, int p);
1.671 +/* determine subproblem local bound */
1.672 +
1.673 +int glp_ios_best_node(glp_tree *T);
1.674 +/* find active subproblem with best local bound */
1.675 +
1.676 +double glp_ios_mip_gap(glp_tree *T);
1.677 +/* compute relative MIP gap */
1.678 +
1.679 +void *glp_ios_node_data(glp_tree *T, int p);
1.680 +/* access subproblem application-specific data */
1.681 +
1.682 +void glp_ios_row_attr(glp_tree *T, int i, glp_attr *attr);
1.683 +/* retrieve additional row attributes */
1.684 +
1.685 +int glp_ios_pool_size(glp_tree *T);
1.686 +/* determine current size of the cut pool */
1.687 +
1.688 +int glp_ios_add_row(glp_tree *T,
1.689 + const char *name, int klass, int flags, int len, const int ind[],
1.690 + const double val[], int type, double rhs);
1.691 +/* add row (constraint) to the cut pool */
1.692 +
1.693 +void glp_ios_del_row(glp_tree *T, int i);
1.694 +/* remove row (constraint) from the cut pool */
1.695 +
1.696 +void glp_ios_clear_pool(glp_tree *T);
1.697 +/* remove all rows (constraints) from the cut pool */
1.698 +
1.699 +int glp_ios_can_branch(glp_tree *T, int j);
1.700 +/* check if can branch upon specified variable */
1.701 +
1.702 +void glp_ios_branch_upon(glp_tree *T, int j, int sel);
1.703 +/* choose variable to branch upon */
1.704 +
1.705 +void glp_ios_select_node(glp_tree *T, int p);
1.706 +/* select subproblem to continue the search */
1.707 +
1.708 +int glp_ios_heur_sol(glp_tree *T, const double x[]);
1.709 +/* provide solution found by heuristic */
1.710 +
1.711 +void glp_ios_terminate(glp_tree *T);
1.712 +/* terminate the solution process */
1.713 +
1.714 +void glp_init_mpscp(glp_mpscp *parm);
1.715 +/* initialize MPS format control parameters */
1.716 +
1.717 +int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm,
1.718 + const char *fname);
1.719 +/* read problem data in MPS format */
1.720 +
1.721 +int glp_write_mps(glp_prob *P, int fmt, const glp_mpscp *parm,
1.722 + const char *fname);
1.723 +/* write problem data in MPS format */
1.724 +
1.725 +void glp_init_cpxcp(glp_cpxcp *parm);
1.726 +/* initialize CPLEX LP format control parameters */
1.727 +
1.728 +int glp_read_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname);
1.729 +/* read problem data in CPLEX LP format */
1.730 +
1.731 +int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname);
1.732 +/* write problem data in CPLEX LP format */
1.733 +
1.734 +int glp_read_prob(glp_prob *P, int flags, const char *fname);
1.735 +/* read problem data in GLPK format */
1.736 +
1.737 +int glp_write_prob(glp_prob *P, int flags, const char *fname);
1.738 +/* write problem data in GLPK format */
1.739 +
1.740 +glp_tran *glp_mpl_alloc_wksp(void);
1.741 +/* allocate the MathProg translator workspace */
1.742 +
1.743 +int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip);
1.744 +/* read and translate model section */
1.745 +
1.746 +int glp_mpl_read_data(glp_tran *tran, const char *fname);
1.747 +/* read and translate data section */
1.748 +
1.749 +int glp_mpl_generate(glp_tran *tran, const char *fname);
1.750 +/* generate the model */
1.751 +
1.752 +void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob);
1.753 +/* build LP/MIP problem instance from the model */
1.754 +
1.755 +int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol);
1.756 +/* postsolve the model */
1.757 +
1.758 +void glp_mpl_free_wksp(glp_tran *tran);
1.759 +/* free the MathProg translator workspace */
1.760 +
1.761 +int glp_main(int argc, const char *argv[]);
1.762 +/* stand-alone LP/MIP solver */
1.763 +
1.764 +/**********************************************************************/
1.765 +
1.766 +#ifndef GLP_LONG_DEFINED
1.767 +#define GLP_LONG_DEFINED
1.768 +typedef struct { int lo, hi; } glp_long;
1.769 +/* long integer data type */
1.770 +#endif
1.771 +
1.772 +int glp_init_env(void);
1.773 +/* initialize GLPK environment */
1.774 +
1.775 +const char *glp_version(void);
1.776 +/* determine library version */
1.777 +
1.778 +int glp_free_env(void);
1.779 +/* free GLPK environment */
1.780 +
1.781 +void glp_printf(const char *fmt, ...);
1.782 +/* write formatted output to terminal */
1.783 +
1.784 +void glp_vprintf(const char *fmt, va_list arg);
1.785 +/* write formatted output to terminal */
1.786 +
1.787 +int glp_term_out(int flag);
1.788 +/* enable/disable terminal output */
1.789 +
1.790 +void glp_term_hook(int (*func)(void *info, const char *s), void *info);
1.791 +/* install hook to intercept terminal output */
1.792 +
1.793 +int glp_open_tee(const char *fname);
1.794 +/* start copying terminal output to text file */
1.795 +
1.796 +int glp_close_tee(void);
1.797 +/* stop copying terminal output to text file */
1.798 +
1.799 +#ifndef GLP_ERROR_DEFINED
1.800 +#define GLP_ERROR_DEFINED
1.801 +typedef void (*_glp_error)(const char *fmt, ...);
1.802 +#endif
1.803 +
1.804 +#define glp_error glp_error_(__FILE__, __LINE__)
1.805 +_glp_error glp_error_(const char *file, int line);
1.806 +/* display error message and terminate execution */
1.807 +
1.808 +#define glp_assert(expr) \
1.809 + ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1)))
1.810 +void glp_assert_(const char *expr, const char *file, int line);
1.811 +/* check for logical condition */
1.812 +
1.813 +void glp_error_hook(void (*func)(void *info), void *info);
1.814 +/* install hook to intercept abnormal termination */
1.815 +
1.816 +void *glp_malloc(int size);
1.817 +/* allocate memory block */
1.818 +
1.819 +void *glp_calloc(int n, int size);
1.820 +/* allocate memory block */
1.821 +
1.822 +void glp_free(void *ptr);
1.823 +/* free memory block */
1.824 +
1.825 +void glp_mem_limit(int limit);
1.826 +/* set memory usage limit */
1.827 +
1.828 +void glp_mem_usage(int *count, int *cpeak, glp_long *total,
1.829 + glp_long *tpeak);
1.830 +/* get memory usage information */
1.831 +
1.832 +glp_long glp_time(void);
1.833 +/* determine current universal time */
1.834 +
1.835 +double glp_difftime(glp_long t1, glp_long t0);
1.836 +/* compute difference between two time values */
1.837 +
1.838 +/**********************************************************************/
1.839 +
1.840 +#ifndef GLP_DATA_DEFINED
1.841 +#define GLP_DATA_DEFINED
1.842 +typedef struct { double _opaque_data[100]; } glp_data;
1.843 +/* plain data file */
1.844 +#endif
1.845 +
1.846 +glp_data *glp_sdf_open_file(const char *fname);
1.847 +/* open plain data file */
1.848 +
1.849 +void glp_sdf_set_jump(glp_data *data, void *jump);
1.850 +/* set up error handling */
1.851 +
1.852 +void glp_sdf_error(glp_data *data, const char *fmt, ...);
1.853 +/* print error message */
1.854 +
1.855 +void glp_sdf_warning(glp_data *data, const char *fmt, ...);
1.856 +/* print warning message */
1.857 +
1.858 +int glp_sdf_read_int(glp_data *data);
1.859 +/* read integer number */
1.860 +
1.861 +double glp_sdf_read_num(glp_data *data);
1.862 +/* read floating-point number */
1.863 +
1.864 +const char *glp_sdf_read_item(glp_data *data);
1.865 +/* read data item */
1.866 +
1.867 +const char *glp_sdf_read_text(glp_data *data);
1.868 +/* read text until end of line */
1.869 +
1.870 +int glp_sdf_line(glp_data *data);
1.871 +/* determine current line number */
1.872 +
1.873 +void glp_sdf_close_file(glp_data *data);
1.874 +/* close plain data file */
1.875 +
1.876 +/**********************************************************************/
1.877 +
1.878 +typedef struct _glp_graph glp_graph;
1.879 +typedef struct _glp_vertex glp_vertex;
1.880 +typedef struct _glp_arc glp_arc;
1.881 +
1.882 +struct _glp_graph
1.883 +{ /* graph descriptor */
1.884 + void *pool; /* DMP *pool; */
1.885 + /* memory pool to store graph components */
1.886 + char *name;
1.887 + /* graph name (1 to 255 chars); NULL means no name is assigned
1.888 + to the graph */
1.889 + int nv_max;
1.890 + /* length of the vertex list (enlarged automatically) */
1.891 + int nv;
1.892 + /* number of vertices in the graph, 0 <= nv <= nv_max */
1.893 + int na;
1.894 + /* number of arcs in the graph, na >= 0 */
1.895 + glp_vertex **v; /* glp_vertex *v[1+nv_max]; */
1.896 + /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */
1.897 + void *index; /* AVL *index; */
1.898 + /* vertex index to find vertices by their names; NULL means the
1.899 + index does not exist */
1.900 + int v_size;
1.901 + /* size of data associated with each vertex (0 to 256 bytes) */
1.902 + int a_size;
1.903 + /* size of data associated with each arc (0 to 256 bytes) */
1.904 +};
1.905 +
1.906 +struct _glp_vertex
1.907 +{ /* vertex descriptor */
1.908 + int i;
1.909 + /* vertex ordinal number, 1 <= i <= nv */
1.910 + char *name;
1.911 + /* vertex name (1 to 255 chars); NULL means no name is assigned
1.912 + to the vertex */
1.913 + void *entry; /* AVLNODE *entry; */
1.914 + /* pointer to corresponding entry in the vertex index; NULL means
1.915 + that either the index does not exist or the vertex has no name
1.916 + assigned */
1.917 + void *data;
1.918 + /* pointer to data associated with the vertex */
1.919 + void *temp;
1.920 + /* working pointer */
1.921 + glp_arc *in;
1.922 + /* pointer to the (unordered) list of incoming arcs */
1.923 + glp_arc *out;
1.924 + /* pointer to the (unordered) list of outgoing arcs */
1.925 +};
1.926 +
1.927 +struct _glp_arc
1.928 +{ /* arc descriptor */
1.929 + glp_vertex *tail;
1.930 + /* pointer to the tail endpoint */
1.931 + glp_vertex *head;
1.932 + /* pointer to the head endpoint */
1.933 + void *data;
1.934 + /* pointer to data associated with the arc */
1.935 + void *temp;
1.936 + /* working pointer */
1.937 + glp_arc *t_prev;
1.938 + /* pointer to previous arc having the same tail endpoint */
1.939 + glp_arc *t_next;
1.940 + /* pointer to next arc having the same tail endpoint */
1.941 + glp_arc *h_prev;
1.942 + /* pointer to previous arc having the same head endpoint */
1.943 + glp_arc *h_next;
1.944 + /* pointer to next arc having the same head endpoint */
1.945 +};
1.946 +
1.947 +glp_graph *glp_create_graph(int v_size, int a_size);
1.948 +/* create graph */
1.949 +
1.950 +void glp_set_graph_name(glp_graph *G, const char *name);
1.951 +/* assign (change) graph name */
1.952 +
1.953 +int glp_add_vertices(glp_graph *G, int nadd);
1.954 +/* add new vertices to graph */
1.955 +
1.956 +void glp_set_vertex_name(glp_graph *G, int i, const char *name);
1.957 +/* assign (change) vertex name */
1.958 +
1.959 +glp_arc *glp_add_arc(glp_graph *G, int i, int j);
1.960 +/* add new arc to graph */
1.961 +
1.962 +void glp_del_vertices(glp_graph *G, int ndel, const int num[]);
1.963 +/* delete vertices from graph */
1.964 +
1.965 +void glp_del_arc(glp_graph *G, glp_arc *a);
1.966 +/* delete arc from graph */
1.967 +
1.968 +void glp_erase_graph(glp_graph *G, int v_size, int a_size);
1.969 +/* erase graph content */
1.970 +
1.971 +void glp_delete_graph(glp_graph *G);
1.972 +/* delete graph */
1.973 +
1.974 +void glp_create_v_index(glp_graph *G);
1.975 +/* create vertex name index */
1.976 +
1.977 +int glp_find_vertex(glp_graph *G, const char *name);
1.978 +/* find vertex by its name */
1.979 +
1.980 +void glp_delete_v_index(glp_graph *G);
1.981 +/* delete vertex name index */
1.982 +
1.983 +int glp_read_graph(glp_graph *G, const char *fname);
1.984 +/* read graph from plain text file */
1.985 +
1.986 +int glp_write_graph(glp_graph *G, const char *fname);
1.987 +/* write graph to plain text file */
1.988 +
1.989 +void glp_mincost_lp(glp_prob *P, glp_graph *G, int names, int v_rhs,
1.990 + int a_low, int a_cap, int a_cost);
1.991 +/* convert minimum cost flow problem to LP */
1.992 +
1.993 +int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap,
1.994 + int a_cost, double *sol, int a_x, int v_pi);
1.995 +/* find minimum-cost flow with out-of-kilter algorithm */
1.996 +
1.997 +void glp_maxflow_lp(glp_prob *P, glp_graph *G, int names, int s,
1.998 + int t, int a_cap);
1.999 +/* convert maximum flow problem to LP */
1.1000 +
1.1001 +int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap,
1.1002 + double *sol, int a_x, int v_cut);
1.1003 +/* find maximal flow with Ford-Fulkerson algorithm */
1.1004 +
1.1005 +int glp_check_asnprob(glp_graph *G, int v_set);
1.1006 +/* check correctness of assignment problem data */
1.1007 +
1.1008 +/* assignment problem formulation: */
1.1009 +#define GLP_ASN_MIN 1 /* perfect matching (minimization) */
1.1010 +#define GLP_ASN_MAX 2 /* perfect matching (maximization) */
1.1011 +#define GLP_ASN_MMP 3 /* maximum matching */
1.1012 +
1.1013 +int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names,
1.1014 + int v_set, int a_cost);
1.1015 +/* convert assignment problem to LP */
1.1016 +
1.1017 +int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost,
1.1018 + double *sol, int a_x);
1.1019 +/* solve assignment problem with out-of-kilter algorithm */
1.1020 +
1.1021 +int glp_asnprob_hall(glp_graph *G, int v_set, int a_x);
1.1022 +/* find bipartite matching of maximum cardinality */
1.1023 +
1.1024 +double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls);
1.1025 +/* solve critical path problem */
1.1026 +
1.1027 +int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap,
1.1028 + int a_cost, const char *fname);
1.1029 +/* read min-cost flow problem data in DIMACS format */
1.1030 +
1.1031 +int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap,
1.1032 + int a_cost, const char *fname);
1.1033 +/* write min-cost flow problem data in DIMACS format */
1.1034 +
1.1035 +int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap,
1.1036 + const char *fname);
1.1037 +/* read maximum flow problem data in DIMACS format */
1.1038 +
1.1039 +int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap,
1.1040 + const char *fname);
1.1041 +/* write maximum flow problem data in DIMACS format */
1.1042 +
1.1043 +int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char
1.1044 + *fname);
1.1045 +/* read assignment problem data in DIMACS format */
1.1046 +
1.1047 +int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char
1.1048 + *fname);
1.1049 +/* write assignment problem data in DIMACS format */
1.1050 +
1.1051 +int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname);
1.1052 +/* read graph in DIMACS clique/coloring format */
1.1053 +
1.1054 +int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname);
1.1055 +/* write graph in DIMACS clique/coloring format */
1.1056 +
1.1057 +int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost,
1.1058 + const int parm[1+15]);
1.1059 +/* Klingman's network problem generator */
1.1060 +
1.1061 +int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost,
1.1062 + const int parm[1+14]);
1.1063 +/* grid-like network problem generator */
1.1064 +
1.1065 +int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap,
1.1066 + const int parm[1+5]);
1.1067 +/* Goldfarb's maximum flow problem generator */
1.1068 +
1.1069 +int glp_weak_comp(glp_graph *G, int v_num);
1.1070 +/* find all weakly connected components of graph */
1.1071 +
1.1072 +int glp_strong_comp(glp_graph *G, int v_num);
1.1073 +/* find all strongly connected components of graph */
1.1074 +
1.1075 +int glp_top_sort(glp_graph *G, int v_num);
1.1076 +/* topological sorting of acyclic digraph */
1.1077 +
1.1078 +int glp_wclique_exact(glp_graph *G, int v_wgt, double *sol, int v_set);
1.1079 +/* find maximum weight clique with exact algorithm */
1.1080 +
1.1081 +/***********************************************************************
1.1082 +* NOTE: All symbols defined below are obsolete and kept here only for
1.1083 +* backward compatibility.
1.1084 +***********************************************************************/
1.1085 +
1.1086 +#define LPX glp_prob
1.1087 +
1.1088 +/* problem class: */
1.1089 +#define LPX_LP 100 /* linear programming (LP) */
1.1090 +#define LPX_MIP 101 /* mixed integer programming (MIP) */
1.1091 +
1.1092 +/* type of auxiliary/structural variable: */
1.1093 +#define LPX_FR 110 /* free variable */
1.1094 +#define LPX_LO 111 /* variable with lower bound */
1.1095 +#define LPX_UP 112 /* variable with upper bound */
1.1096 +#define LPX_DB 113 /* double-bounded variable */
1.1097 +#define LPX_FX 114 /* fixed variable */
1.1098 +
1.1099 +/* optimization direction flag: */
1.1100 +#define LPX_MIN 120 /* minimization */
1.1101 +#define LPX_MAX 121 /* maximization */
1.1102 +
1.1103 +/* status of primal basic solution: */
1.1104 +#define LPX_P_UNDEF 132 /* primal solution is undefined */
1.1105 +#define LPX_P_FEAS 133 /* solution is primal feasible */
1.1106 +#define LPX_P_INFEAS 134 /* solution is primal infeasible */
1.1107 +#define LPX_P_NOFEAS 135 /* no primal feasible solution exists */
1.1108 +
1.1109 +/* status of dual basic solution: */
1.1110 +#define LPX_D_UNDEF 136 /* dual solution is undefined */
1.1111 +#define LPX_D_FEAS 137 /* solution is dual feasible */
1.1112 +#define LPX_D_INFEAS 138 /* solution is dual infeasible */
1.1113 +#define LPX_D_NOFEAS 139 /* no dual feasible solution exists */
1.1114 +
1.1115 +/* status of auxiliary/structural variable: */
1.1116 +#define LPX_BS 140 /* basic variable */
1.1117 +#define LPX_NL 141 /* non-basic variable on lower bound */
1.1118 +#define LPX_NU 142 /* non-basic variable on upper bound */
1.1119 +#define LPX_NF 143 /* non-basic free variable */
1.1120 +#define LPX_NS 144 /* non-basic fixed variable */
1.1121 +
1.1122 +/* status of interior-point solution: */
1.1123 +#define LPX_T_UNDEF 150 /* interior solution is undefined */
1.1124 +#define LPX_T_OPT 151 /* interior solution is optimal */
1.1125 +
1.1126 +/* kind of structural variable: */
1.1127 +#define LPX_CV 160 /* continuous variable */
1.1128 +#define LPX_IV 161 /* integer variable */
1.1129 +
1.1130 +/* status of integer solution: */
1.1131 +#define LPX_I_UNDEF 170 /* integer solution is undefined */
1.1132 +#define LPX_I_OPT 171 /* integer solution is optimal */
1.1133 +#define LPX_I_FEAS 172 /* integer solution is feasible */
1.1134 +#define LPX_I_NOFEAS 173 /* no integer solution exists */
1.1135 +
1.1136 +/* status codes reported by the routine lpx_get_status: */
1.1137 +#define LPX_OPT 180 /* optimal */
1.1138 +#define LPX_FEAS 181 /* feasible */
1.1139 +#define LPX_INFEAS 182 /* infeasible */
1.1140 +#define LPX_NOFEAS 183 /* no feasible */
1.1141 +#define LPX_UNBND 184 /* unbounded */
1.1142 +#define LPX_UNDEF 185 /* undefined */
1.1143 +
1.1144 +/* exit codes returned by solver routines: */
1.1145 +#define LPX_E_OK 200 /* success */
1.1146 +#define LPX_E_EMPTY 201 /* empty problem */
1.1147 +#define LPX_E_BADB 202 /* invalid initial basis */
1.1148 +#define LPX_E_INFEAS 203 /* infeasible initial solution */
1.1149 +#define LPX_E_FAULT 204 /* unable to start the search */
1.1150 +#define LPX_E_OBJLL 205 /* objective lower limit reached */
1.1151 +#define LPX_E_OBJUL 206 /* objective upper limit reached */
1.1152 +#define LPX_E_ITLIM 207 /* iterations limit exhausted */
1.1153 +#define LPX_E_TMLIM 208 /* time limit exhausted */
1.1154 +#define LPX_E_NOFEAS 209 /* no feasible solution */
1.1155 +#define LPX_E_INSTAB 210 /* numerical instability */
1.1156 +#define LPX_E_SING 211 /* problems with basis matrix */
1.1157 +#define LPX_E_NOCONV 212 /* no convergence (interior) */
1.1158 +#define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */
1.1159 +#define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */
1.1160 +#define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached */
1.1161 +
1.1162 +/* control parameter identifiers: */
1.1163 +#define LPX_K_MSGLEV 300 /* lp->msg_lev */
1.1164 +#define LPX_K_SCALE 301 /* lp->scale */
1.1165 +#define LPX_K_DUAL 302 /* lp->dual */
1.1166 +#define LPX_K_PRICE 303 /* lp->price */
1.1167 +#define LPX_K_RELAX 304 /* lp->relax */
1.1168 +#define LPX_K_TOLBND 305 /* lp->tol_bnd */
1.1169 +#define LPX_K_TOLDJ 306 /* lp->tol_dj */
1.1170 +#define LPX_K_TOLPIV 307 /* lp->tol_piv */
1.1171 +#define LPX_K_ROUND 308 /* lp->round */
1.1172 +#define LPX_K_OBJLL 309 /* lp->obj_ll */
1.1173 +#define LPX_K_OBJUL 310 /* lp->obj_ul */
1.1174 +#define LPX_K_ITLIM 311 /* lp->it_lim */
1.1175 +#define LPX_K_ITCNT 312 /* lp->it_cnt */
1.1176 +#define LPX_K_TMLIM 313 /* lp->tm_lim */
1.1177 +#define LPX_K_OUTFRQ 314 /* lp->out_frq */
1.1178 +#define LPX_K_OUTDLY 315 /* lp->out_dly */
1.1179 +#define LPX_K_BRANCH 316 /* lp->branch */
1.1180 +#define LPX_K_BTRACK 317 /* lp->btrack */
1.1181 +#define LPX_K_TOLINT 318 /* lp->tol_int */
1.1182 +#define LPX_K_TOLOBJ 319 /* lp->tol_obj */
1.1183 +#define LPX_K_MPSINFO 320 /* lp->mps_info */
1.1184 +#define LPX_K_MPSOBJ 321 /* lp->mps_obj */
1.1185 +#define LPX_K_MPSORIG 322 /* lp->mps_orig */
1.1186 +#define LPX_K_MPSWIDE 323 /* lp->mps_wide */
1.1187 +#define LPX_K_MPSFREE 324 /* lp->mps_free */
1.1188 +#define LPX_K_MPSSKIP 325 /* lp->mps_skip */
1.1189 +#define LPX_K_LPTORIG 326 /* lp->lpt_orig */
1.1190 +#define LPX_K_PRESOL 327 /* lp->presol */
1.1191 +#define LPX_K_BINARIZE 328 /* lp->binarize */
1.1192 +#define LPX_K_USECUTS 329 /* lp->use_cuts */
1.1193 +#define LPX_K_BFTYPE 330 /* lp->bfcp->type */
1.1194 +#define LPX_K_MIPGAP 331 /* lp->mip_gap */
1.1195 +
1.1196 +#define LPX_C_COVER 0x01 /* mixed cover cuts */
1.1197 +#define LPX_C_CLIQUE 0x02 /* clique cuts */
1.1198 +#define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */
1.1199 +#define LPX_C_MIR 0x08 /* mixed integer rounding cuts */
1.1200 +#define LPX_C_ALL 0xFF /* all cuts */
1.1201 +
1.1202 +typedef struct
1.1203 +{ /* this structure contains results reported by the routines which
1.1204 + checks Karush-Kuhn-Tucker conditions (for details see comments
1.1205 + to those routines) */
1.1206 + /*--------------------------------------------------------------*/
1.1207 + /* xR - A * xS = 0 (KKT.PE) */
1.1208 + double pe_ae_max;
1.1209 + /* largest absolute error */
1.1210 + int pe_ae_row;
1.1211 + /* number of row with largest absolute error */
1.1212 + double pe_re_max;
1.1213 + /* largest relative error */
1.1214 + int pe_re_row;
1.1215 + /* number of row with largest relative error */
1.1216 + int pe_quality;
1.1217 + /* quality of primal solution:
1.1218 + 'H' - high
1.1219 + 'M' - medium
1.1220 + 'L' - low
1.1221 + '?' - primal solution is wrong */
1.1222 + /*--------------------------------------------------------------*/
1.1223 + /* l[k] <= x[k] <= u[k] (KKT.PB) */
1.1224 + double pb_ae_max;
1.1225 + /* largest absolute error */
1.1226 + int pb_ae_ind;
1.1227 + /* number of variable with largest absolute error */
1.1228 + double pb_re_max;
1.1229 + /* largest relative error */
1.1230 + int pb_re_ind;
1.1231 + /* number of variable with largest relative error */
1.1232 + int pb_quality;
1.1233 + /* quality of primal feasibility:
1.1234 + 'H' - high
1.1235 + 'M' - medium
1.1236 + 'L' - low
1.1237 + '?' - primal solution is infeasible */
1.1238 + /*--------------------------------------------------------------*/
1.1239 + /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */
1.1240 + double de_ae_max;
1.1241 + /* largest absolute error */
1.1242 + int de_ae_col;
1.1243 + /* number of column with largest absolute error */
1.1244 + double de_re_max;
1.1245 + /* largest relative error */
1.1246 + int de_re_col;
1.1247 + /* number of column with largest relative error */
1.1248 + int de_quality;
1.1249 + /* quality of dual solution:
1.1250 + 'H' - high
1.1251 + 'M' - medium
1.1252 + 'L' - low
1.1253 + '?' - dual solution is wrong */
1.1254 + /*--------------------------------------------------------------*/
1.1255 + /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */
1.1256 + double db_ae_max;
1.1257 + /* largest absolute error */
1.1258 + int db_ae_ind;
1.1259 + /* number of variable with largest absolute error */
1.1260 + double db_re_max;
1.1261 + /* largest relative error */
1.1262 + int db_re_ind;
1.1263 + /* number of variable with largest relative error */
1.1264 + int db_quality;
1.1265 + /* quality of dual feasibility:
1.1266 + 'H' - high
1.1267 + 'M' - medium
1.1268 + 'L' - low
1.1269 + '?' - dual solution is infeasible */
1.1270 + /*--------------------------------------------------------------*/
1.1271 + /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */
1.1272 + double cs_ae_max;
1.1273 + /* largest absolute error */
1.1274 + int cs_ae_ind;
1.1275 + /* number of variable with largest absolute error */
1.1276 + double cs_re_max;
1.1277 + /* largest relative error */
1.1278 + int cs_re_ind;
1.1279 + /* number of variable with largest relative error */
1.1280 + int cs_quality;
1.1281 + /* quality of complementary slackness:
1.1282 + 'H' - high
1.1283 + 'M' - medium
1.1284 + 'L' - low
1.1285 + '?' - primal and dual solutions are not complementary */
1.1286 +} LPXKKT;
1.1287 +
1.1288 +#define lpx_create_prob _glp_lpx_create_prob
1.1289 +LPX *lpx_create_prob(void);
1.1290 +/* create problem object */
1.1291 +
1.1292 +#define lpx_set_prob_name _glp_lpx_set_prob_name
1.1293 +void lpx_set_prob_name(LPX *lp, const char *name);
1.1294 +/* assign (change) problem name */
1.1295 +
1.1296 +#define lpx_set_obj_name _glp_lpx_set_obj_name
1.1297 +void lpx_set_obj_name(LPX *lp, const char *name);
1.1298 +/* assign (change) objective function name */
1.1299 +
1.1300 +#define lpx_set_obj_dir _glp_lpx_set_obj_dir
1.1301 +void lpx_set_obj_dir(LPX *lp, int dir);
1.1302 +/* set (change) optimization direction flag */
1.1303 +
1.1304 +#define lpx_add_rows _glp_lpx_add_rows
1.1305 +int lpx_add_rows(LPX *lp, int nrs);
1.1306 +/* add new rows to problem object */
1.1307 +
1.1308 +#define lpx_add_cols _glp_lpx_add_cols
1.1309 +int lpx_add_cols(LPX *lp, int ncs);
1.1310 +/* add new columns to problem object */
1.1311 +
1.1312 +#define lpx_set_row_name _glp_lpx_set_row_name
1.1313 +void lpx_set_row_name(LPX *lp, int i, const char *name);
1.1314 +/* assign (change) row name */
1.1315 +
1.1316 +#define lpx_set_col_name _glp_lpx_set_col_name
1.1317 +void lpx_set_col_name(LPX *lp, int j, const char *name);
1.1318 +/* assign (change) column name */
1.1319 +
1.1320 +#define lpx_set_row_bnds _glp_lpx_set_row_bnds
1.1321 +void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub);
1.1322 +/* set (change) row bounds */
1.1323 +
1.1324 +#define lpx_set_col_bnds _glp_lpx_set_col_bnds
1.1325 +void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub);
1.1326 +/* set (change) column bounds */
1.1327 +
1.1328 +#define lpx_set_obj_coef _glp_lpx_set_obj_coef
1.1329 +void lpx_set_obj_coef(glp_prob *lp, int j, double coef);
1.1330 +/* set (change) obj. coefficient or constant term */
1.1331 +
1.1332 +#define lpx_set_mat_row _glp_lpx_set_mat_row
1.1333 +void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[],
1.1334 + const double val[]);
1.1335 +/* set (replace) row of the constraint matrix */
1.1336 +
1.1337 +#define lpx_set_mat_col _glp_lpx_set_mat_col
1.1338 +void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[],
1.1339 + const double val[]);
1.1340 +/* set (replace) column of the constraint matrix */
1.1341 +
1.1342 +#define lpx_load_matrix _glp_lpx_load_matrix
1.1343 +void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[],
1.1344 + const double ar[]);
1.1345 +/* load (replace) the whole constraint matrix */
1.1346 +
1.1347 +#define lpx_del_rows _glp_lpx_del_rows
1.1348 +void lpx_del_rows(LPX *lp, int nrs, const int num[]);
1.1349 +/* delete specified rows from problem object */
1.1350 +
1.1351 +#define lpx_del_cols _glp_lpx_del_cols
1.1352 +void lpx_del_cols(LPX *lp, int ncs, const int num[]);
1.1353 +/* delete specified columns from problem object */
1.1354 +
1.1355 +#define lpx_delete_prob _glp_lpx_delete_prob
1.1356 +void lpx_delete_prob(LPX *lp);
1.1357 +/* delete problem object */
1.1358 +
1.1359 +#define lpx_get_prob_name _glp_lpx_get_prob_name
1.1360 +const char *lpx_get_prob_name(LPX *lp);
1.1361 +/* retrieve problem name */
1.1362 +
1.1363 +#define lpx_get_obj_name _glp_lpx_get_obj_name
1.1364 +const char *lpx_get_obj_name(LPX *lp);
1.1365 +/* retrieve objective function name */
1.1366 +
1.1367 +#define lpx_get_obj_dir _glp_lpx_get_obj_dir
1.1368 +int lpx_get_obj_dir(LPX *lp);
1.1369 +/* retrieve optimization direction flag */
1.1370 +
1.1371 +#define lpx_get_num_rows _glp_lpx_get_num_rows
1.1372 +int lpx_get_num_rows(LPX *lp);
1.1373 +/* retrieve number of rows */
1.1374 +
1.1375 +#define lpx_get_num_cols _glp_lpx_get_num_cols
1.1376 +int lpx_get_num_cols(LPX *lp);
1.1377 +/* retrieve number of columns */
1.1378 +
1.1379 +#define lpx_get_row_name _glp_lpx_get_row_name
1.1380 +const char *lpx_get_row_name(LPX *lp, int i);
1.1381 +/* retrieve row name */
1.1382 +
1.1383 +#define lpx_get_col_name _glp_lpx_get_col_name
1.1384 +const char *lpx_get_col_name(LPX *lp, int j);
1.1385 +/* retrieve column name */
1.1386 +
1.1387 +#define lpx_get_row_type _glp_lpx_get_row_type
1.1388 +int lpx_get_row_type(LPX *lp, int i);
1.1389 +/* retrieve row type */
1.1390 +
1.1391 +#define lpx_get_row_lb _glp_lpx_get_row_lb
1.1392 +double lpx_get_row_lb(LPX *lp, int i);
1.1393 +/* retrieve row lower bound */
1.1394 +
1.1395 +#define lpx_get_row_ub _glp_lpx_get_row_ub
1.1396 +double lpx_get_row_ub(LPX *lp, int i);
1.1397 +/* retrieve row upper bound */
1.1398 +
1.1399 +#define lpx_get_row_bnds _glp_lpx_get_row_bnds
1.1400 +void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb,
1.1401 + double *ub);
1.1402 +/* retrieve row bounds */
1.1403 +
1.1404 +#define lpx_get_col_type _glp_lpx_get_col_type
1.1405 +int lpx_get_col_type(LPX *lp, int j);
1.1406 +/* retrieve column type */
1.1407 +
1.1408 +#define lpx_get_col_lb _glp_lpx_get_col_lb
1.1409 +double lpx_get_col_lb(LPX *lp, int j);
1.1410 +/* retrieve column lower bound */
1.1411 +
1.1412 +#define lpx_get_col_ub _glp_lpx_get_col_ub
1.1413 +double lpx_get_col_ub(LPX *lp, int j);
1.1414 +/* retrieve column upper bound */
1.1415 +
1.1416 +#define lpx_get_col_bnds _glp_lpx_get_col_bnds
1.1417 +void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb,
1.1418 + double *ub);
1.1419 +/* retrieve column bounds */
1.1420 +
1.1421 +#define lpx_get_obj_coef _glp_lpx_get_obj_coef
1.1422 +double lpx_get_obj_coef(LPX *lp, int j);
1.1423 +/* retrieve obj. coefficient or constant term */
1.1424 +
1.1425 +#define lpx_get_num_nz _glp_lpx_get_num_nz
1.1426 +int lpx_get_num_nz(LPX *lp);
1.1427 +/* retrieve number of constraint coefficients */
1.1428 +
1.1429 +#define lpx_get_mat_row _glp_lpx_get_mat_row
1.1430 +int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]);
1.1431 +/* retrieve row of the constraint matrix */
1.1432 +
1.1433 +#define lpx_get_mat_col _glp_lpx_get_mat_col
1.1434 +int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]);
1.1435 +/* retrieve column of the constraint matrix */
1.1436 +
1.1437 +#define lpx_create_index _glp_lpx_create_index
1.1438 +void lpx_create_index(LPX *lp);
1.1439 +/* create the name index */
1.1440 +
1.1441 +#define lpx_find_row _glp_lpx_find_row
1.1442 +int lpx_find_row(LPX *lp, const char *name);
1.1443 +/* find row by its name */
1.1444 +
1.1445 +#define lpx_find_col _glp_lpx_find_col
1.1446 +int lpx_find_col(LPX *lp, const char *name);
1.1447 +/* find column by its name */
1.1448 +
1.1449 +#define lpx_delete_index _glp_lpx_delete_index
1.1450 +void lpx_delete_index(LPX *lp);
1.1451 +/* delete the name index */
1.1452 +
1.1453 +#define lpx_scale_prob _glp_lpx_scale_prob
1.1454 +void lpx_scale_prob(LPX *lp);
1.1455 +/* scale problem data */
1.1456 +
1.1457 +#define lpx_unscale_prob _glp_lpx_unscale_prob
1.1458 +void lpx_unscale_prob(LPX *lp);
1.1459 +/* unscale problem data */
1.1460 +
1.1461 +#define lpx_set_row_stat _glp_lpx_set_row_stat
1.1462 +void lpx_set_row_stat(LPX *lp, int i, int stat);
1.1463 +/* set (change) row status */
1.1464 +
1.1465 +#define lpx_set_col_stat _glp_lpx_set_col_stat
1.1466 +void lpx_set_col_stat(LPX *lp, int j, int stat);
1.1467 +/* set (change) column status */
1.1468 +
1.1469 +#define lpx_std_basis _glp_lpx_std_basis
1.1470 +void lpx_std_basis(LPX *lp);
1.1471 +/* construct standard initial LP basis */
1.1472 +
1.1473 +#define lpx_adv_basis _glp_lpx_adv_basis
1.1474 +void lpx_adv_basis(LPX *lp);
1.1475 +/* construct advanced initial LP basis */
1.1476 +
1.1477 +#define lpx_cpx_basis _glp_lpx_cpx_basis
1.1478 +void lpx_cpx_basis(LPX *lp);
1.1479 +/* construct Bixby's initial LP basis */
1.1480 +
1.1481 +#define lpx_simplex _glp_lpx_simplex
1.1482 +int lpx_simplex(LPX *lp);
1.1483 +/* easy-to-use driver to the simplex method */
1.1484 +
1.1485 +#define lpx_exact _glp_lpx_exact
1.1486 +int lpx_exact(LPX *lp);
1.1487 +/* easy-to-use driver to the exact simplex method */
1.1488 +
1.1489 +#define lpx_get_status _glp_lpx_get_status
1.1490 +int lpx_get_status(LPX *lp);
1.1491 +/* retrieve generic status of basic solution */
1.1492 +
1.1493 +#define lpx_get_prim_stat _glp_lpx_get_prim_stat
1.1494 +int lpx_get_prim_stat(LPX *lp);
1.1495 +/* retrieve primal status of basic solution */
1.1496 +
1.1497 +#define lpx_get_dual_stat _glp_lpx_get_dual_stat
1.1498 +int lpx_get_dual_stat(LPX *lp);
1.1499 +/* retrieve dual status of basic solution */
1.1500 +
1.1501 +#define lpx_get_obj_val _glp_lpx_get_obj_val
1.1502 +double lpx_get_obj_val(LPX *lp);
1.1503 +/* retrieve objective value (basic solution) */
1.1504 +
1.1505 +#define lpx_get_row_stat _glp_lpx_get_row_stat
1.1506 +int lpx_get_row_stat(LPX *lp, int i);
1.1507 +/* retrieve row status (basic solution) */
1.1508 +
1.1509 +#define lpx_get_row_prim _glp_lpx_get_row_prim
1.1510 +double lpx_get_row_prim(LPX *lp, int i);
1.1511 +/* retrieve row primal value (basic solution) */
1.1512 +
1.1513 +#define lpx_get_row_dual _glp_lpx_get_row_dual
1.1514 +double lpx_get_row_dual(LPX *lp, int i);
1.1515 +/* retrieve row dual value (basic solution) */
1.1516 +
1.1517 +#define lpx_get_row_info _glp_lpx_get_row_info
1.1518 +void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx,
1.1519 + double *dx);
1.1520 +/* obtain row solution information */
1.1521 +
1.1522 +#define lpx_get_col_stat _glp_lpx_get_col_stat
1.1523 +int lpx_get_col_stat(LPX *lp, int j);
1.1524 +/* retrieve column status (basic solution) */
1.1525 +
1.1526 +#define lpx_get_col_prim _glp_lpx_get_col_prim
1.1527 +double lpx_get_col_prim(LPX *lp, int j);
1.1528 +/* retrieve column primal value (basic solution) */
1.1529 +
1.1530 +#define lpx_get_col_dual _glp_lpx_get_col_dual
1.1531 +double lpx_get_col_dual(glp_prob *lp, int j);
1.1532 +/* retrieve column dual value (basic solution) */
1.1533 +
1.1534 +#define lpx_get_col_info _glp_lpx_get_col_info
1.1535 +void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx,
1.1536 + double *dx);
1.1537 +/* obtain column solution information (obsolete) */
1.1538 +
1.1539 +#define lpx_get_ray_info _glp_lpx_get_ray_info
1.1540 +int lpx_get_ray_info(LPX *lp);
1.1541 +/* determine what causes primal unboundness */
1.1542 +
1.1543 +#define lpx_check_kkt _glp_lpx_check_kkt
1.1544 +void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt);
1.1545 +/* check Karush-Kuhn-Tucker conditions */
1.1546 +
1.1547 +#define lpx_warm_up _glp_lpx_warm_up
1.1548 +int lpx_warm_up(LPX *lp);
1.1549 +/* "warm up" LP basis */
1.1550 +
1.1551 +#define lpx_eval_tab_row _glp_lpx_eval_tab_row
1.1552 +int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]);
1.1553 +/* compute row of the simplex table */
1.1554 +
1.1555 +#define lpx_eval_tab_col _glp_lpx_eval_tab_col
1.1556 +int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]);
1.1557 +/* compute column of the simplex table */
1.1558 +
1.1559 +#define lpx_transform_row _glp_lpx_transform_row
1.1560 +int lpx_transform_row(LPX *lp, int len, int ind[], double val[]);
1.1561 +/* transform explicitly specified row */
1.1562 +
1.1563 +#define lpx_transform_col _glp_lpx_transform_col
1.1564 +int lpx_transform_col(LPX *lp, int len, int ind[], double val[]);
1.1565 +/* transform explicitly specified column */
1.1566 +
1.1567 +#define lpx_prim_ratio_test _glp_lpx_prim_ratio_test
1.1568 +int lpx_prim_ratio_test(LPX *lp, int len, const int ind[],
1.1569 + const double val[], int how, double tol);
1.1570 +/* perform primal ratio test */
1.1571 +
1.1572 +#define lpx_dual_ratio_test _glp_lpx_dual_ratio_test
1.1573 +int lpx_dual_ratio_test(LPX *lp, int len, const int ind[],
1.1574 + const double val[], int how, double tol);
1.1575 +/* perform dual ratio test */
1.1576 +
1.1577 +#define lpx_interior _glp_lpx_interior
1.1578 +int lpx_interior(LPX *lp);
1.1579 +/* easy-to-use driver to the interior point method */
1.1580 +
1.1581 +#define lpx_ipt_status _glp_lpx_ipt_status
1.1582 +int lpx_ipt_status(LPX *lp);
1.1583 +/* retrieve status of interior-point solution */
1.1584 +
1.1585 +#define lpx_ipt_obj_val _glp_lpx_ipt_obj_val
1.1586 +double lpx_ipt_obj_val(LPX *lp);
1.1587 +/* retrieve objective value (interior point) */
1.1588 +
1.1589 +#define lpx_ipt_row_prim _glp_lpx_ipt_row_prim
1.1590 +double lpx_ipt_row_prim(LPX *lp, int i);
1.1591 +/* retrieve row primal value (interior point) */
1.1592 +
1.1593 +#define lpx_ipt_row_dual _glp_lpx_ipt_row_dual
1.1594 +double lpx_ipt_row_dual(LPX *lp, int i);
1.1595 +/* retrieve row dual value (interior point) */
1.1596 +
1.1597 +#define lpx_ipt_col_prim _glp_lpx_ipt_col_prim
1.1598 +double lpx_ipt_col_prim(LPX *lp, int j);
1.1599 +/* retrieve column primal value (interior point) */
1.1600 +
1.1601 +#define lpx_ipt_col_dual _glp_lpx_ipt_col_dual
1.1602 +double lpx_ipt_col_dual(LPX *lp, int j);
1.1603 +/* retrieve column dual value (interior point) */
1.1604 +
1.1605 +#define lpx_set_class _glp_lpx_set_class
1.1606 +void lpx_set_class(LPX *lp, int klass);
1.1607 +/* set problem class */
1.1608 +
1.1609 +#define lpx_get_class _glp_lpx_get_class
1.1610 +int lpx_get_class(LPX *lp);
1.1611 +/* determine problem klass */
1.1612 +
1.1613 +#define lpx_set_col_kind _glp_lpx_set_col_kind
1.1614 +void lpx_set_col_kind(LPX *lp, int j, int kind);
1.1615 +/* set (change) column kind */
1.1616 +
1.1617 +#define lpx_get_col_kind _glp_lpx_get_col_kind
1.1618 +int lpx_get_col_kind(LPX *lp, int j);
1.1619 +/* retrieve column kind */
1.1620 +
1.1621 +#define lpx_get_num_int _glp_lpx_get_num_int
1.1622 +int lpx_get_num_int(LPX *lp);
1.1623 +/* retrieve number of integer columns */
1.1624 +
1.1625 +#define lpx_get_num_bin _glp_lpx_get_num_bin
1.1626 +int lpx_get_num_bin(LPX *lp);
1.1627 +/* retrieve number of binary columns */
1.1628 +
1.1629 +#define lpx_integer _glp_lpx_integer
1.1630 +int lpx_integer(LPX *lp);
1.1631 +/* easy-to-use driver to the branch-and-bound method */
1.1632 +
1.1633 +#define lpx_intopt _glp_lpx_intopt
1.1634 +int lpx_intopt(LPX *lp);
1.1635 +/* easy-to-use driver to the branch-and-bound method */
1.1636 +
1.1637 +#define lpx_mip_status _glp_lpx_mip_status
1.1638 +int lpx_mip_status(LPX *lp);
1.1639 +/* retrieve status of MIP solution */
1.1640 +
1.1641 +#define lpx_mip_obj_val _glp_lpx_mip_obj_val
1.1642 +double lpx_mip_obj_val(LPX *lp);
1.1643 +/* retrieve objective value (MIP solution) */
1.1644 +
1.1645 +#define lpx_mip_row_val _glp_lpx_mip_row_val
1.1646 +double lpx_mip_row_val(LPX *lp, int i);
1.1647 +/* retrieve row value (MIP solution) */
1.1648 +
1.1649 +#define lpx_mip_col_val _glp_lpx_mip_col_val
1.1650 +double lpx_mip_col_val(LPX *lp, int j);
1.1651 +/* retrieve column value (MIP solution) */
1.1652 +
1.1653 +#define lpx_check_int _glp_lpx_check_int
1.1654 +void lpx_check_int(LPX *lp, LPXKKT *kkt);
1.1655 +/* check integer feasibility conditions */
1.1656 +
1.1657 +#define lpx_reset_parms _glp_lpx_reset_parms
1.1658 +void lpx_reset_parms(LPX *lp);
1.1659 +/* reset control parameters to default values */
1.1660 +
1.1661 +#define lpx_set_int_parm _glp_lpx_set_int_parm
1.1662 +void lpx_set_int_parm(LPX *lp, int parm, int val);
1.1663 +/* set (change) integer control parameter */
1.1664 +
1.1665 +#define lpx_get_int_parm _glp_lpx_get_int_parm
1.1666 +int lpx_get_int_parm(LPX *lp, int parm);
1.1667 +/* query integer control parameter */
1.1668 +
1.1669 +#define lpx_set_real_parm _glp_lpx_set_real_parm
1.1670 +void lpx_set_real_parm(LPX *lp, int parm, double val);
1.1671 +/* set (change) real control parameter */
1.1672 +
1.1673 +#define lpx_get_real_parm _glp_lpx_get_real_parm
1.1674 +double lpx_get_real_parm(LPX *lp, int parm);
1.1675 +/* query real control parameter */
1.1676 +
1.1677 +#define lpx_read_mps _glp_lpx_read_mps
1.1678 +LPX *lpx_read_mps(const char *fname);
1.1679 +/* read problem data in fixed MPS format */
1.1680 +
1.1681 +#define lpx_write_mps _glp_lpx_write_mps
1.1682 +int lpx_write_mps(LPX *lp, const char *fname);
1.1683 +/* write problem data in fixed MPS format */
1.1684 +
1.1685 +#define lpx_read_bas _glp_lpx_read_bas
1.1686 +int lpx_read_bas(LPX *lp, const char *fname);
1.1687 +/* read LP basis in fixed MPS format */
1.1688 +
1.1689 +#define lpx_write_bas _glp_lpx_write_bas
1.1690 +int lpx_write_bas(LPX *lp, const char *fname);
1.1691 +/* write LP basis in fixed MPS format */
1.1692 +
1.1693 +#define lpx_read_freemps _glp_lpx_read_freemps
1.1694 +LPX *lpx_read_freemps(const char *fname);
1.1695 +/* read problem data in free MPS format */
1.1696 +
1.1697 +#define lpx_write_freemps _glp_lpx_write_freemps
1.1698 +int lpx_write_freemps(LPX *lp, const char *fname);
1.1699 +/* write problem data in free MPS format */
1.1700 +
1.1701 +#define lpx_read_cpxlp _glp_lpx_read_cpxlp
1.1702 +LPX *lpx_read_cpxlp(const char *fname);
1.1703 +/* read problem data in CPLEX LP format */
1.1704 +
1.1705 +#define lpx_write_cpxlp _glp_lpx_write_cpxlp
1.1706 +int lpx_write_cpxlp(LPX *lp, const char *fname);
1.1707 +/* write problem data in CPLEX LP format */
1.1708 +
1.1709 +#define lpx_read_model _glp_lpx_read_model
1.1710 +LPX *lpx_read_model(const char *model, const char *data,
1.1711 + const char *output);
1.1712 +/* read LP/MIP model written in GNU MathProg language */
1.1713 +
1.1714 +#define lpx_print_prob _glp_lpx_print_prob
1.1715 +int lpx_print_prob(LPX *lp, const char *fname);
1.1716 +/* write problem data in plain text format */
1.1717 +
1.1718 +#define lpx_print_sol _glp_lpx_print_sol
1.1719 +int lpx_print_sol(LPX *lp, const char *fname);
1.1720 +/* write LP problem solution in printable format */
1.1721 +
1.1722 +#define lpx_print_sens_bnds _glp_lpx_print_sens_bnds
1.1723 +int lpx_print_sens_bnds(LPX *lp, const char *fname);
1.1724 +/* write bounds sensitivity information */
1.1725 +
1.1726 +#define lpx_print_ips _glp_lpx_print_ips
1.1727 +int lpx_print_ips(LPX *lp, const char *fname);
1.1728 +/* write interior point solution in printable format */
1.1729 +
1.1730 +#define lpx_print_mip _glp_lpx_print_mip
1.1731 +int lpx_print_mip(LPX *lp, const char *fname);
1.1732 +/* write MIP problem solution in printable format */
1.1733 +
1.1734 +#define lpx_is_b_avail _glp_lpx_is_b_avail
1.1735 +int lpx_is_b_avail(LPX *lp);
1.1736 +/* check if LP basis is available */
1.1737 +
1.1738 +#define lpx_write_pb _glp_lpx_write_pb
1.1739 +int lpx_write_pb(LPX *lp, const char *fname, int normalized,
1.1740 + int binarize);
1.1741 +/* write problem data in (normalized) OPB format */
1.1742 +
1.1743 +#define lpx_main _glp_lpx_main
1.1744 +int lpx_main(int argc, const char *argv[]);
1.1745 +/* stand-alone LP/MIP solver */
1.1746 +
1.1747 +#ifdef __cplusplus
1.1748 +}
1.1749 +#endif
1.1750 +
1.1751 +#endif
1.1752 +
1.1753 +/* eof */