help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Re: MPS does not reflect LP in memory


From: Andrew Makhorin
Subject: [Help-glpk] Re: MPS does not reflect LP in memory
Date: Mon, 07 Jul 2003 16:16:11 +0400

>1. I instantiate an LP from a MathProg model.
>2. I change a coefficient in the objective
>3. I solve the problem
>4. I dump an MPS and the solution
>
>But, when I change the coefficient and dump the MPS just after, I do not see 
>the modification of the coefficient. It is still the coefficient read from 
>the LP model.
>
>However, when I solve the LP, it has kept the coefficient modification !

When the routine lpx_read_model constructs the LPX problem object, it
specifies the objective coefficients via lpx_set_col_coef and also it
creates a free (unbounded) row which is a copy of the objective row with
the same coefficients via lpx_set_row_coef, i.e. in LPX there are two
copies of the objective row. Since you change the objective via
lpx_set_col_coef, the row which is a copy of the objective row remains
unchanged. By default, when lpx_write_mps sees a free row in your problem
object, it thinks that it is an objective row. This behavior is used by
default, because MPS format has no features to specify the objective
coefficients explicitly. You need to change that behavior as follows:

   lpx_set_int_parm(lp, LPX_K_MPSOBJ, 1);

in which case lpx_write_mps does not consider a first free row as the
objective row. Another way is to remove a free row which is a copy of
the objective row from the problem object. For details see Subsection
2.11.6 "Parameter list" in the glpk manual.





reply via email to

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