📄 glpk.h
字号:
/* find column by its name */void glp_delete_index(glp_prob *lp);/* delete the name index */void glp_set_rii(glp_prob *lp, int i, double rii);/* set (change) row scale factor */void glp_set_sjj(glp_prob *lp, int j, double sjj);/* set (change) column scale factor */double glp_get_rii(glp_prob *lp, int i);/* retrieve row scale factor */double glp_get_sjj(glp_prob *lp, int j);/* retrieve column scale factor */void glp_scale_prob(glp_prob *lp, int flags);/* scale problem data */void glp_unscale_prob(glp_prob *lp);/* unscale problem data */void glp_set_row_stat(glp_prob *lp, int i, int stat);/* set (change) row status */void glp_set_col_stat(glp_prob *lp, int j, int stat);/* set (change) column status */void glp_std_basis(glp_prob *lp);/* construct standard initial LP basis */void glp_adv_basis(glp_prob *lp, int flags);/* construct advanced initial LP basis */void glp_cpx_basis(glp_prob *lp);/* construct Bixby's initial LP basis */int glp_simplex(glp_prob *lp, const glp_smcp *parm);/* solve LP problem with the simplex method */int glp_exact(glp_prob *lp, const glp_smcp *parm);/* solve LP problem in exact arithmetic */void glp_init_smcp(glp_smcp *parm);/* initialize simplex method control parameters */int glp_get_status(glp_prob *lp);/* retrieve generic status of basic solution */int glp_get_prim_stat(glp_prob *lp);/* retrieve status of primal basic solution */int glp_get_dual_stat(glp_prob *lp);/* retrieve status of dual basic solution */double glp_get_obj_val(glp_prob *lp);/* retrieve objective value (basic solution) */int glp_get_row_stat(glp_prob *lp, int i);/* retrieve row status */double glp_get_row_prim(glp_prob *lp, int i);/* retrieve row primal value (basic solution) */double glp_get_row_dual(glp_prob *lp, int i);/* retrieve row dual value (basic solution) */int glp_get_col_stat(glp_prob *lp, int j);/* retrieve column status */double glp_get_col_prim(glp_prob *lp, int j);/* retrieve column primal value (basic solution) */double glp_get_col_dual(glp_prob *lp, int j);/* retrieve column dual value (basic solution) */int glp_get_unbnd_ray(glp_prob *lp);/* determine variable causing unboundedness */int glp_interior(glp_prob *lp, const void *parm);/* solve LP problem with the interior-point method */int glp_ipt_status(glp_prob *lp);/* retrieve status of interior-point solution */double glp_ipt_obj_val(glp_prob *lp);/* retrieve objective value (interior point) */double glp_ipt_row_prim(glp_prob *lp, int i);/* retrieve row primal value (interior point) */double glp_ipt_row_dual(glp_prob *lp, int i);/* retrieve row dual value (interior point) */double glp_ipt_col_prim(glp_prob *lp, int j);/* retrieve column primal value (interior point) */double glp_ipt_col_dual(glp_prob *lp, int j);/* retrieve column dual value (interior point) */void glp_set_col_kind(glp_prob *mip, int j, int kind);/* set (change) column kind */int glp_get_col_kind(glp_prob *mip, int j);/* retrieve column kind */int glp_get_num_int(glp_prob *mip);/* retrieve number of integer columns */int glp_get_num_bin(glp_prob *mip);/* retrieve number of binary columns */int glp_intopt(glp_prob *mip, const glp_iocp *parm);/* solve MIP problem with the branch-and-bound method */void glp_init_iocp(glp_iocp *parm);/* initialize integer optimizer control parameters */int glp_mip_status(glp_prob *mip);/* retrieve status of MIP solution */double glp_mip_obj_val(glp_prob *mip);/* retrieve objective value (MIP solution) */double glp_mip_row_val(glp_prob *mip, int i);/* retrieve row value (MIP solution) */double glp_mip_col_val(glp_prob *mip, int j);/* retrieve column value (MIP solution) */int glp_read_sol(glp_prob *lp, const char *fname);/* read basic solution from text file */int glp_write_sol(glp_prob *lp, const char *fname);/* write basic solution to text file */int glp_read_ipt(glp_prob *lp, const char *fname);/* read interior-point solution from text file */int glp_write_ipt(glp_prob *lp, const char *fname);/* write interior-point solution to text file */int glp_read_mip(glp_prob *mip, const char *fname);/* read MIP solution from text file */int glp_write_mip(glp_prob *mip, const char *fname);/* write MIP solution to text file */int glp_bf_exists(glp_prob *lp);/* check if the basis factorization exists */int glp_factorize(glp_prob *lp);/* compute the basis factorization */int glp_bf_updated(glp_prob *lp);/* check if the basis factorization has been updated */void glp_get_bfcp(glp_prob *lp, glp_bfcp *parm);/* retrieve basis factorization control parameters */void glp_set_bfcp(glp_prob *lp, const glp_bfcp *parm);/* change basis factorization control parameters */int glp_get_bhead(glp_prob *lp, int k);/* retrieve the basis header information */int glp_get_row_bind(glp_prob *lp, int i);/* retrieve row index in the basis header */int glp_get_col_bind(glp_prob *lp, int j);/* retrieve column index in the basis header */void glp_ftran(glp_prob *lp, double x[]);/* perform forward transformation (solve system B*x = b) */void glp_btran(glp_prob *lp, double x[]);/* perform backward transformation (solve system B'*x = b) */int glp_eval_tab_row(glp_prob *lp, int k, int ind[], double val[]);/* compute row of the simplex tableau */int glp_eval_tab_col(glp_prob *lp, int k, int ind[], double val[]);/* compute column of the simplex tableau */int glp_ios_reason(glp_tree *tree);/* determine reason for calling the callback routine */glp_prob *glp_ios_get_prob(glp_tree *tree);/* access the problem object */void glp_ios_tree_size(glp_tree *tree, int *a_cnt, int *n_cnt, int *t_cnt);/* determine size of the branch-and-bound tree */int glp_ios_curr_node(glp_tree *tree);/* determine current active subproblem */int glp_ios_next_node(glp_tree *tree, int p);/* determine next active subproblem */int glp_ios_prev_node(glp_tree *tree, int p);/* determine previous active subproblem */int glp_ios_up_node(glp_tree *tree, int p);/* determine parent subproblem */int glp_ios_node_level(glp_tree *tree, int p);/* determine subproblem level */double glp_ios_node_bound(glp_tree *tree, int p);/* determine subproblem local bound */int glp_ios_best_node(glp_tree *tree);/* find active subproblem with best local bound */double glp_ios_mip_gap(glp_tree *tree);/* compute relative MIP gap */void *glp_ios_node_data(glp_tree *tree, int p);/* access subproblem application-specific data */void glp_ios_row_attr(glp_tree *tree, int i, glp_attr *attr);/* retrieve additional row attributes */int glp_ios_pool_size(glp_tree *tree);/* determine current size of the cut pool */int glp_ios_add_row(glp_tree *tree, const char *name, int klass, int flags, int len, const int ind[], const double val[], int type, double rhs);/* add row (constraint) to the cut pool */void glp_ios_del_row(glp_tree *tree, int i);/* remove row (constraint) from the cut pool */void glp_ios_clear_pool(glp_tree *tree);/* remove all rows (constraints) from the cut pool */int glp_ios_can_branch(glp_tree *tree, int j);/* check if can branch upon specified variable */void glp_ios_branch_upon(glp_tree *tree, int j, int sel);/* choose variable to branch upon */void glp_ios_select_node(glp_tree *tree, int p);/* select subproblem to continue the search */int glp_ios_heur_sol(glp_tree *tree, const double x[]);/* provide solution found by heuristic */void glp_ios_terminate(glp_tree *tree);/* terminate the solution process */const char *glp_version(void);/* determine library version */void glp_term_out(int flag);/* enable/disable terminal output */void glp_term_hook(int (*func)(void *info, const char *s), void *info);/* install hook to intercept terminal output */void *glp_malloc(int size);/* allocate memory block */void *glp_calloc(int n, int size);/* allocate memory block */void glp_free(void *ptr);/* free memory block */void glp_mem_usage(int *count, int *cpeak, glp_long *total, glp_long *tpeak);/* get memory usage information */void glp_mem_limit(int limit);/* set memory usage limit */void glp_free_env(void);/* free GLPK library environment */int glp_read_mps(glp_prob *lp, int fmt, const void *parm, const char *fname);/* read problem data in MPS format */int glp_write_mps(glp_prob *lp, int fmt, const void *parm, const char *fname);/* write problem data in MPS format */int glp_read_lp(glp_prob *lp, const void *parm, const char *fname);/* read problem data in CPLEX LP format */int glp_write_lp(glp_prob *lp, const void *parm, const char *fname);/* write problem data in CPLEX LP format */glp_tran *glp_mpl_alloc_wksp(void);/* allocate the MathProg translator workspace */int glp_mpl_read_model(glp_tran *tran, const char *fname, int skip);/* read and translate model section */int glp_mpl_read_data(glp_tran *tran, const char *fname);/* read and translate data section */int glp_mpl_generate(glp_tran *tran, const char *fname);/* generate the model */void glp_mpl_build_prob(glp_tran *tran, glp_prob *prob);/* build LP/MIP problem instance from the model */int glp_mpl_postsolve(glp_tran *tran, glp_prob *prob, int sol);/* postsolve the model */void glp_mpl_free_wksp(glp_tran *tran);/* free the MathProg translator workspace */int glp_main(int argc, const char *argv[]);/* stand-alone LP/MIP solver *//**********************************************************************/typedef struct _glp_graph glp_graph;typedef struct _glp_vertex glp_vertex;typedef struct _glp_arc glp_arc;struct _glp_graph{ /* graph descriptor */ void *pool; /* DMP *pool; */ /* memory pool to store graph components */ char *name; /* graph name (1 to 255 chars); NULL means no name is assigned to the graph */ int nv_max; /* length of the vertex list (enlarged automatically) */ int nv; /* number of vertices in the graph, 0 <= nv <= nv_max */ int na; /* number of arcs in the graph, na >= 0 */ glp_vertex **v; /* glp_vertex *v[1+nv_max]; */ /* v[i], 1 <= i <= nv, is a pointer to i-th vertex */ void *index; /* AVL *index; */ /* vertex index to find vertices by their names; NULL means the index does not exist */ int v_size; /* size of data associated with each vertex (0 to 256 bytes) */ int a_size; /* size of data associated with each arc (0 to 256 bytes) */};struct _glp_vertex{ /* vertex descriptor */ int i; /* vertex ordinal number, 1 <= i <= nv */ char *name; /* vertex name (1 to 255 chars); NULL means no name is assigned to the vertex */ void *entry; /* AVLNODE *entry; */ /* pointer to corresponding entry in the vertex index; NULL means that either the index does not exist or the vertex has no name assigned */ void *data; /* pointer to data associated with the vertex */ void *temp; /* working pointer */ glp_arc *in; /* pointer to the (unordered) list of incoming arcs */ glp_arc *out; /* pointer to the (unordered) list of outgoing arcs */};struct _glp_arc{ /* arc descriptor */ glp_vertex *tail; /* pointer to the tail endpoint */ glp_vertex *head;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -