[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] OPB output file anomaly
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] OPB output file anomaly |
Date: |
Tue, 11 Mar 2008 03:51:47 +0300 |
> Thanks for the explanation on MPS format. I think I understand
> what you mean by doubling of rows due to objective function/free
> rows. This does still leave me confused however. The issue, from my
> perspective, is that I can do the following:
> 1. Use glpsol with input files a.mod and a.dat (mathprog format) to
> get solution.
> 2. I can also write out a.mps and a.cplex (and a.opb for that matter)
> using glpsol.
> 3. Now if I use glpsol on a.mps or a.cplex I get a different
> answer from step #1, and that difference is the constant in the
> objective (which is now missing).
> So, more concretely:
> glpsol --math -m a.mod -d a.dat --wcpxlp a.cplex
> /* and subsequently */
> glpsol --cpxlp a.cplex
> provides different solutions.
> Something just doesn't seem right about that. Am I still missing
> something fundamental here?
> I looked at the cplex file as you suggested and I see at the end of
> the objective function a comment line:
> \* constant term = -240720 *\
> And that, as I mentioned, is the difference between the solution in
> cplex input mode and the original mathprog mode. Should the user just
> know to look for this comment in the cplex file to verify his/her
> solution?
> Any further clarification appreciated. Thanks again for helping me
> understand this situation.
In principle, you may include the statement
lpx_set_int_parm(LPX_K_MPSOBJ, 1);
immediately before a call to lpx_write_mps or lpx_write_freemps
(for example, in glplpx20.c). Then the objective function row will
always be written in output mps file, including the constant term.
Another, a better way to resolve the issue is to define a dummy
variable fixed at 1. For example:
var one = 1;
. . .
minimize z: ... + 123.456 * one;
where 123.456 is a constant term.