help-glpk
[Top][All Lists]
Advanced

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

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


From: Andrew Makhorin
Subject: Re: [Help-glpk] [Fwd: Get the MIp relative gap at the end of the optimization]
Date: Wed, 20 Jul 2011 13:18:32 +0400

> So, I've implemented a callback function for my purpose. Here is my code :
> 
> public void callback(glp_tree tree) {
>       long now = System.currentTimeMillis();
>       if(now - start >= 5000){
>               double mipGap = GLPK.glp_ios_mip_gap(tree);
>               if(mipGap <= 0.01){
>                       GLPK.glp_ios_terminate(tree);
>               }
>       }               
> }
> 
> But I still have a problem. The function GLPK.glp_ios_terminate(tree) does
> not make exactly what I want. In fact, it terminates the search by setting a
> status GLPKConstants.GLP_UNDEF to my model (even if GLPK has found an
> integer feasible solution). it's a problem for me. 
> 
> Does anyone know how to make a better termination of my program through the
> callback function, in order to get a status GLPKConstants.GLP_FEAS if an
> integer solution has already been found.
> 

If at least one integer feasible solution was found and you terminated
the search with glp_ios_terminate, glp_intopt must return GLP_ESTOP and
glp_mip_status must return GLP_FEAS (even if the mip preprocessor is
enabled). Please check your code.




reply via email to

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