[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] How to provide to the GLPK MIP solver a integer feasible
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] How to provide to the GLPK MIP solver a integer feasible solution |
Date: |
Sun, 14 Apr 2013 17:05:38 +0400 |
On Mon, 2013-04-08 at 18:45 +0200, Giorgio Sartor wrote:
> 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?
No. This feature is mainly intended to use a previously obtained
solution for further processing in MathProg models, because the solution
process may take a long time. Currently the mip solver does not use it.
> 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.
This may only mean that optimal solution to the root lp relaxation is
integer feasible, and therefore the mip has been solved.
>
>
> 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