Re: MathProg, glpk and C language
Michael Hennebry <[email protected]>
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 4 Oct 2017, Lyndon D'Arcy wrote:
> Below is some example code for reading MathProg using my extension:
>
> int status;
> char *buf = "var x1;\
> var x2;\
> maximize obj: 0.6 * x1 + 0.5 * x2;\
> s.t. c1: x1 + 2 * x2 <= 1;\
> s.t. c2: 3 * x1 + x2 <= 2;\
> end;";
> glp_prob *lp;
> glp_tran *tran = glp_mpl_alloc_wksp();
> status = glp_mpl_read_buffer_into_model(tran, buf, strlen(buf), 0);
> ck_assert_int_eq(status, 0);
> if (!status) {
> status = glp_mpl_generate(tran, NULL);
> if (!status) {
> lp = glp_create_prob();
> glp_mpl_build_prob(tran, lp);
> }
> }
> glp_mpl_free_wksp(tran);
> glp_delete_prob(lp);
> glp_free_env();
The example does not solve the problem or retrieve the solution.
--
Michael [email protected]
"Sorry but your password must contain an uppercase letter, a number,
a haiku, a gang sign, a heiroglyph, and the blood of a virgin."
-- someeecards