⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glpmpl.h

📁 著名的大规模线性规划求解器源码GLPK.C语言版本,可以修剪.内有详细帮助文档.
💻 H
📖 第 1 页 / 共 5 页
字号:
      VARIABLE *var;      /* model variable, which contains this elemental variable */      MEMBER *memb;      /* array member, which is assigned this elemental variable */      double lbnd;      /* lower bound */      double ubnd;      /* upper bound */      double temp;      /* working quantity used in operations on linear forms; normally         it contains floating-point zero */      double value;      /* value of this elemental variable provided by the solver */};/**********************************************************************//* * *                        LINEAR FORMS                        * * *//**********************************************************************/struct FORMULA{     /* term of linear form c * x, where c is a coefficient, x is an         elemental variable; the linear form itself is the sum of terms         and is associated with its first term; (note that the linear         form may be empty that means the sum is equal to zero) */      double coef;      /* coefficient at elemental variable or constant term */      ELEMVAR *var;      /* reference to elemental variable; NULL means constant term */      FORMULA *next;      /* the next term of linear form */};#define constant_term _glp_mpl_constant_termFORMULA *constant_term(MPL *mpl, double coef);/* create constant term */#define single_variable _glp_mpl_single_variableFORMULA *single_variable(     MPL *mpl,      ELEMVAR *var            /* referenced */);/* create single variable */#define copy_formula _glp_mpl_copy_formulaFORMULA *copy_formula(     MPL *mpl,      FORMULA *form           /* not changed */);/* make copy of linear form */#define delete_formula _glp_mpl_delete_formulavoid delete_formula(     MPL *mpl,      FORMULA *form           /* destroyed */);/* delete linear form */#define linear_comb _glp_mpl_linear_combFORMULA *linear_comb(     MPL *mpl,      double a, FORMULA *fx,  /* destroyed */      double b, FORMULA *fy   /* destroyed */);/* linear combination of two linear forms */#define remove_constant _glp_mpl_remove_constantFORMULA *remove_constant(     MPL *mpl,      FORMULA *form,          /* destroyed */      double *coef            /* modified */);/* remove constant term from linear form */#define reduce_terms _glp_mpl_reduce_termsFORMULA *reduce_terms(     MPL *mpl,      FORMULA *form           /* destroyed */);/* reduce identical terms in linear form *//**********************************************************************//* * *                   ELEMENTAL CONSTRAINTS                    * * *//**********************************************************************/struct ELEMCON{     /* elemental constraint; formally it is a "value" assigned to         members of model constraints (like numbers or symbols, which         are values assigned to members of model parameters) */      int i;      /* LP row number assigned to this elemental constraint */      CONSTRAINT *con;      /* model constraint, which contains this elemental constraint */      MEMBER *memb;      /* array member, which is assigned this elemental constraint */      FORMULA *form;      /* linear form */      double lbnd;      /* lower bound */      double ubnd;      /* upper bound */};/**********************************************************************//* * *                       GENERIC VALUES                       * * *//**********************************************************************/union VALUE{     /* generic value, which can be assigned to object member or be a         result of evaluation of expression */      /* indicator that specifies the particular type of generic value         is stored in the corresponding array or pseudo-code descriptor         and can be one of the following:         A_NONE     - no value         A_NUMERIC  - floating-point number         A_SYMBOLIC - symbol         A_LOGICAL  - logical value         A_TUPLE    - n-tuple         A_ELEMSET  - elemental set         A_ELEMVAR  - elemental variable         A_FORMULA  - linear form         A_ELEMCON  - elemental constraint */      void *none;    /* null */      double num;    /* value */      SYMBOL *sym;   /* value */      int bit;       /* value */      TUPLE *tuple;  /* value */      ELEMSET *set;  /* value */      ELEMVAR *var;  /* reference */      FORMULA *form; /* value */      ELEMCON *con;  /* reference */};#define delete_value _glp_mpl_delete_valuevoid delete_value(     MPL *mpl,      int type,      VALUE *value            /* content destroyed */);/* delete generic value *//**********************************************************************//* * *                SYMBOLICALLY INDEXED ARRAYS                 * * *//**********************************************************************/struct ARRAY{     /* multi-dimensional array, a set of members indexed over simple         or compound sets of symbols; arrays are used to represent the         contents of model objects (i.e. sets, parameters, variables,         constraints, and objectives); arrays also are used as "values"         that are assigned to members of set objects, in which case the         array itself represents an elemental set */      int type;      /* type of generic values assigned to the array members:         A_NONE     - none (members have no assigned values)         A_NUMERIC  - floating-point numbers         A_SYMBOLIC - symbols         A_ELEMSET  - elemental sets         A_ELEMVAR  - elemental variables         A_ELEMCON  - elemental constraints */      int dim;      /* dimension of the array that determines number of components in         n-tuples for all members of the array, dim >= 0; dim = 0 means         the array is 0-dimensional */      int size;      /* size of the array, i.e. number of its members */      MEMBER *head;      /* the first array member; NULL means the array is empty */      MEMBER *tail;      /* the last array member; NULL means the array is empty */      AVL *tree;      /* the search tree intended to find array members for logarithmic         time; NULL means the search tree doesn't exist */      ARRAY *prev;      /* the previous array in the translator database */      ARRAY *next;      /* the next array in the translator database */};struct MEMBER{     /* array member */      TUPLE *tuple;      /* n-tuple, which identifies the member; number of its components         is the same for all members within the array and determined by         the array dimension; duplicate members are not allowed */      MEMBER *next;      /* the next array member */      VALUE value;      /* generic value assigned to the member */};#define create_array _glp_mpl_create_arrayARRAY *create_array(MPL *mpl, int type, int dim);/* create array */#define find_member _glp_mpl_find_memberMEMBER *find_member(     MPL *mpl,      ARRAY *array,           /* not changed */      TUPLE *tuple            /* not changed */);/* find array member with given n-tuple */#define add_member _glp_mpl_add_memberMEMBER *add_member(     MPL *mpl,      ARRAY *array,           /* modified */      TUPLE *tuple            /* destroyed */);/* add new member to array */#define delete_array _glp_mpl_delete_arrayvoid delete_array(     MPL *mpl,      ARRAY *array            /* destroyed */);/* delete array *//**********************************************************************//* * *                 DOMAINS AND DUMMY INDICES                  * * *//**********************************************************************/struct DOMAIN{     /* domain (a simple or compound set); syntactically domain looks         like '{ i in I, (j,k) in S, t in T : <predicate> }'; domains         are used to define sets, over which model objects are indexed,         and also as constituents of iterated operators */      DOMAIN_BLOCK *list;      /* linked list of domain blocks (in the example above such blocks         are 'i in I', '(j,k) in S', and 't in T'); this list cannot be         empty */      CODE *code;      /* pseudo-code for computing the logical predicate, which follows         the colon; NULL means no predicate is specified */};struct DOMAIN_BLOCK{     /* domain block; syntactically domain blocks look like 'i in I',         '(j,k) in S', and 't in T' in the example above (in the sequel         sets like I, S, and T are called basic sets) */      DOMAIN_SLOT *list;      /* linked list of domain slots (i.e. indexing positions); number         of slots in this list is the same as dimension of n-tuples in         the basic set; this list cannot be empty */      CODE *code;      /* pseudo-code for computing basic set; cannot be NULL */      TUPLE *backup;      /* if this n-tuple is not empty, current values of dummy indices         in the domain block are the same as components of this n-tuple         (note that this n-tuple may have larger dimension than number         of dummy indices in this block, in which case extra components         are ignored); this n-tuple is used to restore former values of         dummy indices, if they were changed due to recursive calls to         the domain block */      DOMAIN_BLOCK *next;      /* the next block in the same domain */};struct DOMAIN_SLOT{     /* domain slot; it specifies an individual indexing position and         defines the corresponding dummy index */      char *name;      /* symbolic name of the dummy index; null pointer means the dummy         index is not explicitly specified */      CODE *code;      /* pseudo-code for computing symbolic value, at which the dummy         index is bound; NULL means the dummy index is free within the         domain scope */      SYMBOL *value;      /* current value assigned to the dummy index; NULL means no value         is assigned at the moment */      CODE *list;      /* linked list of pseudo-codes with operation O_INDEX referring         to this slot; this linked list is used to invalidate resultant         values of the operation, which depend on this dummy index */      DOMAIN_SLOT *next;      /* the next slot in the same domain block */};#define assign_dummy_index _glp_mpl_assign_dummy_indexvoid assign_dummy_index(     MPL *mpl,      DOMAIN_SLOT *slot,      /* modified */      SYMBOL *value           /* not changed */);/* assign new value to dummy index */#define update_dummy_indices _glp_mpl_update_dummy_indicesvoid update_dummy_indices(     MPL *mpl,      DOMAIN_BLOCK *block     /* not changed */);/* update current values of dummy indices */#define enter_domain_block _glp_mpl_enter_domain_blockint enter_domain_block(     MPL *mpl,      DOMAIN_BLOCK *block,    /* not changed */      TUPLE *tuple,           /* not changed */      void *info, void (*func)(MPL *mpl, void *info));/* enter domain block */#define eval_within_domain _glp_mpl_eval_within_domainint eval_within_domain(     MPL *mpl,      DOMAIN *domain,         /* not changed */      TUPLE *tuple,           /* not changed */      void *info, void (*func)(MPL *mpl, void *info));/* perform evaluation within domain scope */#define loop_within_domain _glp_mpl_loop_within_domainvoid loop_within_domain(     MPL *mpl,      DOMAIN *domain,         /* not changed */      void *info, int (*func)(MPL *mpl, void *info));/* perform iterations within domain scope */#define out_of_domain _glp_mpl_out_of_domainvoid out_of_domain(     MPL *mpl,      char *name,             /* not changed */      TUPLE *tuple            /* not changed */);/* raise domain exception */#define get_domain_tuple _glp_mpl_get_domain_tupleTUPLE *get_domain_tuple(     MPL *mpl,      DOMAIN *domain          /* not changed */);/* obtain current n-tuple from domain */#define clean_domain _glp_mpl_clean_domainvoid clean_domain(MPL *mpl, DOMAIN *domain);/* clean domain *//**********************************************************************//* * *                         MODEL SETS                         * * *//**********************************************************************/struct SET{     /* model set */      char *name;      /* symbolic name; cannot be NULL */      char *alias;      /* alias; NULL means alias is not specified */      int dim; /* aka arity */      /* dimension (number of subscripts); dim = 0 means 0-dimensional         (unsubscripted) set, dim > 0 means set of sets */      DOMAIN *domain;      /* subscript domain; NULL for 0-dimensional set */      int dimen;      /* dimension of n-tuples, which members of this set consist of         (note that the model set itself is an array of elemental sets,         which are its members; so, don't confuse this dimension with         dimension of the model set); always non-zero */      WITHIN *within;      /* list of supersets, which restrict each member of the set to be         in every superset from this list; this list can be empty */      CODE *assign;      /* pseudo-code for computing assigned value; can be NULL */      CODE *option;      /* pseudo-code for computing default value; can be NULL */      GADGET *gadget;      /* plain set used to initialize the array of sets; can be NULL */      int data;      /* data status flag:         0 - no data are provided in the data section         1 - data are provided, but not checked yet         2 - data are provided and have been checked */      ARRAY *array;      /* array of members, which are assigned elemental sets */};struct WITHIN{     /* restricting superset list entry */      CODE *code;      /* pseudo-code for computing the superset; cannot be NULL */      WITHIN *next;      /* the next entry for the same set or parameter */};struct GADGET{     /* plain set used to initialize the array of sets with data */      SET *set;      /* pointer to plain set; cannot be NULL */      int ind[20]; /* ind[dim+dimen]; */      /* permutation of integers 1, 2, ..., dim+dimen */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -