help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Maximize using MPS file called from C


From: Andrew Makhorin
Subject: Re: [Help-glpk] Maximize using MPS file called from C
Date: Thu, 5 Nov 2009 17:12:54 +0300

> /* sllp.c */

> #include <stdio.h>
> #include <stdlib.h>
> #include <glpk.h>

> int main(void)
> {     glp_prob *P;
>   P = glp_create_prob();
>   glp_set_obj_dir(P, GLP_MAX);
>   glp_read_mps(P, GLP_MPS_FILE, NULL, "sllp.mps");
>   glp_simplex(P, NULL);
>   lpx_print_sol(P, "sllp.txt");
>   glp_write_sol(P, "sllpsol.txt");
>   glp_delete_prob(P);
>   return 0;
> }

> /* eof */

Glp_read_mps calls glp_erase_prob, which discards all data stored in
the problem object. Therefore you should call glp_set_obj_dir *after*
glp_read_mps.






reply via email to

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