[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Stop B&B at first feasible solution
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Stop B&B at first feasible solution |
Date: |
Tue, 7 Aug 2007 14:12:00 +0400 |
>>> I would like to know if there a possibility to make GLPK stop as
>>> soon as a feasible solution is found.
>>
>> It is possible only on api level.
> I was indeed looking for a solution on API level.
> Do you mean I nedd to use the new callback mechanism ?
Yes, I do.
> I thought there
> would be a way such as setting a control parameter (using
> lpx_set_int_parm). I haven't found any in the documentation.
It would require too much control parameters, so using callback is
a more appropriate way.
> Can you tell me how to do this ?
void cb_func(glp_tree *tree, void *info)
{ if (glp_ios_reason(tree) == GLP_IBINGO)
glp_ios_terminate(tree);
return;
}
And somewhere in main():
glp_prob *mip;
glp_iocp parm;
. . .
glp_simplex(mip, NULL);
glp_init_iocp(&parm);
parm.cb_func = cb_func;
glp_intopt(mip, &parm);
. . .