Ok...I tried to solve my problem in another way. I used:

void callback(glp_tree *tree, void *info){

    switch(glp_ios_reason(tree)) {

        case GLP_IHEUR: glp_ios_heur_sol(tree, initsol);break;

        case GLP_IBINGO: glp_ios_heur_sol(tree, initsol);break;

        default: break;

    }

}

GLP_IBINGO is thrown if the presolver finds the optimal solution of the LP
relaxation. I recall that GLP_IHEUR is thrown if the optimal solution to
the LP relaxation is not found by the presolver. So I should be able to
lead an initial solution. I should.....but it doesn't work...

Moreover, I would want to try the routine glp_read_mip. Does anyone try
it?? Does anyone know how it works?? The manual is very synthetic on this
routine and it only says that it reads MIP solution from a file. It doesn't
say where that solution goes and how it is used by the solver.

Gioker


2013/4/9 Giorgio Sartor <[email protected]>

> Thanks Raniere and Haroldo...
>
> but my problem is that GLP_IHEUR is always OFF (or FALSE) because the
> presolver always finds the optimal solution to the LP relaxation, so the
> callback is never "called". How can I bypass that problem?
>
> Gioker
>
>
> 2013/4/9 Haroldo Santos <[email protected]>
>
>> Yes, it can be done using callbacks, but it would be nice if GLPK could:
>>
>> - read from command line (glpksol)
>> - enter in MathProg
>>
>>
>>
>> On Mon, Apr 8, 2013 at 10:36 PM, Raniere Silva 
>> <[email protected]>wrote:
>>
>>> Hi Giorgio,
>>>
>>> > I have a model to which I can provide a initial feasible solution.
>>> > How can I do that?
>>>
>>> I do long time ago (about 3 years).
>>>
>>> > Initially I tried with glp_read_mip:
>>>
>>> I didn't use that. Hope that some one can help you with that.
>>>
>>> > 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)
>>> > ...
>>>
>>> I used the callack function below:
>>>
>>> void callback(glp_tree *tree, void *info){
>>>     if(glp_ios_reason(tree) == GLP_IHEUR && glp_ios_curr_node(tree) ==
>>> 1){
>>>         glp_ios_heur_sol(tree, info);
>>>     }   /* -----  end if  ----- */
>>>
>>>     return ;
>>> }
>>>
>>> Raniere
>>>
>>> _______________________________________________
>>> Help-glpk mailing list
>>> [email protected]
>>> https://lists.gnu.org/mailman/listinfo/help-glpk
>>>
>>
>>
>>
>> --
>> =============================================================
>> Haroldo Gambini Santos
>> Computing Department
>> Universidade Federal de Ouro Preto - UFOP
>> email: haroldo [at ] iceb.ufop.br
>> home/research page: www.decom.ufop.br/haroldo
>>
>> _______________________________________________
>> Help-glpk mailing list
>> [email protected]
>> https://lists.gnu.org/mailman/listinfo/help-glpk
>>
>>
>
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to