bug-glpk
[Top][All Lists]
Advanced

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

[Bug-glpk] Re: LP solution returned after solving MIP successfully


From: Mritunjay Singh
Subject: [Bug-glpk] Re: LP solution returned after solving MIP successfully
Date: Sun, 24 Aug 2003 17:04:11 -0700 (PDT)

I found the problem. I was using the wrong methods. I should have used 
getMIPCol(col)
instead of getColInfo(col). 

However, I think I see another bug. this one's in the java interface:
The method  getMIPObj requires an int parameter. However, the file glpk.c does 
not list
any int parameter. This leads to an unsatisfiedLinkError when using this 
function. Fixing
the one line (line 221) in GlpkSolver.java fixed the problem
-M

----- Original Message ----- 
From: "Mritunjay Singh" <address@hidden>
To: <address@hidden>
Sent: Sunday, August 24, 2003 4:30 PM
Subject: LP solution returned after solving MIP successfully


> I have a small MIP in an mps file (attached). I tried solving it using glpsol 
> and got
the
> correct result (both the objective value and variable values were correct). 
> 
> I then tried using the java interface to read the same mps file and solve it. 
> I had
> logging turned on. The logs showed that it first found the correct LP 
> solution and then
> the correct IP solution. 
> 
> However when I use the java procedural interface to read back the solution I 
> get the
> solution of the LP not the IP.
> 
> With reference to the mps file, please note that C0000043, C0000044, C0000045 
> are
integer
> (binary) variables but the solution has them with fractional values. The LP 
> optimal
> objective value is 104 and the IP optimal is 3839.
> 
> Here's the relevant portion of the java program:
> 
>     GlpkSolver lp = GlpkSolver.readMps("GLPK.mps");
>     lp.enablePrints(true);
>     lp.advBasis();
>     lp.scaleProb();
>     lp.simplex();
>     lp.integer();
> 
>     double objective = lp.getObjVal();
> 
>     double[] solution = new double[numVars];
>     GlpkSolverInfo lpSolverInfo = new GlpkSolverInfo();
>     for(int i=0;i<numVars;i++)
>     { 
>       lp.getColInfo(i+1, lpSolverInfo);
>       solution[i] = lpSolverInfo.vx;
>     }


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




reply via email to

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