alpar@1: /* glpk.h */ alpar@1: alpar@1: /*********************************************************************** alpar@1: * This code is part of GLPK (GNU Linear Programming Kit). alpar@1: * alpar@1: * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, alpar@1: * 2009, 2010 Andrew Makhorin, Department for Applied Informatics, alpar@1: * Moscow Aviation Institute, Moscow, Russia. All rights reserved. alpar@1: * E-mail: . alpar@1: * alpar@1: * GLPK is free software: you can redistribute it and/or modify it alpar@1: * under the terms of the GNU General Public License as published by alpar@1: * the Free Software Foundation, either version 3 of the License, or alpar@1: * (at your option) any later version. alpar@1: * alpar@1: * GLPK is distributed in the hope that it will be useful, but WITHOUT alpar@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY alpar@1: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public alpar@1: * License for more details. alpar@1: * alpar@1: * You should have received a copy of the GNU General Public License alpar@1: * along with GLPK. If not, see . alpar@1: ***********************************************************************/ alpar@1: alpar@1: #ifndef GLPK_H alpar@1: #define GLPK_H alpar@1: alpar@1: #include alpar@1: #include alpar@1: alpar@1: #ifdef __cplusplus alpar@1: extern "C" { alpar@1: #endif alpar@1: alpar@1: /* library version numbers: */ alpar@1: #define GLP_MAJOR_VERSION 4 alpar@1: #define GLP_MINOR_VERSION 45 alpar@1: alpar@1: #ifndef GLP_PROB_DEFINED alpar@1: #define GLP_PROB_DEFINED alpar@1: typedef struct { double _opaque_prob[100]; } glp_prob; alpar@1: /* LP/MIP problem object */ alpar@1: #endif alpar@1: alpar@1: /* optimization direction flag: */ alpar@1: #define GLP_MIN 1 /* minimization */ alpar@1: #define GLP_MAX 2 /* maximization */ alpar@1: alpar@1: /* kind of structural variable: */ alpar@1: #define GLP_CV 1 /* continuous variable */ alpar@1: #define GLP_IV 2 /* integer variable */ alpar@1: #define GLP_BV 3 /* binary variable */ alpar@1: alpar@1: /* type of auxiliary/structural variable: */ alpar@1: #define GLP_FR 1 /* free variable */ alpar@1: #define GLP_LO 2 /* variable with lower bound */ alpar@1: #define GLP_UP 3 /* variable with upper bound */ alpar@1: #define GLP_DB 4 /* double-bounded variable */ alpar@1: #define GLP_FX 5 /* fixed variable */ alpar@1: alpar@1: /* status of auxiliary/structural variable: */ alpar@1: #define GLP_BS 1 /* basic variable */ alpar@1: #define GLP_NL 2 /* non-basic variable on lower bound */ alpar@1: #define GLP_NU 3 /* non-basic variable on upper bound */ alpar@1: #define GLP_NF 4 /* non-basic free variable */ alpar@1: #define GLP_NS 5 /* non-basic fixed variable */ alpar@1: alpar@1: /* scaling options: */ alpar@1: #define GLP_SF_GM 0x01 /* perform geometric mean scaling */ alpar@1: #define GLP_SF_EQ 0x10 /* perform equilibration scaling */ alpar@1: #define GLP_SF_2N 0x20 /* round scale factors to power of two */ alpar@1: #define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */ alpar@1: #define GLP_SF_AUTO 0x80 /* choose scaling options automatically */ alpar@1: alpar@1: /* solution indicator: */ alpar@1: #define GLP_SOL 1 /* basic solution */ alpar@1: #define GLP_IPT 2 /* interior-point solution */ alpar@1: #define GLP_MIP 3 /* mixed integer solution */ alpar@1: alpar@1: /* solution status: */ alpar@1: #define GLP_UNDEF 1 /* solution is undefined */ alpar@1: #define GLP_FEAS 2 /* solution is feasible */ alpar@1: #define GLP_INFEAS 3 /* solution is infeasible */ alpar@1: #define GLP_NOFEAS 4 /* no feasible solution exists */ alpar@1: #define GLP_OPT 5 /* solution is optimal */ alpar@1: #define GLP_UNBND 6 /* solution is unbounded */ alpar@1: alpar@1: typedef struct alpar@1: { /* basis factorization control parameters */ alpar@1: int msg_lev; /* (reserved) */ alpar@1: int type; /* factorization type: */ alpar@1: #define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */ alpar@1: #define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */ alpar@1: #define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */ alpar@1: int lu_size; /* luf.sv_size */ alpar@1: double piv_tol; /* luf.piv_tol */ alpar@1: int piv_lim; /* luf.piv_lim */ alpar@1: int suhl; /* luf.suhl */ alpar@1: double eps_tol; /* luf.eps_tol */ alpar@1: double max_gro; /* luf.max_gro */ alpar@1: int nfs_max; /* fhv.hh_max */ alpar@1: double upd_tol; /* fhv.upd_tol */ alpar@1: int nrs_max; /* lpf.n_max */ alpar@1: int rs_size; /* lpf.v_size */ alpar@1: double foo_bar[38]; /* (reserved) */ alpar@1: } glp_bfcp; alpar@1: alpar@1: typedef struct alpar@1: { /* simplex method control parameters */ alpar@1: int msg_lev; /* message level: */ alpar@1: #define GLP_MSG_OFF 0 /* no output */ alpar@1: #define GLP_MSG_ERR 1 /* warning and error messages only */ alpar@1: #define GLP_MSG_ON 2 /* normal output */ alpar@1: #define GLP_MSG_ALL 3 /* full output */ alpar@1: #define GLP_MSG_DBG 4 /* debug output */ alpar@1: int meth; /* simplex method option: */ alpar@1: #define GLP_PRIMAL 1 /* use primal simplex */ alpar@1: #define GLP_DUALP 2 /* use dual; if it fails, use primal */ alpar@1: #define GLP_DUAL 3 /* use dual simplex */ alpar@1: int pricing; /* pricing technique: */ alpar@1: #define GLP_PT_STD 0x11 /* standard (Dantzig rule) */ alpar@1: #define GLP_PT_PSE 0x22 /* projected steepest edge */ alpar@1: int r_test; /* ratio test technique: */ alpar@1: #define GLP_RT_STD 0x11 /* standard (textbook) */ alpar@1: #define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */ alpar@1: double tol_bnd; /* spx.tol_bnd */ alpar@1: double tol_dj; /* spx.tol_dj */ alpar@1: double tol_piv; /* spx.tol_piv */ alpar@1: double obj_ll; /* spx.obj_ll */ alpar@1: double obj_ul; /* spx.obj_ul */ alpar@1: int it_lim; /* spx.it_lim */ alpar@1: int tm_lim; /* spx.tm_lim (milliseconds) */ alpar@1: int out_frq; /* spx.out_frq */ alpar@1: int out_dly; /* spx.out_dly (milliseconds) */ alpar@1: int presolve; /* enable/disable using LP presolver */ alpar@1: double foo_bar[36]; /* (reserved) */ alpar@1: } glp_smcp; alpar@1: alpar@1: typedef struct alpar@1: { /* interior-point solver control parameters */ alpar@1: int msg_lev; /* message level (see glp_smcp) */ alpar@1: int ord_alg; /* ordering algorithm: */ alpar@1: #define GLP_ORD_NONE 0 /* natural (original) ordering */ alpar@1: #define GLP_ORD_QMD 1 /* quotient minimum degree (QMD) */ alpar@1: #define GLP_ORD_AMD 2 /* approx. minimum degree (AMD) */ alpar@1: #define GLP_ORD_SYMAMD 3 /* approx. minimum degree (SYMAMD) */ alpar@1: double foo_bar[48]; /* (reserved) */ alpar@1: } glp_iptcp; alpar@1: alpar@1: #ifndef GLP_TREE_DEFINED alpar@1: #define GLP_TREE_DEFINED alpar@1: typedef struct { double _opaque_tree[100]; } glp_tree; alpar@1: /* branch-and-bound tree */ alpar@1: #endif alpar@1: alpar@1: typedef struct alpar@1: { /* integer optimizer control parameters */ alpar@1: int msg_lev; /* message level (see glp_smcp) */ alpar@1: int br_tech; /* branching technique: */ alpar@1: #define GLP_BR_FFV 1 /* first fractional variable */ alpar@1: #define GLP_BR_LFV 2 /* last fractional variable */ alpar@1: #define GLP_BR_MFV 3 /* most fractional variable */ alpar@1: #define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */ alpar@1: #define GLP_BR_PCH 5 /* hybrid pseudocost heuristic */ alpar@1: int bt_tech; /* backtracking technique: */ alpar@1: #define GLP_BT_DFS 1 /* depth first search */ alpar@1: #define GLP_BT_BFS 2 /* breadth first search */ alpar@1: #define GLP_BT_BLB 3 /* best local bound */ alpar@1: #define GLP_BT_BPH 4 /* best projection heuristic */ alpar@1: double tol_int; /* mip.tol_int */ alpar@1: double tol_obj; /* mip.tol_obj */ alpar@1: int tm_lim; /* mip.tm_lim (milliseconds) */ alpar@1: int out_frq; /* mip.out_frq (milliseconds) */ alpar@1: int out_dly; /* mip.out_dly (milliseconds) */ alpar@1: void (*cb_func)(glp_tree *T, void *info); alpar@1: /* mip.cb_func */ alpar@1: void *cb_info; /* mip.cb_info */ alpar@1: int cb_size; /* mip.cb_size */ alpar@1: int pp_tech; /* preprocessing technique: */ alpar@1: #define GLP_PP_NONE 0 /* disable preprocessing */ alpar@1: #define GLP_PP_ROOT 1 /* preprocessing only on root level */ alpar@1: #define GLP_PP_ALL 2 /* preprocessing on all levels */ alpar@1: double mip_gap; /* relative MIP gap tolerance */ alpar@1: int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */ alpar@1: int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */ alpar@1: int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */ alpar@1: int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */ alpar@1: int presolve; /* enable/disable using MIP presolver */ alpar@1: int binarize; /* try to binarize integer variables */ alpar@1: int fp_heur; /* feasibility pump heuristic */ alpar@1: #if 1 /* 28/V-2010 */ alpar@1: int alien; /* use alien solver */ alpar@1: #endif alpar@1: double foo_bar[29]; /* (reserved) */ alpar@1: } glp_iocp; alpar@1: alpar@1: typedef struct alpar@1: { /* additional row attributes */ alpar@1: int level; alpar@1: /* subproblem level at which the row was added */ alpar@1: int origin; alpar@1: /* row origin flag: */ alpar@1: #define GLP_RF_REG 0 /* regular constraint */ alpar@1: #define GLP_RF_LAZY 1 /* "lazy" constraint */ alpar@1: #define GLP_RF_CUT 2 /* cutting plane constraint */ alpar@1: int klass; alpar@1: /* row class descriptor: */ alpar@1: #define GLP_RF_GMI 1 /* Gomory's mixed integer cut */ alpar@1: #define GLP_RF_MIR 2 /* mixed integer rounding cut */ alpar@1: #define GLP_RF_COV 3 /* mixed cover cut */ alpar@1: #define GLP_RF_CLQ 4 /* clique cut */ alpar@1: double foo_bar[7]; alpar@1: /* (reserved) */ alpar@1: } glp_attr; alpar@1: alpar@1: /* enable/disable flag: */ alpar@1: #define GLP_ON 1 /* enable something */ alpar@1: #define GLP_OFF 0 /* disable something */ alpar@1: alpar@1: /* reason codes: */ alpar@1: #define GLP_IROWGEN 0x01 /* request for row generation */ alpar@1: #define GLP_IBINGO 0x02 /* better integer solution found */ alpar@1: #define GLP_IHEUR 0x03 /* request for heuristic solution */ alpar@1: #define GLP_ICUTGEN 0x04 /* request for cut generation */ alpar@1: #define GLP_IBRANCH 0x05 /* request for branching */ alpar@1: #define GLP_ISELECT 0x06 /* request for subproblem selection */ alpar@1: #define GLP_IPREPRO 0x07 /* request for preprocessing */ alpar@1: alpar@1: /* branch selection indicator: */ alpar@1: #define GLP_NO_BRNCH 0 /* select no branch */ alpar@1: #define GLP_DN_BRNCH 1 /* select down-branch */ alpar@1: #define GLP_UP_BRNCH 2 /* select up-branch */ alpar@1: alpar@1: /* return codes: */ alpar@1: #define GLP_EBADB 0x01 /* invalid basis */ alpar@1: #define GLP_ESING 0x02 /* singular matrix */ alpar@1: #define GLP_ECOND 0x03 /* ill-conditioned matrix */ alpar@1: #define GLP_EBOUND 0x04 /* invalid bounds */ alpar@1: #define GLP_EFAIL 0x05 /* solver failed */ alpar@1: #define GLP_EOBJLL 0x06 /* objective lower limit reached */ alpar@1: #define GLP_EOBJUL 0x07 /* objective upper limit reached */ alpar@1: #define GLP_EITLIM 0x08 /* iteration limit exceeded */ alpar@1: #define GLP_ETMLIM 0x09 /* time limit exceeded */ alpar@1: #define GLP_ENOPFS 0x0A /* no primal feasible solution */ alpar@1: #define GLP_ENODFS 0x0B /* no dual feasible solution */ alpar@1: #define GLP_EROOT 0x0C /* root LP optimum not provided */ alpar@1: #define GLP_ESTOP 0x0D /* search terminated by application */ alpar@1: #define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */ alpar@1: #define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */ alpar@1: #define GLP_ENOCVG 0x10 /* no convergence */ alpar@1: #define GLP_EINSTAB 0x11 /* numerical instability */ alpar@1: #define GLP_EDATA 0x12 /* invalid data */ alpar@1: #define GLP_ERANGE 0x13 /* result out of range */ alpar@1: alpar@1: /* condition indicator: */ alpar@1: #define GLP_KKT_PE 1 /* primal equalities */ alpar@1: #define GLP_KKT_PB 2 /* primal bounds */ alpar@1: #define GLP_KKT_DE 3 /* dual equalities */ alpar@1: #define GLP_KKT_DB 4 /* dual bounds */ alpar@1: #define GLP_KKT_CS 5 /* complementary slackness */ alpar@1: alpar@1: /* MPS file format: */ alpar@1: #define GLP_MPS_DECK 1 /* fixed (ancient) */ alpar@1: #define GLP_MPS_FILE 2 /* free (modern) */ alpar@1: alpar@1: typedef struct alpar@1: { /* MPS format control parameters */ alpar@1: int blank; alpar@1: /* character code to replace blanks in symbolic names */ alpar@1: char *obj_name; alpar@1: /* objective row name */ alpar@1: double tol_mps; alpar@1: /* zero tolerance for MPS data */ alpar@1: double foo_bar[17]; alpar@1: /* (reserved for use in the future) */ alpar@1: } glp_mpscp; alpar@1: alpar@1: typedef struct alpar@1: { /* CPLEX LP format control parameters */ alpar@1: double foo_bar[20]; alpar@1: /* (reserved for use in the future) */ alpar@1: } glp_cpxcp; alpar@1: alpar@1: #ifndef GLP_TRAN_DEFINED alpar@1: #define GLP_TRAN_DEFINED alpar@1: typedef struct { double _opaque_tran[100]; } glp_tran; alpar@1: /* MathProg translator workspace */ alpar@1: #endif alpar@1: alpar@1: glp_prob *glp_create_prob(void); alpar@1: /* create problem object */ alpar@1: alpar@1: void glp_set_prob_name(glp_prob *P, const char *name); alpar@1: /* assign (change) problem name */ alpar@1: alpar@1: void glp_set_obj_name(glp_prob *P, const char *name); alpar@1: /* assign (change) objective function name */ alpar@1: alpar@1: void glp_set_obj_dir(glp_prob *P, int dir); alpar@1: /* set (change) optimization direction flag */ alpar@1: alpar@1: int glp_add_rows(glp_prob *P, int nrs); alpar@1: /* add new rows to problem object */ alpar@1: alpar@1: int glp_add_cols(glp_prob *P, int ncs); alpar@1: /* add new columns to problem object */ alpar@1: alpar@1: void glp_set_row_name(glp_prob *P, int i, const char *name); alpar@1: /* assign (change) row name */ alpar@1: alpar@1: void glp_set_col_name(glp_prob *P, int j, const char *name); alpar@1: /* assign (change) column name */ alpar@1: alpar@1: void glp_set_row_bnds(glp_prob *P, int i, int type, double lb, alpar@1: double ub); alpar@1: /* set (change) row bounds */ alpar@1: alpar@1: void glp_set_col_bnds(glp_prob *P, int j, int type, double lb, alpar@1: double ub); alpar@1: /* set (change) column bounds */ alpar@1: alpar@1: void glp_set_obj_coef(glp_prob *P, int j, double coef); alpar@1: /* set (change) obj. coefficient or constant term */ alpar@1: alpar@1: void glp_set_mat_row(glp_prob *P, int i, int len, const int ind[], alpar@1: const double val[]); alpar@1: /* set (replace) row of the constraint matrix */ alpar@1: alpar@1: void glp_set_mat_col(glp_prob *P, int j, int len, const int ind[], alpar@1: const double val[]); alpar@1: /* set (replace) column of the constraint matrix */ alpar@1: alpar@1: void glp_load_matrix(glp_prob *P, int ne, const int ia[], alpar@1: const int ja[], const double ar[]); alpar@1: /* load (replace) the whole constraint matrix */ alpar@1: alpar@1: int glp_check_dup(int m, int n, int ne, const int ia[], const int ja[]); alpar@1: /* check for duplicate elements in sparse matrix */ alpar@1: alpar@1: void glp_sort_matrix(glp_prob *P); alpar@1: /* sort elements of the constraint matrix */ alpar@1: alpar@1: void glp_del_rows(glp_prob *P, int nrs, const int num[]); alpar@1: /* delete specified rows from problem object */ alpar@1: alpar@1: void glp_del_cols(glp_prob *P, int ncs, const int num[]); alpar@1: /* delete specified columns from problem object */ alpar@1: alpar@1: void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names); alpar@1: /* copy problem object content */ alpar@1: alpar@1: void glp_erase_prob(glp_prob *P); alpar@1: /* erase problem object content */ alpar@1: alpar@1: void glp_delete_prob(glp_prob *P); alpar@1: /* delete problem object */ alpar@1: alpar@1: const char *glp_get_prob_name(glp_prob *P); alpar@1: /* retrieve problem name */ alpar@1: alpar@1: const char *glp_get_obj_name(glp_prob *P); alpar@1: /* retrieve objective function name */ alpar@1: alpar@1: int glp_get_obj_dir(glp_prob *P); alpar@1: /* retrieve optimization direction flag */ alpar@1: alpar@1: int glp_get_num_rows(glp_prob *P); alpar@1: /* retrieve number of rows */ alpar@1: alpar@1: int glp_get_num_cols(glp_prob *P); alpar@1: /* retrieve number of columns */ alpar@1: alpar@1: const char *glp_get_row_name(glp_prob *P, int i); alpar@1: /* retrieve row name */ alpar@1: alpar@1: const char *glp_get_col_name(glp_prob *P, int j); alpar@1: /* retrieve column name */ alpar@1: alpar@1: int glp_get_row_type(glp_prob *P, int i); alpar@1: /* retrieve row type */ alpar@1: alpar@1: double glp_get_row_lb(glp_prob *P, int i); alpar@1: /* retrieve row lower bound */ alpar@1: alpar@1: double glp_get_row_ub(glp_prob *P, int i); alpar@1: /* retrieve row upper bound */ alpar@1: alpar@1: int glp_get_col_type(glp_prob *P, int j); alpar@1: /* retrieve column type */ alpar@1: alpar@1: double glp_get_col_lb(glp_prob *P, int j); alpar@1: /* retrieve column lower bound */ alpar@1: alpar@1: double glp_get_col_ub(glp_prob *P, int j); alpar@1: /* retrieve column upper bound */ alpar@1: alpar@1: double glp_get_obj_coef(glp_prob *P, int j); alpar@1: /* retrieve obj. coefficient or constant term */ alpar@1: alpar@1: int glp_get_num_nz(glp_prob *P); alpar@1: /* retrieve number of constraint coefficients */ alpar@1: alpar@1: int glp_get_mat_row(glp_prob *P, int i, int ind[], double val[]); alpar@1: /* retrieve row of the constraint matrix */ alpar@1: alpar@1: int glp_get_mat_col(glp_prob *P, int j, int ind[], double val[]); alpar@1: /* retrieve column of the constraint matrix */ alpar@1: alpar@1: void glp_create_index(glp_prob *P); alpar@1: /* create the name index */ alpar@1: alpar@1: int glp_find_row(glp_prob *P, const char *name); alpar@1: /* find row by its name */ alpar@1: alpar@1: int glp_find_col(glp_prob *P, const char *name); alpar@1: /* find column by its name */ alpar@1: alpar@1: void glp_delete_index(glp_prob *P); alpar@1: /* delete the name index */ alpar@1: alpar@1: void glp_set_rii(glp_prob *P, int i, double rii); alpar@1: /* set (change) row scale factor */ alpar@1: alpar@1: void glp_set_sjj(glp_prob *P, int j, double sjj); alpar@1: /* set (change) column scale factor */ alpar@1: alpar@1: double glp_get_rii(glp_prob *P, int i); alpar@1: /* retrieve row scale factor */ alpar@1: alpar@1: double glp_get_sjj(glp_prob *P, int j); alpar@1: /* retrieve column scale factor */ alpar@1: alpar@1: void glp_scale_prob(glp_prob *P, int flags); alpar@1: /* scale problem data */ alpar@1: alpar@1: void glp_unscale_prob(glp_prob *P); alpar@1: /* unscale problem data */ alpar@1: alpar@1: void glp_set_row_stat(glp_prob *P, int i, int stat); alpar@1: /* set (change) row status */ alpar@1: alpar@1: void glp_set_col_stat(glp_prob *P, int j, int stat); alpar@1: /* set (change) column status */ alpar@1: alpar@1: void glp_std_basis(glp_prob *P); alpar@1: /* construct standard initial LP basis */ alpar@1: alpar@1: void glp_adv_basis(glp_prob *P, int flags); alpar@1: /* construct advanced initial LP basis */ alpar@1: alpar@1: void glp_cpx_basis(glp_prob *P); alpar@1: /* construct Bixby's initial LP basis */ alpar@1: alpar@1: int glp_simplex(glp_prob *P, const glp_smcp *parm); alpar@1: /* solve LP problem with the simplex method */ alpar@1: alpar@1: int glp_exact(glp_prob *P, const glp_smcp *parm); alpar@1: /* solve LP problem in exact arithmetic */ alpar@1: alpar@1: void glp_init_smcp(glp_smcp *parm); alpar@1: /* initialize simplex method control parameters */ alpar@1: alpar@1: int glp_get_status(glp_prob *P); alpar@1: /* retrieve generic status of basic solution */ alpar@1: alpar@1: int glp_get_prim_stat(glp_prob *P); alpar@1: /* retrieve status of primal basic solution */ alpar@1: alpar@1: int glp_get_dual_stat(glp_prob *P); alpar@1: /* retrieve status of dual basic solution */ alpar@1: alpar@1: double glp_get_obj_val(glp_prob *P); alpar@1: /* retrieve objective value (basic solution) */ alpar@1: alpar@1: int glp_get_row_stat(glp_prob *P, int i); alpar@1: /* retrieve row status */ alpar@1: alpar@1: double glp_get_row_prim(glp_prob *P, int i); alpar@1: /* retrieve row primal value (basic solution) */ alpar@1: alpar@1: double glp_get_row_dual(glp_prob *P, int i); alpar@1: /* retrieve row dual value (basic solution) */ alpar@1: alpar@1: int glp_get_col_stat(glp_prob *P, int j); alpar@1: /* retrieve column status */ alpar@1: alpar@1: double glp_get_col_prim(glp_prob *P, int j); alpar@1: /* retrieve column primal value (basic solution) */ alpar@1: alpar@1: double glp_get_col_dual(glp_prob *P, int j); alpar@1: /* retrieve column dual value (basic solution) */ alpar@1: alpar@1: int glp_get_unbnd_ray(glp_prob *P); alpar@1: /* determine variable causing unboundedness */ alpar@1: alpar@1: int glp_interior(glp_prob *P, const glp_iptcp *parm); alpar@1: /* solve LP problem with the interior-point method */ alpar@1: alpar@1: void glp_init_iptcp(glp_iptcp *parm); alpar@1: /* initialize interior-point solver control parameters */ alpar@1: alpar@1: int glp_ipt_status(glp_prob *P); alpar@1: /* retrieve status of interior-point solution */ alpar@1: alpar@1: double glp_ipt_obj_val(glp_prob *P); alpar@1: /* retrieve objective value (interior point) */ alpar@1: alpar@1: double glp_ipt_row_prim(glp_prob *P, int i); alpar@1: /* retrieve row primal value (interior point) */ alpar@1: alpar@1: double glp_ipt_row_dual(glp_prob *P, int i); alpar@1: /* retrieve row dual value (interior point) */ alpar@1: alpar@1: double glp_ipt_col_prim(glp_prob *P, int j); alpar@1: /* retrieve column primal value (interior point) */ alpar@1: alpar@1: double glp_ipt_col_dual(glp_prob *P, int j); alpar@1: /* retrieve column dual value (interior point) */ alpar@1: alpar@1: void glp_set_col_kind(glp_prob *P, int j, int kind); alpar@1: /* set (change) column kind */ alpar@1: alpar@1: int glp_get_col_kind(glp_prob *P, int j); alpar@1: /* retrieve column kind */ alpar@1: alpar@1: int glp_get_num_int(glp_prob *P); alpar@1: /* retrieve number of integer columns */ alpar@1: alpar@1: int glp_get_num_bin(glp_prob *P); alpar@1: /* retrieve number of binary columns */ alpar@1: alpar@1: int glp_intopt(glp_prob *P, const glp_iocp *parm); alpar@1: /* solve MIP problem with the branch-and-bound method */ alpar@1: alpar@1: void glp_init_iocp(glp_iocp *parm); alpar@1: /* initialize integer optimizer control parameters */ alpar@1: alpar@1: int glp_mip_status(glp_prob *P); alpar@1: /* retrieve status of MIP solution */ alpar@1: alpar@1: double glp_mip_obj_val(glp_prob *P); alpar@1: /* retrieve objective value (MIP solution) */ alpar@1: alpar@1: double glp_mip_row_val(glp_prob *P, int i); alpar@1: /* retrieve row value (MIP solution) */ alpar@1: alpar@1: double glp_mip_col_val(glp_prob *P, int j); alpar@1: /* retrieve column value (MIP solution) */ alpar@1: alpar@1: int glp_print_sol(glp_prob *P, const char *fname); alpar@1: /* write basic solution in printable format */ alpar@1: alpar@1: int glp_read_sol(glp_prob *P, const char *fname); alpar@1: /* read basic solution from text file */ alpar@1: alpar@1: int glp_write_sol(glp_prob *P, const char *fname); alpar@1: /* write basic solution to text file */ alpar@1: alpar@1: int glp_print_ranges(glp_prob *P, int len, const int list[], alpar@1: int flags, const char *fname); alpar@1: /* print sensitivity analysis report */ alpar@1: alpar@1: int glp_print_ipt(glp_prob *P, const char *fname); alpar@1: /* write interior-point solution in printable format */ alpar@1: alpar@1: int glp_read_ipt(glp_prob *P, const char *fname); alpar@1: /* read interior-point solution from text file */ alpar@1: alpar@1: int glp_write_ipt(glp_prob *P, const char *fname); alpar@1: /* write interior-point solution to text file */ alpar@1: alpar@1: int glp_print_mip(glp_prob *P, const char *fname); alpar@1: /* write MIP solution in printable format */ alpar@1: alpar@1: int glp_read_mip(glp_prob *P, const char *fname); alpar@1: /* read MIP solution from text file */ alpar@1: alpar@1: int glp_write_mip(glp_prob *P, const char *fname); alpar@1: /* write MIP solution to text file */ alpar@1: alpar@1: int glp_bf_exists(glp_prob *P); alpar@1: /* check if the basis factorization exists */ alpar@1: alpar@1: int glp_factorize(glp_prob *P); alpar@1: /* compute the basis factorization */ alpar@1: alpar@1: int glp_bf_updated(glp_prob *P); alpar@1: /* check if the basis factorization has been updated */ alpar@1: alpar@1: void glp_get_bfcp(glp_prob *P, glp_bfcp *parm); alpar@1: /* retrieve basis factorization control parameters */ alpar@1: alpar@1: void glp_set_bfcp(glp_prob *P, const glp_bfcp *parm); alpar@1: /* change basis factorization control parameters */ alpar@1: alpar@1: int glp_get_bhead(glp_prob *P, int k); alpar@1: /* retrieve the basis header information */ alpar@1: alpar@1: int glp_get_row_bind(glp_prob *P, int i); alpar@1: /* retrieve row index in the basis header */ alpar@1: alpar@1: int glp_get_col_bind(glp_prob *P, int j); alpar@1: /* retrieve column index in the basis header */ alpar@1: alpar@1: void glp_ftran(glp_prob *P, double x[]); alpar@1: /* perform forward transformation (solve system B*x = b) */ alpar@1: alpar@1: void glp_btran(glp_prob *P, double x[]); alpar@1: /* perform backward transformation (solve system B'*x = b) */ alpar@1: alpar@1: int glp_warm_up(glp_prob *P); alpar@1: /* "warm up" LP basis */ alpar@1: alpar@1: int glp_eval_tab_row(glp_prob *P, int k, int ind[], double val[]); alpar@1: /* compute row of the simplex tableau */ alpar@1: alpar@1: int glp_eval_tab_col(glp_prob *P, int k, int ind[], double val[]); alpar@1: /* compute column of the simplex tableau */ alpar@1: alpar@1: int glp_transform_row(glp_prob *P, int len, int ind[], double val[]); alpar@1: /* transform explicitly specified row */ alpar@1: alpar@1: int glp_transform_col(glp_prob *P, int len, int ind[], double val[]); alpar@1: /* transform explicitly specified column */ alpar@1: alpar@1: int glp_prim_rtest(glp_prob *P, int len, const int ind[], alpar@1: const double val[], int dir, double eps); alpar@1: /* perform primal ratio test */ alpar@1: alpar@1: int glp_dual_rtest(glp_prob *P, int len, const int ind[], alpar@1: const double val[], int dir, double eps); alpar@1: /* perform dual ratio test */ alpar@1: alpar@1: void glp_analyze_bound(glp_prob *P, int k, double *value1, int *var1, alpar@1: double *value2, int *var2); alpar@1: /* analyze active bound of non-basic variable */ alpar@1: alpar@1: void glp_analyze_coef(glp_prob *P, int k, double *coef1, int *var1, alpar@1: double *value1, double *coef2, int *var2, double *value2); alpar@1: /* analyze objective coefficient at basic variable */ alpar@1: alpar@1: int glp_ios_reason(glp_tree *T); alpar@1: /* determine reason for calling the callback routine */ alpar@1: alpar@1: glp_prob *glp_ios_get_prob(glp_tree *T); alpar@1: /* access the problem object */ alpar@1: alpar@1: void glp_ios_tree_size(glp_tree *T, int *a_cnt, int *n_cnt, alpar@1: int *t_cnt); alpar@1: /* determine size of the branch-and-bound tree */ alpar@1: alpar@1: int glp_ios_curr_node(glp_tree *T); alpar@1: /* determine current active subproblem */ alpar@1: alpar@1: int glp_ios_next_node(glp_tree *T, int p); alpar@1: /* determine next active subproblem */ alpar@1: alpar@1: int glp_ios_prev_node(glp_tree *T, int p); alpar@1: /* determine previous active subproblem */ alpar@1: alpar@1: int glp_ios_up_node(glp_tree *T, int p); alpar@1: /* determine parent subproblem */ alpar@1: alpar@1: int glp_ios_node_level(glp_tree *T, int p); alpar@1: /* determine subproblem level */ alpar@1: alpar@1: double glp_ios_node_bound(glp_tree *T, int p); alpar@1: /* determine subproblem local bound */ alpar@1: alpar@1: int glp_ios_best_node(glp_tree *T); alpar@1: /* find active subproblem with best local bound */ alpar@1: alpar@1: double glp_ios_mip_gap(glp_tree *T); alpar@1: /* compute relative MIP gap */ alpar@1: alpar@1: void *glp_ios_node_data(glp_tree *T, int p); alpar@1: /* access subproblem application-specific data */ alpar@1: alpar@1: void glp_ios_row_attr(glp_tree *T, int i, glp_attr *attr); alpar@1: /* retrieve additional row attributes */ alpar@1: alpar@1: int glp_ios_pool_size(glp_tree *T); alpar@1: /* determine current size of the cut pool */ alpar@1: alpar@1: int glp_ios_add_row(glp_tree *T, alpar@1: const char *name, int klass, int flags, int len, const int ind[], alpar@1: const double val[], int type, double rhs); alpar@1: /* add row (constraint) to the cut pool */ alpar@1: alpar@1: void glp_ios_del_row(glp_tree *T, int i); alpar@1: /* remove row (constraint) from the cut pool */ alpar@1: alpar@1: void glp_ios_clear_pool(glp_tree *T); alpar@1: /* remove all rows (constraints) from the cut pool */ alpar@1: alpar@1: int glp_ios_can_branch(glp_tree *T, int j); alpar@1: /* check if can branch upon specified variable */ alpar@1: alpar@1: void glp_ios_branch_upon(glp_tree *T, int j, int sel); alpar@1: /* choose variable to branch upon */ alpar@1: alpar@1: void glp_ios_select_node(glp_tree *T, int p); alpar@1: /* select subproblem to continue the search */ alpar@1: alpar@1: int glp_ios_heur_sol(glp_tree *T, const double x[]); alpar@1: /* provide solution found by heuristic */ alpar@1: alpar@1: void glp_ios_terminate(glp_tree *T); alpar@1: /* terminate the solution process */ alpar@1: alpar@1: void glp_init_mpscp(glp_mpscp *parm); alpar@1: /* initialize MPS format control parameters */ alpar@1: alpar@1: int glp_read_mps(glp_prob *P, int fmt, const glp_mpscp *parm, alpar@1: const char *fname); alpar@1: /* read problem data in MPS format */ alpar@1: alpar@1: int glp_write_mps(glp_prob *P, int fmt, const glp_mpscp *parm, alpar@1: const char *fname); alpar@1: /* write problem data in MPS format */ alpar@1: alpar@1: void glp_init_cpxcp(glp_cpxcp *parm); alpar@1: /* initialize CPLEX LP format control parameters */ alpar@1: alpar@1: int glp_read_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); alpar@1: /* read problem data in CPLEX LP format */ alpar@1: alpar@1: int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname); alpar@1: /* write problem data in CPLEX LP format */ alpar@1: alpar@1: int glp_read_prob(glp_prob *P, int flags, const char *fname); alpar@1: /* read problem data in GLPK format */ alpar@1: alpar@1: int glp_write_prob(glp_prob *P, int flags, const char *fname); alpar@1: /* write problem data in GLPK format */ alpar@1: alpar@1: glp_tran *glp_mpl_alloc_wksp(void); alpar@1: /* allocate the MathProg translator workspace */ alpar@1: alpar@1: int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip); alpar@1: /* read and translate model section */ alpar@1: alpar@1: int glp_mpl_read_data(glp_tran *tran, const char *fname); alpar@1: /* read and translate data section */ alpar@1: alpar@1: int glp_mpl_generate(glp_tran *tran, const char *fname); alpar@1: /* generate the model */ alpar@1: alpar@1: void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob); alpar@1: /* build LP/MIP problem instance from the model */ alpar@1: alpar@1: int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol); alpar@1: /* postsolve the model */ alpar@1: alpar@1: void glp_mpl_free_wksp(glp_tran *tran); alpar@1: /* free the MathProg translator workspace */ alpar@1: alpar@1: int glp_main(int argc, const char *argv[]); alpar@1: /* stand-alone LP/MIP solver */ alpar@1: alpar@1: /**********************************************************************/ alpar@1: alpar@1: #ifndef GLP_LONG_DEFINED alpar@1: #define GLP_LONG_DEFINED alpar@1: typedef struct { int lo, hi; } glp_long; alpar@1: /* long integer data type */ alpar@1: #endif alpar@1: alpar@1: int glp_init_env(void); alpar@1: /* initialize GLPK environment */ alpar@1: alpar@1: const char *glp_version(void); alpar@1: /* determine library version */ alpar@1: alpar@1: int glp_free_env(void); alpar@1: /* free GLPK environment */ alpar@1: alpar@1: void glp_printf(const char *fmt, ...); alpar@1: /* write formatted output to terminal */ alpar@1: alpar@1: void glp_vprintf(const char *fmt, va_list arg); alpar@1: /* write formatted output to terminal */ alpar@1: alpar@1: int glp_term_out(int flag); alpar@1: /* enable/disable terminal output */ alpar@1: alpar@1: void glp_term_hook(int (*func)(void *info, const char *s), void *info); alpar@1: /* install hook to intercept terminal output */ alpar@1: alpar@1: int glp_open_tee(const char *fname); alpar@1: /* start copying terminal output to text file */ alpar@1: alpar@1: int glp_close_tee(void); alpar@1: /* stop copying terminal output to text file */ alpar@1: alpar@1: #ifndef GLP_ERROR_DEFINED alpar@1: #define GLP_ERROR_DEFINED alpar@1: typedef void (*_glp_error)(const char *fmt, ...); alpar@1: #endif alpar@1: alpar@1: #define glp_error glp_error_(__FILE__, __LINE__) alpar@1: _glp_error glp_error_(const char *file, int line); alpar@1: /* display error message and terminate execution */ alpar@1: alpar@1: #define glp_assert(expr) \ alpar@1: ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1))) alpar@1: void glp_assert_(const char *expr, const char *file, int line); alpar@1: /* check for logical condition */ alpar@1: alpar@1: void glp_error_hook(void (*func)(void *info), void *info); alpar@1: /* install hook to intercept abnormal termination */ alpar@1: alpar@1: void *glp_malloc(int size); alpar@1: /* allocate memory block */ alpar@1: alpar@1: void *glp_calloc(int n, int size); alpar@1: /* allocate memory block */ alpar@1: alpar@1: void glp_free(void *ptr); alpar@1: /* free memory block */ alpar@1: alpar@1: void glp_mem_limit(int limit); alpar@1: /* set memory usage limit */ alpar@1: alpar@1: void glp_mem_usage(int *count, int *cpeak, glp_long *total, alpar@1: glp_long *tpeak); alpar@1: /* get memory usage information */ alpar@1: alpar@1: glp_long glp_time(void); alpar@1: /* determine current universal time */ alpar@1: alpar@1: double glp_difftime(glp_long t1, glp_long t0); alpar@1: /* compute difference between two time values */ alpar@1: alpar@1: /**********************************************************************/ alpar@1: alpar@1: #ifndef GLP_DATA_DEFINED alpar@1: #define GLP_DATA_DEFINED alpar@1: typedef struct { double _opaque_data[100]; } glp_data; alpar@1: /* plain data file */ alpar@1: #endif alpar@1: alpar@1: glp_data *glp_sdf_open_file(const char *fname); alpar@1: /* open plain data file */ alpar@1: alpar@1: void glp_sdf_set_jump(glp_data *data, void *jump); alpar@1: /* set up error handling */ alpar@1: alpar@1: void glp_sdf_error(glp_data *data, const char *fmt, ...); alpar@1: /* print error message */ alpar@1: alpar@1: void glp_sdf_warning(glp_data *data, const char *fmt, ...); alpar@1: /* print warning message */ alpar@1: alpar@1: int glp_sdf_read_int(glp_data *data); alpar@1: /* read integer number */ alpar@1: alpar@1: double glp_sdf_read_num(glp_data *data); alpar@1: /* read floating-point number */ alpar@1: alpar@1: const char *glp_sdf_read_item(glp_data *data); alpar@1: /* read data item */ alpar@1: alpar@1: const char *glp_sdf_read_text(glp_data *data); alpar@1: /* read text until end of line */ alpar@1: alpar@1: int glp_sdf_line(glp_data *data); alpar@1: /* determine current line number */ alpar@1: alpar@1: void glp_sdf_close_file(glp_data *data); alpar@1: /* close plain data file */ alpar@1: alpar@1: /**********************************************************************/ alpar@1: alpar@1: typedef struct _glp_graph glp_graph; alpar@1: typedef struct _glp_vertex glp_vertex; alpar@1: typedef struct _glp_arc glp_arc; alpar@1: alpar@1: struct _glp_graph alpar@1: { /* graph descriptor */ alpar@1: void *pool; /* DMP *pool; */ alpar@1: /* memory pool to store graph components */ alpar@1: char *name; alpar@1: /* graph name (1 to 255 chars); NULL means no name is assigned alpar@1: to the graph */ alpar@1: int nv_max; alpar@1: /* length of the vertex list (enlarged automatically) */ alpar@1: int nv; alpar@1: /* number of vertices in the graph, 0 <= nv <= nv_max */ alpar@1: int na; alpar@1: /* number of arcs in the graph, na >= 0 */ alpar@1: glp_vertex **v; /* glp_vertex *v[1+nv_max]; */ alpar@1: /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */ alpar@1: void *index; /* AVL *index; */ alpar@1: /* vertex index to find vertices by their names; NULL means the alpar@1: index does not exist */ alpar@1: int v_size; alpar@1: /* size of data associated with each vertex (0 to 256 bytes) */ alpar@1: int a_size; alpar@1: /* size of data associated with each arc (0 to 256 bytes) */ alpar@1: }; alpar@1: alpar@1: struct _glp_vertex alpar@1: { /* vertex descriptor */ alpar@1: int i; alpar@1: /* vertex ordinal number, 1 <= i <= nv */ alpar@1: char *name; alpar@1: /* vertex name (1 to 255 chars); NULL means no name is assigned alpar@1: to the vertex */ alpar@1: void *entry; /* AVLNODE *entry; */ alpar@1: /* pointer to corresponding entry in the vertex index; NULL means alpar@1: that either the index does not exist or the vertex has no name alpar@1: assigned */ alpar@1: void *data; alpar@1: /* pointer to data associated with the vertex */ alpar@1: void *temp; alpar@1: /* working pointer */ alpar@1: glp_arc *in; alpar@1: /* pointer to the (unordered) list of incoming arcs */ alpar@1: glp_arc *out; alpar@1: /* pointer to the (unordered) list of outgoing arcs */ alpar@1: }; alpar@1: alpar@1: struct _glp_arc alpar@1: { /* arc descriptor */ alpar@1: glp_vertex *tail; alpar@1: /* pointer to the tail endpoint */ alpar@1: glp_vertex *head; alpar@1: /* pointer to the head endpoint */ alpar@1: void *data; alpar@1: /* pointer to data associated with the arc */ alpar@1: void *temp; alpar@1: /* working pointer */ alpar@1: glp_arc *t_prev; alpar@1: /* pointer to previous arc having the same tail endpoint */ alpar@1: glp_arc *t_next; alpar@1: /* pointer to next arc having the same tail endpoint */ alpar@1: glp_arc *h_prev; alpar@1: /* pointer to previous arc having the same head endpoint */ alpar@1: glp_arc *h_next; alpar@1: /* pointer to next arc having the same head endpoint */ alpar@1: }; alpar@1: alpar@1: glp_graph *glp_create_graph(int v_size, int a_size); alpar@1: /* create graph */ alpar@1: alpar@1: void glp_set_graph_name(glp_graph *G, const char *name); alpar@1: /* assign (change) graph name */ alpar@1: alpar@1: int glp_add_vertices(glp_graph *G, int nadd); alpar@1: /* add new vertices to graph */ alpar@1: alpar@1: void glp_set_vertex_name(glp_graph *G, int i, const char *name); alpar@1: /* assign (change) vertex name */ alpar@1: alpar@1: glp_arc *glp_add_arc(glp_graph *G, int i, int j); alpar@1: /* add new arc to graph */ alpar@1: alpar@1: void glp_del_vertices(glp_graph *G, int ndel, const int num[]); alpar@1: /* delete vertices from graph */ alpar@1: alpar@1: void glp_del_arc(glp_graph *G, glp_arc *a); alpar@1: /* delete arc from graph */ alpar@1: alpar@1: void glp_erase_graph(glp_graph *G, int v_size, int a_size); alpar@1: /* erase graph content */ alpar@1: alpar@1: void glp_delete_graph(glp_graph *G); alpar@1: /* delete graph */ alpar@1: alpar@1: void glp_create_v_index(glp_graph *G); alpar@1: /* create vertex name index */ alpar@1: alpar@1: int glp_find_vertex(glp_graph *G, const char *name); alpar@1: /* find vertex by its name */ alpar@1: alpar@1: void glp_delete_v_index(glp_graph *G); alpar@1: /* delete vertex name index */ alpar@1: alpar@1: int glp_read_graph(glp_graph *G, const char *fname); alpar@1: /* read graph from plain text file */ alpar@1: alpar@1: int glp_write_graph(glp_graph *G, const char *fname); alpar@1: /* write graph to plain text file */ alpar@1: alpar@1: void glp_mincost_lp(glp_prob *P, glp_graph *G, int names, int v_rhs, alpar@1: int a_low, int a_cap, int a_cost); alpar@1: /* convert minimum cost flow problem to LP */ alpar@1: alpar@1: int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, alpar@1: int a_cost, double *sol, int a_x, int v_pi); alpar@1: /* find minimum-cost flow with out-of-kilter algorithm */ alpar@1: alpar@1: void glp_maxflow_lp(glp_prob *P, glp_graph *G, int names, int s, alpar@1: int t, int a_cap); alpar@1: /* convert maximum flow problem to LP */ alpar@1: alpar@1: int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, alpar@1: double *sol, int a_x, int v_cut); alpar@1: /* find maximal flow with Ford-Fulkerson algorithm */ alpar@1: alpar@1: int glp_check_asnprob(glp_graph *G, int v_set); alpar@1: /* check correctness of assignment problem data */ alpar@1: alpar@1: /* assignment problem formulation: */ alpar@1: #define GLP_ASN_MIN 1 /* perfect matching (minimization) */ alpar@1: #define GLP_ASN_MAX 2 /* perfect matching (maximization) */ alpar@1: #define GLP_ASN_MMP 3 /* maximum matching */ alpar@1: alpar@1: int glp_asnprob_lp(glp_prob *P, int form, glp_graph *G, int names, alpar@1: int v_set, int a_cost); alpar@1: /* convert assignment problem to LP */ alpar@1: alpar@1: int glp_asnprob_okalg(int form, glp_graph *G, int v_set, int a_cost, alpar@1: double *sol, int a_x); alpar@1: /* solve assignment problem with out-of-kilter algorithm */ alpar@1: alpar@1: int glp_asnprob_hall(glp_graph *G, int v_set, int a_x); alpar@1: /* find bipartite matching of maximum cardinality */ alpar@1: alpar@1: double glp_cpp(glp_graph *G, int v_t, int v_es, int v_ls); alpar@1: /* solve critical path problem */ alpar@1: alpar@1: int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, alpar@1: int a_cost, const char *fname); alpar@1: /* read min-cost flow problem data in DIMACS format */ alpar@1: alpar@1: int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, alpar@1: int a_cost, const char *fname); alpar@1: /* write min-cost flow problem data in DIMACS format */ alpar@1: alpar@1: int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, alpar@1: const char *fname); alpar@1: /* read maximum flow problem data in DIMACS format */ alpar@1: alpar@1: int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, alpar@1: const char *fname); alpar@1: /* write maximum flow problem data in DIMACS format */ alpar@1: alpar@1: int glp_read_asnprob(glp_graph *G, int v_set, int a_cost, const char alpar@1: *fname); alpar@1: /* read assignment problem data in DIMACS format */ alpar@1: alpar@1: int glp_write_asnprob(glp_graph *G, int v_set, int a_cost, const char alpar@1: *fname); alpar@1: /* write assignment problem data in DIMACS format */ alpar@1: alpar@1: int glp_read_ccdata(glp_graph *G, int v_wgt, const char *fname); alpar@1: /* read graph in DIMACS clique/coloring format */ alpar@1: alpar@1: int glp_write_ccdata(glp_graph *G, int v_wgt, const char *fname); alpar@1: /* write graph in DIMACS clique/coloring format */ alpar@1: alpar@1: int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, alpar@1: const int parm[1+15]); alpar@1: /* Klingman's network problem generator */ alpar@1: alpar@1: int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, alpar@1: const int parm[1+14]); alpar@1: /* grid-like network problem generator */ alpar@1: alpar@1: int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap, alpar@1: const int parm[1+5]); alpar@1: /* Goldfarb's maximum flow problem generator */ alpar@1: alpar@1: int glp_weak_comp(glp_graph *G, int v_num); alpar@1: /* find all weakly connected components of graph */ alpar@1: alpar@1: int glp_strong_comp(glp_graph *G, int v_num); alpar@1: /* find all strongly connected components of graph */ alpar@1: alpar@1: int glp_top_sort(glp_graph *G, int v_num); alpar@1: /* topological sorting of acyclic digraph */ alpar@1: alpar@1: int glp_wclique_exact(glp_graph *G, int v_wgt, double *sol, int v_set); alpar@1: /* find maximum weight clique with exact algorithm */ alpar@1: alpar@1: /*********************************************************************** alpar@1: * NOTE: All symbols defined below are obsolete and kept here only for alpar@1: * backward compatibility. alpar@1: ***********************************************************************/ alpar@1: alpar@1: #define LPX glp_prob alpar@1: alpar@1: /* problem class: */ alpar@1: #define LPX_LP 100 /* linear programming (LP) */ alpar@1: #define LPX_MIP 101 /* mixed integer programming (MIP) */ alpar@1: alpar@1: /* type of auxiliary/structural variable: */ alpar@1: #define LPX_FR 110 /* free variable */ alpar@1: #define LPX_LO 111 /* variable with lower bound */ alpar@1: #define LPX_UP 112 /* variable with upper bound */ alpar@1: #define LPX_DB 113 /* double-bounded variable */ alpar@1: #define LPX_FX 114 /* fixed variable */ alpar@1: alpar@1: /* optimization direction flag: */ alpar@1: #define LPX_MIN 120 /* minimization */ alpar@1: #define LPX_MAX 121 /* maximization */ alpar@1: alpar@1: /* status of primal basic solution: */ alpar@1: #define LPX_P_UNDEF 132 /* primal solution is undefined */ alpar@1: #define LPX_P_FEAS 133 /* solution is primal feasible */ alpar@1: #define LPX_P_INFEAS 134 /* solution is primal infeasible */ alpar@1: #define LPX_P_NOFEAS 135 /* no primal feasible solution exists */ alpar@1: alpar@1: /* status of dual basic solution: */ alpar@1: #define LPX_D_UNDEF 136 /* dual solution is undefined */ alpar@1: #define LPX_D_FEAS 137 /* solution is dual feasible */ alpar@1: #define LPX_D_INFEAS 138 /* solution is dual infeasible */ alpar@1: #define LPX_D_NOFEAS 139 /* no dual feasible solution exists */ alpar@1: alpar@1: /* status of auxiliary/structural variable: */ alpar@1: #define LPX_BS 140 /* basic variable */ alpar@1: #define LPX_NL 141 /* non-basic variable on lower bound */ alpar@1: #define LPX_NU 142 /* non-basic variable on upper bound */ alpar@1: #define LPX_NF 143 /* non-basic free variable */ alpar@1: #define LPX_NS 144 /* non-basic fixed variable */ alpar@1: alpar@1: /* status of interior-point solution: */ alpar@1: #define LPX_T_UNDEF 150 /* interior solution is undefined */ alpar@1: #define LPX_T_OPT 151 /* interior solution is optimal */ alpar@1: alpar@1: /* kind of structural variable: */ alpar@1: #define LPX_CV 160 /* continuous variable */ alpar@1: #define LPX_IV 161 /* integer variable */ alpar@1: alpar@1: /* status of integer solution: */ alpar@1: #define LPX_I_UNDEF 170 /* integer solution is undefined */ alpar@1: #define LPX_I_OPT 171 /* integer solution is optimal */ alpar@1: #define LPX_I_FEAS 172 /* integer solution is feasible */ alpar@1: #define LPX_I_NOFEAS 173 /* no integer solution exists */ alpar@1: alpar@1: /* status codes reported by the routine lpx_get_status: */ alpar@1: #define LPX_OPT 180 /* optimal */ alpar@1: #define LPX_FEAS 181 /* feasible */ alpar@1: #define LPX_INFEAS 182 /* infeasible */ alpar@1: #define LPX_NOFEAS 183 /* no feasible */ alpar@1: #define LPX_UNBND 184 /* unbounded */ alpar@1: #define LPX_UNDEF 185 /* undefined */ alpar@1: alpar@1: /* exit codes returned by solver routines: */ alpar@1: #define LPX_E_OK 200 /* success */ alpar@1: #define LPX_E_EMPTY 201 /* empty problem */ alpar@1: #define LPX_E_BADB 202 /* invalid initial basis */ alpar@1: #define LPX_E_INFEAS 203 /* infeasible initial solution */ alpar@1: #define LPX_E_FAULT 204 /* unable to start the search */ alpar@1: #define LPX_E_OBJLL 205 /* objective lower limit reached */ alpar@1: #define LPX_E_OBJUL 206 /* objective upper limit reached */ alpar@1: #define LPX_E_ITLIM 207 /* iterations limit exhausted */ alpar@1: #define LPX_E_TMLIM 208 /* time limit exhausted */ alpar@1: #define LPX_E_NOFEAS 209 /* no feasible solution */ alpar@1: #define LPX_E_INSTAB 210 /* numerical instability */ alpar@1: #define LPX_E_SING 211 /* problems with basis matrix */ alpar@1: #define LPX_E_NOCONV 212 /* no convergence (interior) */ alpar@1: #define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */ alpar@1: #define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */ alpar@1: #define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached */ alpar@1: alpar@1: /* control parameter identifiers: */ alpar@1: #define LPX_K_MSGLEV 300 /* lp->msg_lev */ alpar@1: #define LPX_K_SCALE 301 /* lp->scale */ alpar@1: #define LPX_K_DUAL 302 /* lp->dual */ alpar@1: #define LPX_K_PRICE 303 /* lp->price */ alpar@1: #define LPX_K_RELAX 304 /* lp->relax */ alpar@1: #define LPX_K_TOLBND 305 /* lp->tol_bnd */ alpar@1: #define LPX_K_TOLDJ 306 /* lp->tol_dj */ alpar@1: #define LPX_K_TOLPIV 307 /* lp->tol_piv */ alpar@1: #define LPX_K_ROUND 308 /* lp->round */ alpar@1: #define LPX_K_OBJLL 309 /* lp->obj_ll */ alpar@1: #define LPX_K_OBJUL 310 /* lp->obj_ul */ alpar@1: #define LPX_K_ITLIM 311 /* lp->it_lim */ alpar@1: #define LPX_K_ITCNT 312 /* lp->it_cnt */ alpar@1: #define LPX_K_TMLIM 313 /* lp->tm_lim */ alpar@1: #define LPX_K_OUTFRQ 314 /* lp->out_frq */ alpar@1: #define LPX_K_OUTDLY 315 /* lp->out_dly */ alpar@1: #define LPX_K_BRANCH 316 /* lp->branch */ alpar@1: #define LPX_K_BTRACK 317 /* lp->btrack */ alpar@1: #define LPX_K_TOLINT 318 /* lp->tol_int */ alpar@1: #define LPX_K_TOLOBJ 319 /* lp->tol_obj */ alpar@1: #define LPX_K_MPSINFO 320 /* lp->mps_info */ alpar@1: #define LPX_K_MPSOBJ 321 /* lp->mps_obj */ alpar@1: #define LPX_K_MPSORIG 322 /* lp->mps_orig */ alpar@1: #define LPX_K_MPSWIDE 323 /* lp->mps_wide */ alpar@1: #define LPX_K_MPSFREE 324 /* lp->mps_free */ alpar@1: #define LPX_K_MPSSKIP 325 /* lp->mps_skip */ alpar@1: #define LPX_K_LPTORIG 326 /* lp->lpt_orig */ alpar@1: #define LPX_K_PRESOL 327 /* lp->presol */ alpar@1: #define LPX_K_BINARIZE 328 /* lp->binarize */ alpar@1: #define LPX_K_USECUTS 329 /* lp->use_cuts */ alpar@1: #define LPX_K_BFTYPE 330 /* lp->bfcp->type */ alpar@1: #define LPX_K_MIPGAP 331 /* lp->mip_gap */ alpar@1: alpar@1: #define LPX_C_COVER 0x01 /* mixed cover cuts */ alpar@1: #define LPX_C_CLIQUE 0x02 /* clique cuts */ alpar@1: #define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */ alpar@1: #define LPX_C_MIR 0x08 /* mixed integer rounding cuts */ alpar@1: #define LPX_C_ALL 0xFF /* all cuts */ alpar@1: alpar@1: typedef struct alpar@1: { /* this structure contains results reported by the routines which alpar@1: checks Karush-Kuhn-Tucker conditions (for details see comments alpar@1: to those routines) */ alpar@1: /*--------------------------------------------------------------*/ alpar@1: /* xR - A * xS = 0 (KKT.PE) */ alpar@1: double pe_ae_max; alpar@1: /* largest absolute error */ alpar@1: int pe_ae_row; alpar@1: /* number of row with largest absolute error */ alpar@1: double pe_re_max; alpar@1: /* largest relative error */ alpar@1: int pe_re_row; alpar@1: /* number of row with largest relative error */ alpar@1: int pe_quality; alpar@1: /* quality of primal solution: alpar@1: 'H' - high alpar@1: 'M' - medium alpar@1: 'L' - low alpar@1: '?' - primal solution is wrong */ alpar@1: /*--------------------------------------------------------------*/ alpar@1: /* l[k] <= x[k] <= u[k] (KKT.PB) */ alpar@1: double pb_ae_max; alpar@1: /* largest absolute error */ alpar@1: int pb_ae_ind; alpar@1: /* number of variable with largest absolute error */ alpar@1: double pb_re_max; alpar@1: /* largest relative error */ alpar@1: int pb_re_ind; alpar@1: /* number of variable with largest relative error */ alpar@1: int pb_quality; alpar@1: /* quality of primal feasibility: alpar@1: 'H' - high alpar@1: 'M' - medium alpar@1: 'L' - low alpar@1: '?' - primal solution is infeasible */ alpar@1: /*--------------------------------------------------------------*/ alpar@1: /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */ alpar@1: double de_ae_max; alpar@1: /* largest absolute error */ alpar@1: int de_ae_col; alpar@1: /* number of column with largest absolute error */ alpar@1: double de_re_max; alpar@1: /* largest relative error */ alpar@1: int de_re_col; alpar@1: /* number of column with largest relative error */ alpar@1: int de_quality; alpar@1: /* quality of dual solution: alpar@1: 'H' - high alpar@1: 'M' - medium alpar@1: 'L' - low alpar@1: '?' - dual solution is wrong */ alpar@1: /*--------------------------------------------------------------*/ alpar@1: /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */ alpar@1: double db_ae_max; alpar@1: /* largest absolute error */ alpar@1: int db_ae_ind; alpar@1: /* number of variable with largest absolute error */ alpar@1: double db_re_max; alpar@1: /* largest relative error */ alpar@1: int db_re_ind; alpar@1: /* number of variable with largest relative error */ alpar@1: int db_quality; alpar@1: /* quality of dual feasibility: alpar@1: 'H' - high alpar@1: 'M' - medium alpar@1: 'L' - low alpar@1: '?' - dual solution is infeasible */ alpar@1: /*--------------------------------------------------------------*/ alpar@1: /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */ alpar@1: double cs_ae_max; alpar@1: /* largest absolute error */ alpar@1: int cs_ae_ind; alpar@1: /* number of variable with largest absolute error */ alpar@1: double cs_re_max; alpar@1: /* largest relative error */ alpar@1: int cs_re_ind; alpar@1: /* number of variable with largest relative error */ alpar@1: int cs_quality; alpar@1: /* quality of complementary slackness: alpar@1: 'H' - high alpar@1: 'M' - medium alpar@1: 'L' - low alpar@1: '?' - primal and dual solutions are not complementary */ alpar@1: } LPXKKT; alpar@1: alpar@1: #define lpx_create_prob _glp_lpx_create_prob alpar@1: LPX *lpx_create_prob(void); alpar@1: /* create problem object */ alpar@1: alpar@1: #define lpx_set_prob_name _glp_lpx_set_prob_name alpar@1: void lpx_set_prob_name(LPX *lp, const char *name); alpar@1: /* assign (change) problem name */ alpar@1: alpar@1: #define lpx_set_obj_name _glp_lpx_set_obj_name alpar@1: void lpx_set_obj_name(LPX *lp, const char *name); alpar@1: /* assign (change) objective function name */ alpar@1: alpar@1: #define lpx_set_obj_dir _glp_lpx_set_obj_dir alpar@1: void lpx_set_obj_dir(LPX *lp, int dir); alpar@1: /* set (change) optimization direction flag */ alpar@1: alpar@1: #define lpx_add_rows _glp_lpx_add_rows alpar@1: int lpx_add_rows(LPX *lp, int nrs); alpar@1: /* add new rows to problem object */ alpar@1: alpar@1: #define lpx_add_cols _glp_lpx_add_cols alpar@1: int lpx_add_cols(LPX *lp, int ncs); alpar@1: /* add new columns to problem object */ alpar@1: alpar@1: #define lpx_set_row_name _glp_lpx_set_row_name alpar@1: void lpx_set_row_name(LPX *lp, int i, const char *name); alpar@1: /* assign (change) row name */ alpar@1: alpar@1: #define lpx_set_col_name _glp_lpx_set_col_name alpar@1: void lpx_set_col_name(LPX *lp, int j, const char *name); alpar@1: /* assign (change) column name */ alpar@1: alpar@1: #define lpx_set_row_bnds _glp_lpx_set_row_bnds alpar@1: void lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub); alpar@1: /* set (change) row bounds */ alpar@1: alpar@1: #define lpx_set_col_bnds _glp_lpx_set_col_bnds alpar@1: void lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub); alpar@1: /* set (change) column bounds */ alpar@1: alpar@1: #define lpx_set_obj_coef _glp_lpx_set_obj_coef alpar@1: void lpx_set_obj_coef(glp_prob *lp, int j, double coef); alpar@1: /* set (change) obj. coefficient or constant term */ alpar@1: alpar@1: #define lpx_set_mat_row _glp_lpx_set_mat_row alpar@1: void lpx_set_mat_row(LPX *lp, int i, int len, const int ind[], alpar@1: const double val[]); alpar@1: /* set (replace) row of the constraint matrix */ alpar@1: alpar@1: #define lpx_set_mat_col _glp_lpx_set_mat_col alpar@1: void lpx_set_mat_col(LPX *lp, int j, int len, const int ind[], alpar@1: const double val[]); alpar@1: /* set (replace) column of the constraint matrix */ alpar@1: alpar@1: #define lpx_load_matrix _glp_lpx_load_matrix alpar@1: void lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[], alpar@1: const double ar[]); alpar@1: /* load (replace) the whole constraint matrix */ alpar@1: alpar@1: #define lpx_del_rows _glp_lpx_del_rows alpar@1: void lpx_del_rows(LPX *lp, int nrs, const int num[]); alpar@1: /* delete specified rows from problem object */ alpar@1: alpar@1: #define lpx_del_cols _glp_lpx_del_cols alpar@1: void lpx_del_cols(LPX *lp, int ncs, const int num[]); alpar@1: /* delete specified columns from problem object */ alpar@1: alpar@1: #define lpx_delete_prob _glp_lpx_delete_prob alpar@1: void lpx_delete_prob(LPX *lp); alpar@1: /* delete problem object */ alpar@1: alpar@1: #define lpx_get_prob_name _glp_lpx_get_prob_name alpar@1: const char *lpx_get_prob_name(LPX *lp); alpar@1: /* retrieve problem name */ alpar@1: alpar@1: #define lpx_get_obj_name _glp_lpx_get_obj_name alpar@1: const char *lpx_get_obj_name(LPX *lp); alpar@1: /* retrieve objective function name */ alpar@1: alpar@1: #define lpx_get_obj_dir _glp_lpx_get_obj_dir alpar@1: int lpx_get_obj_dir(LPX *lp); alpar@1: /* retrieve optimization direction flag */ alpar@1: alpar@1: #define lpx_get_num_rows _glp_lpx_get_num_rows alpar@1: int lpx_get_num_rows(LPX *lp); alpar@1: /* retrieve number of rows */ alpar@1: alpar@1: #define lpx_get_num_cols _glp_lpx_get_num_cols alpar@1: int lpx_get_num_cols(LPX *lp); alpar@1: /* retrieve number of columns */ alpar@1: alpar@1: #define lpx_get_row_name _glp_lpx_get_row_name alpar@1: const char *lpx_get_row_name(LPX *lp, int i); alpar@1: /* retrieve row name */ alpar@1: alpar@1: #define lpx_get_col_name _glp_lpx_get_col_name alpar@1: const char *lpx_get_col_name(LPX *lp, int j); alpar@1: /* retrieve column name */ alpar@1: alpar@1: #define lpx_get_row_type _glp_lpx_get_row_type alpar@1: int lpx_get_row_type(LPX *lp, int i); alpar@1: /* retrieve row type */ alpar@1: alpar@1: #define lpx_get_row_lb _glp_lpx_get_row_lb alpar@1: double lpx_get_row_lb(LPX *lp, int i); alpar@1: /* retrieve row lower bound */ alpar@1: alpar@1: #define lpx_get_row_ub _glp_lpx_get_row_ub alpar@1: double lpx_get_row_ub(LPX *lp, int i); alpar@1: /* retrieve row upper bound */ alpar@1: alpar@1: #define lpx_get_row_bnds _glp_lpx_get_row_bnds alpar@1: void lpx_get_row_bnds(LPX *lp, int i, int *typx, double *lb, alpar@1: double *ub); alpar@1: /* retrieve row bounds */ alpar@1: alpar@1: #define lpx_get_col_type _glp_lpx_get_col_type alpar@1: int lpx_get_col_type(LPX *lp, int j); alpar@1: /* retrieve column type */ alpar@1: alpar@1: #define lpx_get_col_lb _glp_lpx_get_col_lb alpar@1: double lpx_get_col_lb(LPX *lp, int j); alpar@1: /* retrieve column lower bound */ alpar@1: alpar@1: #define lpx_get_col_ub _glp_lpx_get_col_ub alpar@1: double lpx_get_col_ub(LPX *lp, int j); alpar@1: /* retrieve column upper bound */ alpar@1: alpar@1: #define lpx_get_col_bnds _glp_lpx_get_col_bnds alpar@1: void lpx_get_col_bnds(LPX *lp, int j, int *typx, double *lb, alpar@1: double *ub); alpar@1: /* retrieve column bounds */ alpar@1: alpar@1: #define lpx_get_obj_coef _glp_lpx_get_obj_coef alpar@1: double lpx_get_obj_coef(LPX *lp, int j); alpar@1: /* retrieve obj. coefficient or constant term */ alpar@1: alpar@1: #define lpx_get_num_nz _glp_lpx_get_num_nz alpar@1: int lpx_get_num_nz(LPX *lp); alpar@1: /* retrieve number of constraint coefficients */ alpar@1: alpar@1: #define lpx_get_mat_row _glp_lpx_get_mat_row alpar@1: int lpx_get_mat_row(LPX *lp, int i, int ind[], double val[]); alpar@1: /* retrieve row of the constraint matrix */ alpar@1: alpar@1: #define lpx_get_mat_col _glp_lpx_get_mat_col alpar@1: int lpx_get_mat_col(LPX *lp, int j, int ind[], double val[]); alpar@1: /* retrieve column of the constraint matrix */ alpar@1: alpar@1: #define lpx_create_index _glp_lpx_create_index alpar@1: void lpx_create_index(LPX *lp); alpar@1: /* create the name index */ alpar@1: alpar@1: #define lpx_find_row _glp_lpx_find_row alpar@1: int lpx_find_row(LPX *lp, const char *name); alpar@1: /* find row by its name */ alpar@1: alpar@1: #define lpx_find_col _glp_lpx_find_col alpar@1: int lpx_find_col(LPX *lp, const char *name); alpar@1: /* find column by its name */ alpar@1: alpar@1: #define lpx_delete_index _glp_lpx_delete_index alpar@1: void lpx_delete_index(LPX *lp); alpar@1: /* delete the name index */ alpar@1: alpar@1: #define lpx_scale_prob _glp_lpx_scale_prob alpar@1: void lpx_scale_prob(LPX *lp); alpar@1: /* scale problem data */ alpar@1: alpar@1: #define lpx_unscale_prob _glp_lpx_unscale_prob alpar@1: void lpx_unscale_prob(LPX *lp); alpar@1: /* unscale problem data */ alpar@1: alpar@1: #define lpx_set_row_stat _glp_lpx_set_row_stat alpar@1: void lpx_set_row_stat(LPX *lp, int i, int stat); alpar@1: /* set (change) row status */ alpar@1: alpar@1: #define lpx_set_col_stat _glp_lpx_set_col_stat alpar@1: void lpx_set_col_stat(LPX *lp, int j, int stat); alpar@1: /* set (change) column status */ alpar@1: alpar@1: #define lpx_std_basis _glp_lpx_std_basis alpar@1: void lpx_std_basis(LPX *lp); alpar@1: /* construct standard initial LP basis */ alpar@1: alpar@1: #define lpx_adv_basis _glp_lpx_adv_basis alpar@1: void lpx_adv_basis(LPX *lp); alpar@1: /* construct advanced initial LP basis */ alpar@1: alpar@1: #define lpx_cpx_basis _glp_lpx_cpx_basis alpar@1: void lpx_cpx_basis(LPX *lp); alpar@1: /* construct Bixby's initial LP basis */ alpar@1: alpar@1: #define lpx_simplex _glp_lpx_simplex alpar@1: int lpx_simplex(LPX *lp); alpar@1: /* easy-to-use driver to the simplex method */ alpar@1: alpar@1: #define lpx_exact _glp_lpx_exact alpar@1: int lpx_exact(LPX *lp); alpar@1: /* easy-to-use driver to the exact simplex method */ alpar@1: alpar@1: #define lpx_get_status _glp_lpx_get_status alpar@1: int lpx_get_status(LPX *lp); alpar@1: /* retrieve generic status of basic solution */ alpar@1: alpar@1: #define lpx_get_prim_stat _glp_lpx_get_prim_stat alpar@1: int lpx_get_prim_stat(LPX *lp); alpar@1: /* retrieve primal status of basic solution */ alpar@1: alpar@1: #define lpx_get_dual_stat _glp_lpx_get_dual_stat alpar@1: int lpx_get_dual_stat(LPX *lp); alpar@1: /* retrieve dual status of basic solution */ alpar@1: alpar@1: #define lpx_get_obj_val _glp_lpx_get_obj_val alpar@1: double lpx_get_obj_val(LPX *lp); alpar@1: /* retrieve objective value (basic solution) */ alpar@1: alpar@1: #define lpx_get_row_stat _glp_lpx_get_row_stat alpar@1: int lpx_get_row_stat(LPX *lp, int i); alpar@1: /* retrieve row status (basic solution) */ alpar@1: alpar@1: #define lpx_get_row_prim _glp_lpx_get_row_prim alpar@1: double lpx_get_row_prim(LPX *lp, int i); alpar@1: /* retrieve row primal value (basic solution) */ alpar@1: alpar@1: #define lpx_get_row_dual _glp_lpx_get_row_dual alpar@1: double lpx_get_row_dual(LPX *lp, int i); alpar@1: /* retrieve row dual value (basic solution) */ alpar@1: alpar@1: #define lpx_get_row_info _glp_lpx_get_row_info alpar@1: void lpx_get_row_info(LPX *lp, int i, int *tagx, double *vx, alpar@1: double *dx); alpar@1: /* obtain row solution information */ alpar@1: alpar@1: #define lpx_get_col_stat _glp_lpx_get_col_stat alpar@1: int lpx_get_col_stat(LPX *lp, int j); alpar@1: /* retrieve column status (basic solution) */ alpar@1: alpar@1: #define lpx_get_col_prim _glp_lpx_get_col_prim alpar@1: double lpx_get_col_prim(LPX *lp, int j); alpar@1: /* retrieve column primal value (basic solution) */ alpar@1: alpar@1: #define lpx_get_col_dual _glp_lpx_get_col_dual alpar@1: double lpx_get_col_dual(glp_prob *lp, int j); alpar@1: /* retrieve column dual value (basic solution) */ alpar@1: alpar@1: #define lpx_get_col_info _glp_lpx_get_col_info alpar@1: void lpx_get_col_info(LPX *lp, int j, int *tagx, double *vx, alpar@1: double *dx); alpar@1: /* obtain column solution information (obsolete) */ alpar@1: alpar@1: #define lpx_get_ray_info _glp_lpx_get_ray_info alpar@1: int lpx_get_ray_info(LPX *lp); alpar@1: /* determine what causes primal unboundness */ alpar@1: alpar@1: #define lpx_check_kkt _glp_lpx_check_kkt alpar@1: void lpx_check_kkt(LPX *lp, int scaled, LPXKKT *kkt); alpar@1: /* check Karush-Kuhn-Tucker conditions */ alpar@1: alpar@1: #define lpx_warm_up _glp_lpx_warm_up alpar@1: int lpx_warm_up(LPX *lp); alpar@1: /* "warm up" LP basis */ alpar@1: alpar@1: #define lpx_eval_tab_row _glp_lpx_eval_tab_row alpar@1: int lpx_eval_tab_row(LPX *lp, int k, int ind[], double val[]); alpar@1: /* compute row of the simplex table */ alpar@1: alpar@1: #define lpx_eval_tab_col _glp_lpx_eval_tab_col alpar@1: int lpx_eval_tab_col(LPX *lp, int k, int ind[], double val[]); alpar@1: /* compute column of the simplex table */ alpar@1: alpar@1: #define lpx_transform_row _glp_lpx_transform_row alpar@1: int lpx_transform_row(LPX *lp, int len, int ind[], double val[]); alpar@1: /* transform explicitly specified row */ alpar@1: alpar@1: #define lpx_transform_col _glp_lpx_transform_col alpar@1: int lpx_transform_col(LPX *lp, int len, int ind[], double val[]); alpar@1: /* transform explicitly specified column */ alpar@1: alpar@1: #define lpx_prim_ratio_test _glp_lpx_prim_ratio_test alpar@1: int lpx_prim_ratio_test(LPX *lp, int len, const int ind[], alpar@1: const double val[], int how, double tol); alpar@1: /* perform primal ratio test */ alpar@1: alpar@1: #define lpx_dual_ratio_test _glp_lpx_dual_ratio_test alpar@1: int lpx_dual_ratio_test(LPX *lp, int len, const int ind[], alpar@1: const double val[], int how, double tol); alpar@1: /* perform dual ratio test */ alpar@1: alpar@1: #define lpx_interior _glp_lpx_interior alpar@1: int lpx_interior(LPX *lp); alpar@1: /* easy-to-use driver to the interior point method */ alpar@1: alpar@1: #define lpx_ipt_status _glp_lpx_ipt_status alpar@1: int lpx_ipt_status(LPX *lp); alpar@1: /* retrieve status of interior-point solution */ alpar@1: alpar@1: #define lpx_ipt_obj_val _glp_lpx_ipt_obj_val alpar@1: double lpx_ipt_obj_val(LPX *lp); alpar@1: /* retrieve objective value (interior point) */ alpar@1: alpar@1: #define lpx_ipt_row_prim _glp_lpx_ipt_row_prim alpar@1: double lpx_ipt_row_prim(LPX *lp, int i); alpar@1: /* retrieve row primal value (interior point) */ alpar@1: alpar@1: #define lpx_ipt_row_dual _glp_lpx_ipt_row_dual alpar@1: double lpx_ipt_row_dual(LPX *lp, int i); alpar@1: /* retrieve row dual value (interior point) */ alpar@1: alpar@1: #define lpx_ipt_col_prim _glp_lpx_ipt_col_prim alpar@1: double lpx_ipt_col_prim(LPX *lp, int j); alpar@1: /* retrieve column primal value (interior point) */ alpar@1: alpar@1: #define lpx_ipt_col_dual _glp_lpx_ipt_col_dual alpar@1: double lpx_ipt_col_dual(LPX *lp, int j); alpar@1: /* retrieve column dual value (interior point) */ alpar@1: alpar@1: #define lpx_set_class _glp_lpx_set_class alpar@1: void lpx_set_class(LPX *lp, int klass); alpar@1: /* set problem class */ alpar@1: alpar@1: #define lpx_get_class _glp_lpx_get_class alpar@1: int lpx_get_class(LPX *lp); alpar@1: /* determine problem klass */ alpar@1: alpar@1: #define lpx_set_col_kind _glp_lpx_set_col_kind alpar@1: void lpx_set_col_kind(LPX *lp, int j, int kind); alpar@1: /* set (change) column kind */ alpar@1: alpar@1: #define lpx_get_col_kind _glp_lpx_get_col_kind alpar@1: int lpx_get_col_kind(LPX *lp, int j); alpar@1: /* retrieve column kind */ alpar@1: alpar@1: #define lpx_get_num_int _glp_lpx_get_num_int alpar@1: int lpx_get_num_int(LPX *lp); alpar@1: /* retrieve number of integer columns */ alpar@1: alpar@1: #define lpx_get_num_bin _glp_lpx_get_num_bin alpar@1: int lpx_get_num_bin(LPX *lp); alpar@1: /* retrieve number of binary columns */ alpar@1: alpar@1: #define lpx_integer _glp_lpx_integer alpar@1: int lpx_integer(LPX *lp); alpar@1: /* easy-to-use driver to the branch-and-bound method */ alpar@1: alpar@1: #define lpx_intopt _glp_lpx_intopt alpar@1: int lpx_intopt(LPX *lp); alpar@1: /* easy-to-use driver to the branch-and-bound method */ alpar@1: alpar@1: #define lpx_mip_status _glp_lpx_mip_status alpar@1: int lpx_mip_status(LPX *lp); alpar@1: /* retrieve status of MIP solution */ alpar@1: alpar@1: #define lpx_mip_obj_val _glp_lpx_mip_obj_val alpar@1: double lpx_mip_obj_val(LPX *lp); alpar@1: /* retrieve objective value (MIP solution) */ alpar@1: alpar@1: #define lpx_mip_row_val _glp_lpx_mip_row_val alpar@1: double lpx_mip_row_val(LPX *lp, int i); alpar@1: /* retrieve row value (MIP solution) */ alpar@1: alpar@1: #define lpx_mip_col_val _glp_lpx_mip_col_val alpar@1: double lpx_mip_col_val(LPX *lp, int j); alpar@1: /* retrieve column value (MIP solution) */ alpar@1: alpar@1: #define lpx_check_int _glp_lpx_check_int alpar@1: void lpx_check_int(LPX *lp, LPXKKT *kkt); alpar@1: /* check integer feasibility conditions */ alpar@1: alpar@1: #define lpx_reset_parms _glp_lpx_reset_parms alpar@1: void lpx_reset_parms(LPX *lp); alpar@1: /* reset control parameters to default values */ alpar@1: alpar@1: #define lpx_set_int_parm _glp_lpx_set_int_parm alpar@1: void lpx_set_int_parm(LPX *lp, int parm, int val); alpar@1: /* set (change) integer control parameter */ alpar@1: alpar@1: #define lpx_get_int_parm _glp_lpx_get_int_parm alpar@1: int lpx_get_int_parm(LPX *lp, int parm); alpar@1: /* query integer control parameter */ alpar@1: alpar@1: #define lpx_set_real_parm _glp_lpx_set_real_parm alpar@1: void lpx_set_real_parm(LPX *lp, int parm, double val); alpar@1: /* set (change) real control parameter */ alpar@1: alpar@1: #define lpx_get_real_parm _glp_lpx_get_real_parm alpar@1: double lpx_get_real_parm(LPX *lp, int parm); alpar@1: /* query real control parameter */ alpar@1: alpar@1: #define lpx_read_mps _glp_lpx_read_mps alpar@1: LPX *lpx_read_mps(const char *fname); alpar@1: /* read problem data in fixed MPS format */ alpar@1: alpar@1: #define lpx_write_mps _glp_lpx_write_mps alpar@1: int lpx_write_mps(LPX *lp, const char *fname); alpar@1: /* write problem data in fixed MPS format */ alpar@1: alpar@1: #define lpx_read_bas _glp_lpx_read_bas alpar@1: int lpx_read_bas(LPX *lp, const char *fname); alpar@1: /* read LP basis in fixed MPS format */ alpar@1: alpar@1: #define lpx_write_bas _glp_lpx_write_bas alpar@1: int lpx_write_bas(LPX *lp, const char *fname); alpar@1: /* write LP basis in fixed MPS format */ alpar@1: alpar@1: #define lpx_read_freemps _glp_lpx_read_freemps alpar@1: LPX *lpx_read_freemps(const char *fname); alpar@1: /* read problem data in free MPS format */ alpar@1: alpar@1: #define lpx_write_freemps _glp_lpx_write_freemps alpar@1: int lpx_write_freemps(LPX *lp, const char *fname); alpar@1: /* write problem data in free MPS format */ alpar@1: alpar@1: #define lpx_read_cpxlp _glp_lpx_read_cpxlp alpar@1: LPX *lpx_read_cpxlp(const char *fname); alpar@1: /* read problem data in CPLEX LP format */ alpar@1: alpar@1: #define lpx_write_cpxlp _glp_lpx_write_cpxlp alpar@1: int lpx_write_cpxlp(LPX *lp, const char *fname); alpar@1: /* write problem data in CPLEX LP format */ alpar@1: alpar@1: #define lpx_read_model _glp_lpx_read_model alpar@1: LPX *lpx_read_model(const char *model, const char *data, alpar@1: const char *output); alpar@1: /* read LP/MIP model written in GNU MathProg language */ alpar@1: alpar@1: #define lpx_print_prob _glp_lpx_print_prob alpar@1: int lpx_print_prob(LPX *lp, const char *fname); alpar@1: /* write problem data in plain text format */ alpar@1: alpar@1: #define lpx_print_sol _glp_lpx_print_sol alpar@1: int lpx_print_sol(LPX *lp, const char *fname); alpar@1: /* write LP problem solution in printable format */ alpar@1: alpar@1: #define lpx_print_sens_bnds _glp_lpx_print_sens_bnds alpar@1: int lpx_print_sens_bnds(LPX *lp, const char *fname); alpar@1: /* write bounds sensitivity information */ alpar@1: alpar@1: #define lpx_print_ips _glp_lpx_print_ips alpar@1: int lpx_print_ips(LPX *lp, const char *fname); alpar@1: /* write interior point solution in printable format */ alpar@1: alpar@1: #define lpx_print_mip _glp_lpx_print_mip alpar@1: int lpx_print_mip(LPX *lp, const char *fname); alpar@1: /* write MIP problem solution in printable format */ alpar@1: alpar@1: #define lpx_is_b_avail _glp_lpx_is_b_avail alpar@1: int lpx_is_b_avail(LPX *lp); alpar@1: /* check if LP basis is available */ alpar@1: alpar@1: #define lpx_write_pb _glp_lpx_write_pb alpar@1: int lpx_write_pb(LPX *lp, const char *fname, int normalized, alpar@1: int binarize); alpar@1: /* write problem data in (normalized) OPB format */ alpar@1: alpar@1: #define lpx_main _glp_lpx_main alpar@1: int lpx_main(int argc, const char *argv[]); alpar@1: /* stand-alone LP/MIP solver */ alpar@1: alpar@1: #ifdef __cplusplus alpar@1: } alpar@1: #endif alpar@1: alpar@1: #endif alpar@1: alpar@1: /* eof */