Re: How to retrieve intermediate solutions of MIP problems without interrupting the solver?
Domingo Alvarez Duarte <[email protected]> Mon, 10 Aug 2020 12:00:04 +0200
| Newsgroups | gmane.comp.gnu.glpk |
|---|---|
| Message-ID | <[email protected]> |
Hello Heinrich !
Thank you for reply !
My bad, I did followed the code instead of reading the manual !
There is a old saying:
When everything else fails, read the manual !
Cheers !
On 10/8/20 11:56, Heinrich Schuchardt wrote:
> On 10.08.20 11:47, Domingo Alvarez Duarte wrote:
>> Hello Yuri !
>>
>> Following the code again I found this lines in examples/glpsol.c:
>>
>> ====
>>
>> #ifdef GLP_CB_FUNC /* 05/IV-2016 */
>> { extern void GLP_CB_FUNC(glp_tree *, void *);
>> csa->iocp.cb_func = GLP_CB_FUNC;
>> csa->iocp.cb_info = NULL;
>> }
>> #endif
>>
>> ====
>>
>> It seems that the user callback can be set that way but could not found
>> any other reference so far.
>
> The callback is described in chapter 5.1.1 "Using the callback routine"
> of doc/glpk.pdf. There is a reason code
>
> GLP_IBINGO — better integer solution found.
>
> Best regards
>
> Heinrich
>
>
>> Cheers !
>>
>> On 9/8/20 20:04, Yuri wrote:
>>> For my problem Glpk quickly finds some solution and then goes on to
>>> find better solutions and this takes a lot of time.
>>>
>>>
>>> I'm interested in all solutions, beginning from the first integer
>>> solution in finds.
>>>
>>> I couldn't find a callback that is called when a better solution
>>> becomes known.
>>>
>>>
>>> For example, in this run it called glp_intopt which progressively
>>> found 3 solutions, each better than the previous one:
>>>
>>> Long-step dual simplex will be used
>>> + 633: mip = not found yet >= -inf (1; 0)
>>> + 1006: >>>>> 1.098691667e+01 >= 5.512339583e+00 49.8% (18; 0)
>>> + 4134: >>>>> 1.098525000e+01 >= 6.681520833e+00 39.2% (31; 22)
>>> + 7210: >>>>> 1.098458333e+01 >= 1.043275926e+01 5.0% (24; 87)
>>> + 7654: mip = 1.098458333e+01 >= tree is empty 0.0% (0; 195)
>>> INTEGER OPTIMAL SOLUTION FOUND
>>>
>>> I am looking for access to all of them as they become available.
>>>
>>>
>>> Yuri
>>>
>>>
>>>