help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] How to provide to the GLPK MIP solver a integer feasible sol


From: Giorgio Sartor
Subject: [Help-glpk] How to provide to the GLPK MIP solver a integer feasible solution
Date: Mon, 8 Apr 2013 18:45:33 +0200

I have a model to which I can provide a initial feasible solution. 
How can I do that?
The GLPK reference manual offers two different methods: one is by using the routine glp_read_mip and the second is by using the callback routine glp_ios_heur_sol in response to the reason GLP_IHEUR.
Am i right?
First of all I can't find the differences between them. Moreover, it seems that none of them can help me.
Initially I tried with glp_read_mip:
...
glp_iocp parm;
glp_init_iocp(&parm); default values
glp_read_mip(mip, "initialsolution");
glp_simplex(mip, NULL);
glp_intopt(lp, &parm)
...
but it doesn't work and the MIP solver doesn't start from "initialsolution" (the solution is certainly integer feasible).
Am I using it in the correct way?
The second attempt was with the callback routine:

void callback(glp_tree *tree, void *info){
    switch(glp_ios_reason(tree)) {
        case GLP_IHEUR: glp_ios_heur_sol(tree, initsol);break;
        default: break;
    }
}

where initsol was the integer feasible array solution. The code was:
...
glp_iocp parm;
glp_init_iocp(&parm);
parm.cb_func = callback;
glp_simplex(mip, NULL);
glp_intopt(lp, &parm)
...

The GLPK manual says:
The callback routine is called with the reason code GLP_IHEUR if LP relaxation of the current subproblem being solved to optimality is integer infeasible...

But in my situation glp_simplex always founds the optimal solution to the LP relaxation so the GLP_IHEUR flag is never called and my initial solution is not loaded.

How can I solve this problem? Is there anyone that can explain to me the difference between the two methods and how to use them?

Gioker 


reply via email to

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