[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Bug-glpk] Bug with objective value

**From**: |
Andrew Makhorin |

**Subject**: |
Re: [Bug-glpk] Bug with objective value |

**Date**: |
Tue, 27 Oct 2015 14:40:48 +0300 |

Thank you for your report.
>* I might have found a bug when displaying the objective value after*
>* solving a problem.*
>* I am using GLPK 4.56 compiled as w64 command line application and*
>* solving the attached model using the command „glpsol –m test.mod –o*
>* test.sol“*
>* In the mod-file there is a display command at line 179 „display*
>* OOBJ_MDemSho;“ which gives -1481981.40399653. However, this is not the*
>* correct objective value – which would be -3.565219231e-010 (or 0). In*
>* line 180, there is a display command with the term of the objective,*
>* which gives the correct result.*
>* Also, in the sol-file you see both values: In line 6 it says*
>* “Objective: OOBJ_MDemSho = -3.565219231e-010 (MINimum)” and in line*
>* 10 it states “ 1 OOBJ_MDemSho B -1.48198e+006*
>* “*
>* One possible explanation might be, that primal and dual value of the*
>* objective are mixed up. However, GLPK gives the same result with both*
>* simplex algorithms as well as the interior point algorithm.*
>* Could you have a look into this matter?*
There is no bug. OOBJ_MDemSho is a row, not column (variable), in which
case OOBJ_MDemSho.val means the value of corresponding linear form
(please see the GNU MathProg manual). Thus, if the row includes a
constant term (as in your case), it is carried to the right-hand side,
and if the row is free (as in your case), the constant term is simply
ignored. On the other hand, on writing the solution to a text file
glpsol prints the value of corresponding auxiliary variable, not linear
form, so it includes the constant term, and you see the correct result.
To avoid this issue you may introduce a variable which is the objective,
i.e. rather than writing like this:
minimize OOBJ_MDemSho: (sum{(f_1, ...
you may write as follows:
var OOBJ_MDemSho;
s.t. foo OOBJ_MDemSho = (sum{(f_1, ...
minimize obj: OOBJ_MDemSho;
...
display OOBJ_MDemSho; # will display correct value
Hope this helps.
Andrew Makhorin

[Prev in Thread] |
**Current Thread** |
[Next in Thread] |

**Re: [Bug-glpk] Bug with objective value**,
*Andrew Makhorin* **<=**