help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Can I combine "glp_mpl_read_model(, , 1)" with programma


From: Andrew Makhorin
Subject: Re: [Help-glpk] Can I combine "glp_mpl_read_model(, , 1)" with programmatically supplied data and also programmatically access results?
Date: Tue, 07 Feb 2012 15:00:49 +0300

> I have a MathProg model on the one hand and want to supply its input
> not using glp_mpl_read_data(), but programmatically on the other hand.

There is no way to provide model data other than specifying them in the
data section, i.e. in a text file.

> Also I want to fetch the results after calling the solver not via a
> file, but programmatically.

> How can I do this, which is the correct order of API routines to call?
> Skimming through the examples I did not find similar code, but I may
> have overlooked something, of course.
> 

You can obtain solution components directly from the glp_prob object
(built with glp_mpl_build_prob). For example, to retrieve the value of a
column (variable) you can use glp_get_col_prim. Glp_mpl_build_prob
provides symbolic names of rows and columns; for example, MathProg
variable x[1,a] is assigned the name "x[1,a]". These names can be used
to determine ordinal numbers of corresponding rows and columns (with
routines glp_find_row and glp_find_col). 

If your model has a simple structure, I'd suggest build it with glpk api
routines, i.e. not to use MathProg description at all. This is quite
easy and would resolve most interface problems.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]