?? glpk.h
字號:
/* pointer to the head endpoint */ void *data; /* pointer to data associated with the arc */ void *temp; /* working pointer */ glp_arc *t_prev; /* pointer to previous arc having the same tail endpoint */ glp_arc *t_next; /* pointer to next arc having the same tail endpoint */ glp_arc *h_prev; /* pointer to previous arc having the same head endpoint */ glp_arc *h_next; /* pointer to next arc having the same head endpoint */};glp_graph *glp_create_graph(int v_size, int a_size);/* create graph */void glp_set_graph_name(glp_graph *G, const char *name);/* assign (change) graph name */int glp_add_vertices(glp_graph *G, int nadd);/* add new vertices to graph */glp_arc *glp_add_arc(glp_graph *G, int i, int j);/* add new arc to graph */void glp_erase_graph(glp_graph *G, int v_size, int a_size);/* erase graph content */void glp_delete_graph(glp_graph *G);/* delete graph */void glp_mincost_lp(glp_prob *lp, glp_graph *G, int names, int v_rhs, int a_low, int a_cap, int a_cost);/* convert minimum cost flow problem to LP */int glp_mincost_okalg(glp_graph *G, int v_rhs, int a_low, int a_cap, int a_cost, double *sol, int a_x, int v_pi);/* find minimum-cost flow with out-of-kilter algorithm */void glp_maxflow_lp(glp_prob *lp, glp_graph *G, int names, int s, int t, int a_cap);/* convert maximum flow problem to LP */int glp_maxflow_ffalg(glp_graph *G, int s, int t, int a_cap, double *sol, int a_x, int v_cut);/* find maximal flow with Ford-Fulkerson algorithm */int glp_read_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, int a_cost, const char *fname);/* read min-cost flow problem data in DIMACS format */int glp_write_mincost(glp_graph *G, int v_rhs, int a_low, int a_cap, int a_cost, const char *fname);/* write min-cost flow problem data in DIMACS format */int glp_read_maxflow(glp_graph *G, int *s, int *t, int a_cap, const char *fname);/* read maximum flow problem data in DIMACS format */int glp_write_maxflow(glp_graph *G, int s, int t, int a_cap, const char *fname);/* write maximum flow problem data in DIMACS format */int glp_netgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, const int parm[1+15]);/* Klingman's network problem generator */int glp_gridgen(glp_graph *G, int v_rhs, int a_cap, int a_cost, const int parm[1+14]);/* grid-like network problem generator */int glp_rmfgen(glp_graph *G, int *s, int *t, int a_cap, const int parm[1+5]);/* Goldfarb's maximum flow problem generator */int glp_weak_comp(glp_graph *G, int v_num);/* find all weakly connected components of graph *//**********************************************************************/#define LPX glp_prob/* problem class: */#define LPX_LP 100 /* linear programming (LP) */#define LPX_MIP 101 /* mixed integer programming (MIP) *//* type of auxiliary/structural variable: */#define LPX_FR 110 /* free variable */#define LPX_LO 111 /* variable with lower bound */#define LPX_UP 112 /* variable with upper bound */#define LPX_DB 113 /* double-bounded variable */#define LPX_FX 114 /* fixed variable *//* optimization direction flag: */#define LPX_MIN 120 /* minimization */#define LPX_MAX 121 /* maximization *//* status of primal basic solution: */#define LPX_P_UNDEF 132 /* primal solution is undefined */#define LPX_P_FEAS 133 /* solution is primal feasible */#define LPX_P_INFEAS 134 /* solution is primal infeasible */#define LPX_P_NOFEAS 135 /* no primal feasible solution exists *//* status of dual basic solution: */#define LPX_D_UNDEF 136 /* dual solution is undefined */#define LPX_D_FEAS 137 /* solution is dual feasible */#define LPX_D_INFEAS 138 /* solution is dual infeasible */#define LPX_D_NOFEAS 139 /* no dual feasible solution exists *//* status of auxiliary/structural variable: */#define LPX_BS 140 /* basic variable */#define LPX_NL 141 /* non-basic variable on lower bound */#define LPX_NU 142 /* non-basic variable on upper bound */#define LPX_NF 143 /* non-basic free variable */#define LPX_NS 144 /* non-basic fixed variable *//* status of interior-point solution: */#define LPX_T_UNDEF 150 /* interior solution is undefined */#define LPX_T_OPT 151 /* interior solution is optimal *//* kind of structural variable: */#define LPX_CV 160 /* continuous variable */#define LPX_IV 161 /* integer variable *//* status of integer solution: */#define LPX_I_UNDEF 170 /* integer solution is undefined */#define LPX_I_OPT 171 /* integer solution is optimal */#define LPX_I_FEAS 172 /* integer solution is feasible */#define LPX_I_NOFEAS 173 /* no integer solution exists *//* status codes reported by the routine lpx_get_status: */#define LPX_OPT 180 /* optimal */#define LPX_FEAS 181 /* feasible */#define LPX_INFEAS 182 /* infeasible */#define LPX_NOFEAS 183 /* no feasible */#define LPX_UNBND 184 /* unbounded */#define LPX_UNDEF 185 /* undefined *//* exit codes returned by solver routines: */#define LPX_E_OK 200 /* success */#define LPX_E_EMPTY 201 /* empty problem */#define LPX_E_BADB 202 /* invalid initial basis */#define LPX_E_INFEAS 203 /* infeasible initial solution */#define LPX_E_FAULT 204 /* unable to start the search */#define LPX_E_OBJLL 205 /* objective lower limit reached */#define LPX_E_OBJUL 206 /* objective upper limit reached */#define LPX_E_ITLIM 207 /* iterations limit exhausted */#define LPX_E_TMLIM 208 /* time limit exhausted */#define LPX_E_NOFEAS 209 /* no feasible solution */#define LPX_E_INSTAB 210 /* numerical instability */#define LPX_E_SING 211 /* problems with basis matrix */#define LPX_E_NOCONV 212 /* no convergence (interior) */#define LPX_E_NOPFS 213 /* no primal feas. sol. (LP presolver) */#define LPX_E_NODFS 214 /* no dual feas. sol. (LP presolver) */#define LPX_E_MIPGAP 215 /* relative mip gap tolerance reached *//* control parameter identifiers: */#define LPX_K_MSGLEV 300 /* lp->msg_lev */#define LPX_K_SCALE 301 /* lp->scale */#define LPX_K_DUAL 302 /* lp->dual */#define LPX_K_PRICE 303 /* lp->price */#define LPX_K_RELAX 304 /* lp->relax */#define LPX_K_TOLBND 305 /* lp->tol_bnd */#define LPX_K_TOLDJ 306 /* lp->tol_dj */#define LPX_K_TOLPIV 307 /* lp->tol_piv */#define LPX_K_ROUND 308 /* lp->round */#define LPX_K_OBJLL 309 /* lp->obj_ll */#define LPX_K_OBJUL 310 /* lp->obj_ul */#define LPX_K_ITLIM 311 /* lp->it_lim */#define LPX_K_ITCNT 312 /* lp->it_cnt */#define LPX_K_TMLIM 313 /* lp->tm_lim */#define LPX_K_OUTFRQ 314 /* lp->out_frq */#define LPX_K_OUTDLY 315 /* lp->out_dly */#define LPX_K_BRANCH 316 /* lp->branch */#define LPX_K_BTRACK 317 /* lp->btrack */#define LPX_K_TOLINT 318 /* lp->tol_int */#define LPX_K_TOLOBJ 319 /* lp->tol_obj */#define LPX_K_MPSINFO 320 /* lp->mps_info */#define LPX_K_MPSOBJ 321 /* lp->mps_obj */#define LPX_K_MPSORIG 322 /* lp->mps_orig */#define LPX_K_MPSWIDE 323 /* lp->mps_wide */#define LPX_K_MPSFREE 324 /* lp->mps_free */#define LPX_K_MPSSKIP 325 /* lp->mps_skip */#define LPX_K_LPTORIG 326 /* lp->lpt_orig */#define LPX_K_PRESOL 327 /* lp->presol */#define LPX_K_BINARIZE 328 /* lp->binarize */#define LPX_K_USECUTS 329 /* lp->use_cuts */#define LPX_K_BFTYPE 330 /* lp->bfcp->type */#define LPX_K_MIPGAP 331 /* lp->mip_gap */#define LPX_C_COVER 0x01 /* mixed cover cuts */#define LPX_C_CLIQUE 0x02 /* clique cuts */#define LPX_C_GOMORY 0x04 /* Gomory's mixed integer cuts */#define LPX_C_MIR 0x08 /* mixed integer rounding cuts */#define LPX_C_ALL 0xFF /* all cuts */typedef struct{ /* this structure contains results reported by the routines which checks Karush-Kuhn-Tucker conditions (for details see comments to those routines) */ /*--------------------------------------------------------------*/ /* xR - A * xS = 0 (KKT.PE) */ double pe_ae_max; /* largest absolute error */ int pe_ae_row; /* number of row with largest absolute error */ double pe_re_max; /* largest relative error */ int pe_re_row; /* number of row with largest relative error */ int pe_quality; /* quality of primal solution: 'H' - high 'M' - medium 'L' - low '?' - primal solution is wrong */ /*--------------------------------------------------------------*/ /* l[k] <= x[k] <= u[k] (KKT.PB) */ double pb_ae_max; /* largest absolute error */ int pb_ae_ind; /* number of variable with largest absolute error */ double pb_re_max; /* largest relative error */ int pb_re_ind; /* number of variable with largest relative error */ int pb_quality; /* quality of primal feasibility: 'H' - high 'M' - medium 'L' - low '?' - primal solution is infeasible */ /*--------------------------------------------------------------*/ /* A' * (dR - cR) + (dS - cS) = 0 (KKT.DE) */ double de_ae_max; /* largest absolute error */ int de_ae_col; /* number of column with largest absolute error */ double de_re_max; /* largest relative error */ int de_re_col; /* number of column with largest relative error */ int de_quality; /* quality of dual solution: 'H' - high 'M' - medium 'L' - low '?' - dual solution is wrong */ /*--------------------------------------------------------------*/ /* d[k] >= 0 or d[k] <= 0 (KKT.DB) */ double db_ae_max; /* largest absolute error */ int db_ae_ind; /* number of variable with largest absolute error */ double db_re_max; /* largest relative error */ int db_re_ind; /* number of variable with largest relative error */ int db_quality; /* quality of dual feasibility: 'H' - high 'M' - medium 'L' - low '?' - dual solution is infeasible */ /*--------------------------------------------------------------*/ /* (x[k] - bound of x[k]) * d[k] = 0 (KKT.CS) */ double cs_ae_max; /* largest absolute error */ int cs_ae_ind; /* number of variable with largest absolute error */ double cs_re_max; /* largest relative error */ int cs_re_ind; /* number of variable with largest relative error */ int cs_quality; /* quality of complementary slackness: 'H' - high 'M' - medium 'L' - low '?' - primal and dual solutions are not complementary */} LPXKKT;#define lpx_create_prob _glp_lpx_create_probLPX *lpx_create_prob(void);/* create problem object */#define lpx_set_prob_name _glp_lpx_set_prob_namevoid lpx_set_prob_name(LPX *lp, const char *name);/* assign (change) problem name */#define lpx_set_obj_name _glp_lpx_set_obj_namevoid lpx_set_obj_name(LPX *lp, const char *name);/* assign (change) objective function name */#define lpx_set_obj_dir _glp_lpx_set_obj_dirvoid lpx_set_obj_dir(LPX *lp, int dir);/* set (change) optimization direction flag */#define lpx_add_rows _glp_lpx_add_rowsint lpx_add_rows(LPX *lp, int nrs);/* add new rows to problem object */#define lpx_add_cols _glp_lpx_add_colsint lpx_add_cols(LPX *lp, int ncs);/* add new columns to problem object */#define lpx_set_row_name _glp_lpx_set_row_namevoid lpx_set_row_name(LPX *lp, int i, const char *name);/* assign (change) row name */#define lpx_set_col_name _glp_lpx_set_col_namevoid lpx_set_col_name(LPX *lp, int j, const char *name);/* assign (change) column name */#define lpx_set_row_bnds _glp_lpx_set_row_bndsvoid lpx_set_row_bnds(LPX *lp, int i, int type, double lb, double ub);/* set (change) row bounds */#define lpx_set_col_bnds _glp_lpx_set_col_bndsvoid lpx_set_col_bnds(LPX *lp, int j, int type, double lb, double ub);/* set (change) column bounds */#define lpx_set_obj_coef _glp_lpx_set_obj_coefvoid lpx_set_obj_coef(glp_prob *lp, int j, double coef);/* set (change) obj. coefficient or constant term */#define lpx_set_mat_row _glp_lpx_set_mat_rowvoid lpx_set_mat_row(LPX *lp, int i, int len, const int ind[], const double val[]);/* set (replace) row of the constraint matrix */#define lpx_set_mat_col _glp_lpx_set_mat_colvoid lpx_set_mat_col(LPX *lp, int j, int len, const int ind[], const double val[]);/* set (replace) column of the constraint matrix */#define lpx_load_matrix _glp_lpx_load_matrixvoid lpx_load_matrix(LPX *lp, int ne, const int ia[], const int ja[], const double ar[]);/* load (replace) the whole constraint matrix */#define lpx_del_rows _glp_lpx_del_rowsvoid lpx_del_rows(LPX *lp, int nrs, const int num[]);/* delete specified rows from problem object */#define lpx_del_cols _glp_lpx_del_colsvoid lpx_del_cols(LPX *lp, int ncs, const int num[]);/* delete specified columns from problem object */#define lpx_delete_prob _glp_lpx_delete_probvoid lpx_delete_prob(LPX *lp);/* delete problem object */#define lpx_get_prob_name _glp_lpx_get_prob_nameconst char *lpx_get_prob_name(LPX *lp);/* retrieve problem name */#define lpx_get_obj_name _glp_lpx_get_obj_nameconst char *lpx_get_obj_name(LPX *lp);/* retrieve objective function name */#define lpx_get_obj_dir _glp_lpx_get_obj_dirint lpx_get_obj_dir(LPX *lp);/* retrieve optimization direction flag */#define lpx_get_num_rows _glp_lpx_get_num_rowsint lpx_get_num_rows(LPX *lp);/* retrieve number of rows */#define lpx_get_num_cols _glp_lpx_get_num_colsint lpx_get_num_cols(LPX *lp);/* retrieve number of columns */#define lpx_get_row_name _glp_lpx_get_row_name
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -