?? glpk.h
字號(hào):
/* glpk.h *//************************************************************************ This code is part of GLPK (GNU Linear Programming Kit).** Copyright (C) 2000,01,02,03,04,05,06,07,08,2009 Andrew Makhorin,* Department for Applied Informatics, Moscow Aviation Institute,* Moscow, Russia. All rights reserved. E-mail: <mao@mai2.rcnet.ru>.** GLPK is free software: you can redistribute it and/or modify it* under the terms of the GNU General Public License as published by* the Free Software Foundation, either version 3 of the License, or* (at your option) any later version.** GLPK is distributed in the hope that it will be useful, but WITHOUT* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public* License for more details.** You should have received a copy of the GNU General Public License* along with GLPK. If not, see <http://www.gnu.org/licenses/>.***********************************************************************/#ifndef _GLPK_H#define _GLPK_H#ifdef __cplusplusextern "C" {#endif/* library version numbers: */#define GLP_MAJOR_VERSION 4#define GLP_MINOR_VERSION 36#ifndef _GLP_PROB#define _GLP_PROBtypedef struct { double _opaque_prob; } glp_prob;/* LP/MIP problem object */#endif/* optimization direction flag: */#define GLP_MIN 1 /* minimization */#define GLP_MAX 2 /* maximization *//* kind of structural variable: */#define GLP_CV 1 /* continuous variable */#define GLP_IV 2 /* integer variable */#define GLP_BV 3 /* binary variable *//* type of auxiliary/structural variable: */#define GLP_FR 1 /* free variable */#define GLP_LO 2 /* variable with lower bound */#define GLP_UP 3 /* variable with upper bound */#define GLP_DB 4 /* double-bounded variable */#define GLP_FX 5 /* fixed variable *//* status of auxiliary/structural variable: */#define GLP_BS 1 /* basic variable */#define GLP_NL 2 /* non-basic variable on lower bound */#define GLP_NU 3 /* non-basic variable on upper bound */#define GLP_NF 4 /* non-basic free variable */#define GLP_NS 5 /* non-basic fixed variable *//* scaling options: */#define GLP_SF_GM 0x01 /* perform geometric mean scaling */#define GLP_SF_EQ 0x10 /* perform equilibration scaling */#define GLP_SF_2N 0x20 /* round scale factors to power of two */#define GLP_SF_SKIP 0x40 /* skip if problem is well scaled */#define GLP_SF_AUTO 0x80 /* choose scaling options automatically *//* solution indicator: */#define GLP_SOL 1 /* basic solution */#define GLP_IPT 2 /* interior-point solution */#define GLP_MIP 3 /* mixed integer solution *//* solution status: */#define GLP_UNDEF 1 /* solution is undefined */#define GLP_FEAS 2 /* solution is feasible */#define GLP_INFEAS 3 /* solution is infeasible */#define GLP_NOFEAS 4 /* no feasible solution exists */#define GLP_OPT 5 /* solution is optimal */#define GLP_UNBND 6 /* solution is unbounded */typedef struct { int lo, hi; } glp_long;/* long integer data type */#ifndef _GLP_BFCP#define _GLP_BFCPtypedef struct glp_bfcp glp_bfcp;#endifstruct glp_bfcp{ /* basis factorization control parameters */ int msg_lev; /* (reserved) */ int type; /* factorization type: */#define GLP_BF_FT 1 /* LUF + Forrest-Tomlin */#define GLP_BF_BG 2 /* LUF + Schur compl. + Bartels-Golub */#define GLP_BF_GR 3 /* LUF + Schur compl. + Givens rotation */ int lu_size; /* luf.sv_size */ double piv_tol; /* luf.piv_tol */ int piv_lim; /* luf.piv_lim */ int suhl; /* luf.suhl */ double eps_tol; /* luf.eps_tol */ double max_gro; /* luf.max_gro */ int nfs_max; /* fhv.hh_max */ double upd_tol; /* fhv.upd_tol */ int nrs_max; /* lpf.n_max */ int rs_size; /* lpf.v_size */ double foo_bar[38]; /* (reserved) */};typedef struct{ /* simplex method control parameters */ int msg_lev; /* message level: */#define GLP_MSG_OFF 0 /* no output */#define GLP_MSG_ERR 1 /* warning and error messages only */#define GLP_MSG_ON 2 /* normal output */#define GLP_MSG_ALL 3 /* full output */#define GLP_MSG_DBG 4 /* debug output */ int meth; /* simplex method option: */#define GLP_PRIMAL 1 /* use primal simplex */#define GLP_DUALP 2 /* use dual; if it fails, use primal */#define GLP_DUAL 3 /* use dual simplex */ int pricing; /* pricing technique: */#define GLP_PT_STD 0x11 /* standard (Dantzig rule) */#define GLP_PT_PSE 0x22 /* projected steepest edge */ int r_test; /* ratio test technique: */#define GLP_RT_STD 0x11 /* standard (textbook) */#define GLP_RT_HAR 0x22 /* two-pass Harris' ratio test */ double tol_bnd; /* spx.tol_bnd */ double tol_dj; /* spx.tol_dj */ double tol_piv; /* spx.tol_piv */ double obj_ll; /* spx.obj_ll */ double obj_ul; /* spx.obj_ul */ int it_lim; /* spx.it_lim */ int tm_lim; /* spx.tm_lim (milliseconds) */ int out_frq; /* spx.out_frq */ int out_dly; /* spx.out_dly (milliseconds) */ int presolve; /* enable/disable using LP presolver */ double foo_bar[36]; /* (reserved) */} glp_smcp;#ifndef _GLP_TREE#define _GLP_TREEtypedef struct { double _opaque_tree; } glp_tree;/* branch-and-bound tree */#endiftypedef struct{ /* integer optimizer control parameters */ int msg_lev; /* message level (see glp_smcp) */ int br_tech; /* branching technique: */#define GLP_BR_FFV 1 /* first fractional variable */#define GLP_BR_LFV 2 /* last fractional variable */#define GLP_BR_MFV 3 /* most fractional variable */#define GLP_BR_DTH 4 /* heuristic by Driebeck and Tomlin */#define GLP_BR_HPC 5 /* hybrid pseudocost */ int bt_tech; /* backtracking technique: */#define GLP_BT_DFS 1 /* depth first search */#define GLP_BT_BFS 2 /* breadth first search */#define GLP_BT_BLB 3 /* best local bound */#define GLP_BT_BPH 4 /* best projection heuristic */ double tol_int; /* mip.tol_int */ double tol_obj; /* mip.tol_obj */ int tm_lim; /* mip.tm_lim (milliseconds) */ int out_frq; /* mip.out_frq (milliseconds) */ int out_dly; /* mip.out_dly (milliseconds) */ void (*cb_func)(glp_tree *tree, void *info); /* mip.cb_func */ void *cb_info; /* mip.cb_info */ int cb_size; /* mip.cb_size */ int pp_tech; /* preprocessing technique: */#define GLP_PP_NONE 0 /* disable preprocessing */#define GLP_PP_ROOT 1 /* preprocessing only on root level */#define GLP_PP_ALL 2 /* preprocessing on all levels */ double mip_gap; /* relative MIP gap tolerance */ int mir_cuts; /* MIR cuts (GLP_ON/GLP_OFF) */ int gmi_cuts; /* Gomory's cuts (GLP_ON/GLP_OFF) */ int cov_cuts; /* cover cuts (GLP_ON/GLP_OFF) */ int clq_cuts; /* clique cuts (GLP_ON/GLP_OFF) */ int presolve; /* enable/disable using MIP presolver */ int binarize; /* try to binarize integer variables */ double foo_bar[30]; /* (reserved) */#if 1 /* not yet available */ char *fn_sol; /* file name to write solution found */#endif} glp_iocp;typedef struct{ /* additional row attributes */ int level; /* subproblem level at which the row was added */ int origin; /* the row origin flag: */#define GLP_RF_REG 0 /* regular constraint */#define GLP_RF_LAZY 1 /* "lazy" constraint */#define GLP_RF_CUT 2 /* cutting plane constraint */ int klass; /* the row class descriptor: */#define GLP_RF_GMI 1 /* Gomory's mixed integer cut */#define GLP_RF_MIR 2 /* mixed integer rounding cut */#define GLP_RF_COV 3 /* mixed cover cut */#define GLP_RF_CLQ 4 /* clique cut */ double foo_bar[7]; /* (reserved) */} glp_attr;/* enable/disable flag: */#define GLP_ON 1 /* enable something */#define GLP_OFF 0 /* disable something *//* reason codes: */#define GLP_IROWGEN 0x01 /* request for row generation */#define GLP_IBINGO 0x02 /* better integer solution found */#define GLP_IHEUR 0x03 /* request for heuristic solution */#define GLP_ICUTGEN 0x04 /* request for cut generation */#define GLP_IBRANCH 0x05 /* request for branching */#define GLP_ISELECT 0x06 /* request for subproblem selection */#define GLP_IPREPRO 0x07 /* request for preprocessing *//* branch selection indicator: */#define GLP_NO_BRNCH 0 /* select no branch */#define GLP_DN_BRNCH 1 /* select down-branch */#define GLP_UP_BRNCH 2 /* select up-branch *//* return codes: */#define GLP_EBADB 0x01 /* invalid basis */#define GLP_ESING 0x02 /* singular matrix */#define GLP_ECOND 0x03 /* ill-conditioned matrix */#define GLP_EBOUND 0x04 /* invalid bounds */#define GLP_EFAIL 0x05 /* solver failed */#define GLP_EOBJLL 0x06 /* objective lower limit reached */#define GLP_EOBJUL 0x07 /* objective upper limit reached */#define GLP_EITLIM 0x08 /* iteration limit exceeded */#define GLP_ETMLIM 0x09 /* time limit exceeded */#define GLP_ENOPFS 0x0A /* no primal feasible solution */#define GLP_ENODFS 0x0B /* no dual feasible solution */#define GLP_EROOT 0x0C /* root LP optimum not provided */#define GLP_ESTOP 0x0D /* search terminated by application */#define GLP_EMIPGAP 0x0E /* relative mip gap tolerance reached */#define GLP_ENOFEAS 0x0F /* no primal/dual feasible solution */#define GLP_ENOCVG 0x10 /* no convergence */#define GLP_EINSTAB 0x11 /* numerical instability */#define GLP_EDATA 0x12 /* invalid data */#define GLP_ERANGE 0x13 /* result out of range *//* MPS file format: */#define GLP_MPS_DECK 1 /* fixed (ancient) */#define GLP_MPS_FILE 2 /* free (modern) */#ifndef _GLP_TRAN#define _GLP_TRANtypedef struct { double _opaque_tran; } glp_tran;/* MathProg translator workspace */#endifglp_prob *glp_create_prob(void);/* create problem object */void glp_set_prob_name(glp_prob *lp, const char *name);/* assign (change) problem name */void glp_set_obj_name(glp_prob *lp, const char *name);/* assign (change) objective function name */void glp_set_obj_dir(glp_prob *lp, int dir);/* set (change) optimization direction flag */int glp_add_rows(glp_prob *lp, int nrs);/* add new rows to problem object */int glp_add_cols(glp_prob *lp, int ncs);/* add new columns to problem object */void glp_set_row_name(glp_prob *lp, int i, const char *name);/* assign (change) row name */void glp_set_col_name(glp_prob *lp, int j, const char *name);/* assign (change) column name */void glp_set_row_bnds(glp_prob *lp, int i, int type, double lb, double ub);/* set (change) row bounds */void glp_set_col_bnds(glp_prob *lp, int j, int type, double lb, double ub);/* set (change) column bounds */void glp_set_obj_coef(glp_prob *lp, int j, double coef);/* set (change) obj. coefficient or constant term */void glp_set_mat_row(glp_prob *lp, int i, int len, const int ind[], const double val[]);/* set (replace) row of the constraint matrix */void glp_set_mat_col(glp_prob *lp, int j, int len, const int ind[], const double val[]);/* set (replace) column of the constraint matrix */void glp_load_matrix(glp_prob *lp, int ne, const int ia[], const int ja[], const double ar[]);/* load (replace) the whole constraint matrix */void glp_del_rows(glp_prob *lp, int nrs, const int num[]);/* delete specified rows from problem object */void glp_del_cols(glp_prob *lp, int ncs, const int num[]);/* delete specified columns from problem object */void glp_copy_prob(glp_prob *dest, glp_prob *prob, int names);/* copy problem object content */void glp_erase_prob(glp_prob *lp);/* erase problem object content */void glp_delete_prob(glp_prob *lp);/* delete problem object */const char *glp_get_prob_name(glp_prob *lp);/* retrieve problem name */const char *glp_get_obj_name(glp_prob *lp);/* retrieve objective function name */int glp_get_obj_dir(glp_prob *lp);/* retrieve optimization direction flag */int glp_get_num_rows(glp_prob *lp);/* retrieve number of rows */int glp_get_num_cols(glp_prob *lp);/* retrieve number of columns */const char *glp_get_row_name(glp_prob *lp, int i);/* retrieve row name */const char *glp_get_col_name(glp_prob *lp, int j);/* retrieve column name */int glp_get_row_type(glp_prob *lp, int i);/* retrieve row type */double glp_get_row_lb(glp_prob *lp, int i);/* retrieve row lower bound */double glp_get_row_ub(glp_prob *lp, int i);/* retrieve row upper bound */int glp_get_col_type(glp_prob *lp, int j);/* retrieve column type */double glp_get_col_lb(glp_prob *lp, int j);/* retrieve column lower bound */double glp_get_col_ub(glp_prob *lp, int j);/* retrieve column upper bound */double glp_get_obj_coef(glp_prob *lp, int j);/* retrieve obj. coefficient or constant term */int glp_get_num_nz(glp_prob *lp);/* retrieve number of constraint coefficients */int glp_get_mat_row(glp_prob *lp, int i, int ind[], double val[]);/* retrieve row of the constraint matrix */int glp_get_mat_col(glp_prob *lp, int j, int ind[], double val[]);/* retrieve column of the constraint matrix */void glp_create_index(glp_prob *lp);/* create the name index */int glp_find_row(glp_prob *lp, const char *name);/* find row by its name */int glp_find_col(glp_prob *lp, const char *name);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -