help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] not retrieving integer solutions


From: Meketon, Marc
Subject: [Help-glpk] not retrieving integer solutions
Date: Thu, 12 Jul 2012 17:14:39 -0500

I am solving a small integer program (37 rows and 29 columns) using the C# interface from http://yoyovicks.blog.free.fr/

 

I’ve tested the code on quite a few datasets and it worked fine.  But today I changed some objective function coefficients (just changed the sign of them), and for one particular problem I’m retrieving non-integer results despite the fact that an integer optimal was found.

 

The snippet of the code that calls the solver is (I simplified the error handling for this example):

            GlpkSharp.SOLVERSTATUS simplexOptStatus = patternProblem.SolveSimplex();

            if (simplexOptStatus == GlpkSharp.SOLVERSTATUS.Solved)

            {

                GlpkSharp.SOLVERSTATUS intOptStatus = patternProblem.SolveInteger();

                if (intOptStatus == GlpkSharp.SOLVERSTATUS.Solved)

                {

                    for (int i = 1; i <= 14; i++)

                    {

                        double x = patternProblem.GetColPrimal(i);

                        string col = patternProblem.GetColName(i);

                        GlpkSharp.COLKIND colKind = patternProblem.GetColKind(i);

 

                        if (x > 0.0)

                        {

                            Console.WriteLine("{0}\t{1}\t of type {2}", col, x, colKind.ToString());

                        }

                    }

                }

            }

 

The output from GLPK is:

GLPK Simplex Optimizer, v4.45

37 rows, 29 columns, 147 non-zeros

      0: obj =  0.000000000e+000  infeas = 1.050e+002 (9)

*    13: obj = -5.000000000e-001  infeas = 0.000e+000 (1)

*    14: obj = -4.500000000e-001  infeas = 0.000e+000 (1)

OPTIMAL SOLUTION FOUND

GLPK Integer Optimizer, v4.45

37 rows, 29 columns, 147 non-zeros

28 integer variables, 14 of which are binary

Integer optimization begins...

+    14: mip =     not found yet <=              +inf        (1; 0)

+    15: >>>>> -5.000000000e-001 <= -5.000000000e-001   0.0% (2; 0)

+    15: mip = -5.000000000e-001 <=     tree is empty   0.0% (0; 3)

INTEGER OPTIMAL SOLUTION FOUND

 

And the output from the Console.WriteLine(…) that shows the retrieved – non integer – answers is:

xWeTh  1      of type Integer

xFrSa  0.5    of type Integer

xSaSu  4.5    of type Integer

xSuMo  1      of type Integer

xTu    1      of type Integer

xFr    1.5    of type Integer

xSa    2      of type Integer

xSu    4.5    of type Integer

 

Would anyone have a guess why the output is non-integer despite solving to integer optimality and double-checking that these variables are integer?

 

BTW, when I write the problem out to GLPK format, and solve it using glpsol, the output is fully integer.



This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation.

reply via email to

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