Re: [Help-glpk] mathprog component information
Thanks for the quick reply. From glpmpl.h, while I can get some hints, i can't really find exactly what I need. The translator database is, generally speaking, a tree, which completely inherits the syntactic structure of the model. To translate the model and evaluate all model objects you need to call the following routines: mpl_initialize; mpl_read_model; mpl_read_data (if the data section is contained in a separate file); mpl_generate. A pointer returned by mpl_initialize() can be used to access the translator database. The essential information for this particular feature is: Which sets have been defined? mpl-stmt points to a list of statements in the order in which they appear in the model section. Walking through this list you find a STATEMENT instance whose type is A_SET (set statement) and using the member u.set you get access to the SET structure which describes corresponding set. The SET structure contains complete information about corresponding set, e.g. the member 'name' contains its symbolic name, etc. What is their arity? It is the member 'dim' in the SET structure. Once populated, what is their cardinality? The member 'array' in the SET structure points to the ARRAY structure which contains all members of corresponding set. The member 'size' of the ARRAY structure contains the number of array elements, which is the set cardinality. What params/vars/constraints/objs/ are indexed over which sets? Using pointers grouped in the union 'u' in the STATEMENT structure you get access to a structure describing corresponding model object. For example, the PARAMETER structure describes a model parameter and has the member 'domain' which points to the DOMAIN structure; the latter describes indexing expressions used for the corresponding parameter. If that is available through the routines in glpmpl.h, could someone please point them out to me? If you do not intend to modify the database, you do not need to call any model translator routines. All information can be obtained via direct access to the database structures through pointers. Andrew Makhorin ___ Help-glpk mailing list Help-glpk@gnu.org http://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] mathprog component information
In the AMPL language, the show command can be used to examine sets, variables, parameters, etc. GNU MathProg (a subset of AMPL implemented in glpk) currently does not support interactive mode. It has two statements: display and printf which can be used within the model description to output contents of model objects. Does glpk have an api that would allow the same kind of information to be obtained once a mathprog model is fed to glpk? The glpk model translator has its own api including a number of routines (mpl_initialize, mpl_read_model, mpl_read_data, etc.) which can be used separately in application program. These routines are not documented, however, they are provided with detailed comments which can be found in file glpmpl4.c below the fragment titled 'SOLVER INTERFACE'. (Afaik, the glpk model translator is used in Symphony, a mip package which is part of Coin-Or project, just to read ampl models; see http://en.wikipedia.org/wiki/COIN-OR_SYMPHONY ). If you need to get access to the translator database, this is also possible (see file glpmpl.h). However, all essential information can be obtained by api routines. Andrew Makhorin ___ Help-glpk mailing list Help-glpk@gnu.org http://lists.gnu.org/mailman/listinfo/help-glpk