-------- Forwarded Message --------
From: Eeri Kask <[email protected]>
To: [email protected]
Subject: glpsol.c: MIP-return code possibly ignored (overwritten)?
Date: Wed, 2 Feb 2022 09:33:20 +0100
> Dear Professor Makhorin,
>
> we tested glpsol version 5.0 executable and discovered a possible bug,
> please see attached patch which is not a clean bugfix but only
> demonstrates our finding and provides a quick workaround (for us). :-)
>
> We are very successfully using glpsol as an external solver in a
> vehicle
> fleet routing application and heavily rely on the return code of the
> standalone glpsol executable: if this return code is not EXIT_SUCCESS
> (i.e. 0) then the rest of the system assumes that particular traffic
> routing setting has no (mixed integer programming) solution.
>
> Now, due to the issue we discovered, in some situations the simplex
> method (as the first part in your implementation) returns a LP-
> solution,
> but then the MIP-refinement which follows, does not find a MIP-
> solution,
> and this failure does not reflect in the return code of the glpsol
> executable.
>
>
> P.S. In the patch I marked with /* !! */ that place which affects us.
>
>
> With kind regards,
>
> Eeri Kask
>
--- glpk-5.0/examples/glpsol.c.orig 2022-02-01 16:06:23.078400600 +0100
+++ glpk-5.0/examples/glpsol.c 2022-02-01 17:25:12.031395200 +0100
@@ -955,7 +955,7 @@
#endif
{ /* stand-alone LP/MIP solver */
struct csa _csa, *csa = &_csa;
- int ret;
+ int ret = EXIT_SUCCESS;
#if 0 /* 10/VI-2013 */
glp_long start;
#else
@@ -1457,7 +1457,7 @@
else if (csa->solution == SOL_INTEGER)
{ if (!(glp_mip_status(csa->prob) == GLP_OPT ||
glp_mip_status(csa->prob) == GLP_FEAS))
- ret = -1;
+ ret = -1; /* !! */
else
ret = glp_mpl_postsolve(csa->tran, csa->prob, GLP_MIP);
}
@@ -1534,7 +1534,6 @@
}
/*--------------------------------------------------------------*/
/* all seems to be ok */
- ret = EXIT_SUCCESS;
/*--------------------------------------------------------------*/
done: /* delete the LP/MIP problem object */
if (csa->prob != NULL)