Please also note that there is a C# wrapper for GLPK called GLPKSharp that you can find here http://yoyovicksblog.blogspot.com/ Although I didn't update it for a while, it is meant to ease the development of C# application using GLPK.
Thanks, YO. ----- Message d'origine ---- De : Andrew Makhorin <[EMAIL PROTECTED]> À : ms <[EMAIL PROTECTED]> Cc : [email protected] Envoyé le : Dimanche, 11 Novembre 2007, 18h35mn 23s Objet : Re: [Help-glpk] GLPK 4_23 internal error in call back > I am using GLPK 4.23 for solving a MIP problem and using call back suggested > by Andrew Makhorin to exit when the MIP gap is <= 5% > --------------------------------------------------- > void cb_func(glp_tree *tree, void *info) > { if (glp_ios_reason(tree) == GLP_IBINGO) > { if (glp_ios_mip_gap(tree) < 0.10) > glp_ios_terminate(tree); > } > . . . > } > int main(void) > { glp_prob *mip; > glp_iocp parm; > . . . > glp_init_iocp(&parm); > parm.cb_func = cb_func; > glp_intopt(mip, &parm); > . . . > } > ------------------------------------------------------------------------------------- > The call back works fine upto certain point when I get the following error: > GLPK internal error: lp->tree == NULL; file ..\src\glpapi01.c, line 1147 > I compiled the source using VS2005 and calling the API's in C#. If I don't > use use call backs the program works fine. But I don't have control over the > mip gap. Any suggestion will be appreciated. > Sam > -------------output----------------------------------------- > 11:02:09 AM * 1341: objval = 8.225886544e+002 infeas = > 5.280220705e-013 (0) > 11:02:09 AM OPTIMAL SOLUTION FOUND > 11:02:09 AM Integer optimization begins... > Gap = 1.79769313486232E+308 Reason = 6 > Gap = 1.79769313486232E+308 Reason = 7 > 11:02:10 AM + 1341: mip = not found yet >= -inf (1; > 0) > Gap = 1.79769313486232E+308 Reason = 1 > Gap = 1.79769313486232E+308 Reason = 3 > Gap = 1.79769313486232E+308 Reason = 4 > Gap = 1.79769313486232E+308 Reason = 5 > Gap = 1.79769313486232E+308 Reason = 7 > 11:02:13 AM + 1341: mip = not found yet >= 8.225886544e+002 (2; > 0) > Gap = 1.79769313486232E+308 Reason = 1 > Gap = 1.79769313486232E+308 Reason = 3 > Gap = 1.79769313486232E+308 Reason = 4 > Gap = 1.79769313486232E+308 Reason = 5 > Gap = 1.79769313486232E+308 Reason = 7 > 11:02:17 AM + 1345: mip = not found yet >= 8.225886544e+002 (3; > 0) > 11:02:17 AM GLPK internal error: lp->tree == NULL; file ..\src\glpapi01.c, > line 1147 Looks like you call glp_delete_prob (directly or indirectly) in the callback routine that is not allowed (there must be an error message which is not implemented yet). The callback routine should only call glp_ios_terminate and return, in which case glp_intopt will return immediately with the code GLP_ESTOP. _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
