help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] [Fwd: Get the MIp relative gap at the end of the optimizatio


From: Andrew Makhorin
Subject: [Help-glpk] [Fwd: Get the MIp relative gap at the end of the optimization]
Date: Tue, 19 Jul 2011 23:29:33 +0400

-------- Forwarded Message --------
From: oguyon <address@hidden>
To: address@hidden
Subject: [Help-glpk] Get the MIp relative gap at the end of the
optimization
Date: Tue, 19 Jul 2011 05:45:35 -0700 (PDT)

Hi,

I want to solve a MIP model with two successive stop criterion.

1- I want to find the optimal solution within a specific duration (X ms).
2- If, after X ms, the optimal solution has not been found. I'm looking for
a "good" solution without any time limit.

To do that, I first fix the time limit parameter to X ms (iocp.setTm_lim(X))
and I solve the model. Then, if my solution is not "good" (i.e. the MIP
relative gap is too big): I fix the time limit parameter to a big value, I
fix the MIP gap parameter to a value Y (iocp.setMip_gap(Y)) and I solve the
MIP model a second time. 

My problem is that I don't succeed in finding the MIP relative gap at the
end of the first "optimization". The only interesting function that I've
found is : glp_ios_mip_gap(glp_tree arg) ; but I don't have a clue about
what is the tree I have to put in argument.

I'm using glpk 4.45 through a Java environnement (JRE 1.6.0_24).

Here is my full code :

protected double solveApprox(){
int X=5000; Y=0.01, ret;
boolean succes;
glp_iocp iocp = new glp_iocp();
GLPK.glp_init_iocp(iocp);
iocp.setTm_lim(X);
ret = GLPK.glp_intopt(model, iocp);     
if(ret!=0)
        success = false;
else{
        epGap = ????? GLPK.glp_ios_mip_gap(arg0) ????
        }
success = (epGap<=relativeMIPGap);
if(success){
        resu = GLPK.glp_mip_obj_val(model);
} else {
        iocp.setTm_lim(Integer.MAX_VALUE);
        iocp.setMip_gap(Y);
        ret = GLPK.glp_intopt(model, iocp);
        success = (ret == 0);
        if(success){
                resu = GLPK.glp_mip_obj_val(model);
        }
}
return resu;
}

Thank you for your help,
Olivier Guyon






reply via email to

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