From 5b9d44015126084452917dea28906bf94d855292 Mon Sep 17 00:00:00 2001 From: Yu Xie Date: Thu, 30 Nov 2023 00:25:47 -0500 Subject: [PATCH 1/4] change D_ITLIM to TIME_LIMIT for termcode from Clp --- src/LP/lp_solver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LP/lp_solver.c b/src/LP/lp_solver.c index 46af6ced..d005626e 100644 --- a/src/LP/lp_solver.c +++ b/src/LP/lp_solver.c @@ -2715,6 +2715,8 @@ int dual_simplex(LPdata *lp_data, int *iterd) }else if (si->isIterationLimitReached()){ term = LP_D_ITLIM; #ifdef __OSI_CLP__ + // YX: reset term if Clp; Clp may return ITLIM at timeout + term = LP_TIME_LIMIT; /* If max iterations and had switched to primal, bound is no good */ if (si->getModelPtr()->secondaryStatus() == 10){ term = LP_ABANDONED; From ab86d49fed2ff8f40963a088e001bf3907a83f30 Mon Sep 17 00:00:00 2001 From: Yu Date: Mon, 4 Mar 2024 21:34:51 -0500 Subject: [PATCH 2/4] add a condition on iteration limit before reset Clp term code --- src/LP/lp_solver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/LP/lp_solver.c b/src/LP/lp_solver.c index d005626e..a356f28c 100644 --- a/src/LP/lp_solver.c +++ b/src/LP/lp_solver.c @@ -2715,8 +2715,12 @@ int dual_simplex(LPdata *lp_data, int *iterd) }else if (si->isIterationLimitReached()){ term = LP_D_ITLIM; #ifdef __OSI_CLP__ - // YX: reset term if Clp; Clp may return ITLIM at timeout - term = LP_TIME_LIMIT; + // YX: reset term if needed; Clp may return ITLIM at timeout + int itlim_chk = -1; + retval = si->getIntParam(OsiMaxNumIteration, itlim_chk); + if (itlim_chk >= LP_MAX_ITER){ + term = LP_TIME_LIMIT; + } /* If max iterations and had switched to primal, bound is no good */ if (si->getModelPtr()->secondaryStatus() == 10){ term = LP_ABANDONED; From cdd7c0423f02686f5b06f17832c76672efc3f863 Mon Sep 17 00:00:00 2001 From: Yu Date: Wed, 6 Mar 2024 16:48:18 -0500 Subject: [PATCH 3/4] change the condition check to compare iter number --- src/LP/lp_solver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LP/lp_solver.c b/src/LP/lp_solver.c index a356f28c..39c5a06d 100644 --- a/src/LP/lp_solver.c +++ b/src/LP/lp_solver.c @@ -2717,8 +2717,8 @@ int dual_simplex(LPdata *lp_data, int *iterd) #ifdef __OSI_CLP__ // YX: reset term if needed; Clp may return ITLIM at timeout int itlim_chk = -1; - retval = si->getIntParam(OsiMaxNumIteration, itlim_chk); - if (itlim_chk >= LP_MAX_ITER){ + retval = si->getIntParam(OsiMaxNumIteration, itlim_chk); + if (si->getIterationCount() < itlim_chk){ term = LP_TIME_LIMIT; } /* If max iterations and had switched to primal, bound is no good */ From 6341c2c7fbd0c5a2978aaa310a421fcd58994599 Mon Sep 17 00:00:00 2001 From: Yu Date: Fri, 15 Mar 2024 22:18:11 -0400 Subject: [PATCH 4/4] apply same change to initial_lp_solve() and solve_hotstart() --- src/LP/lp_solver.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/LP/lp_solver.c b/src/LP/lp_solver.c index 39c5a06d..5741ad2b 100644 --- a/src/LP/lp_solver.c +++ b/src/LP/lp_solver.c @@ -2598,6 +2598,12 @@ int initial_lp_solve (LPdata *lp_data, int *iterd) }else if (si->isIterationLimitReached()){ term = LP_D_ITLIM; #ifdef __OSI_CLP__ + // YX: reset term if needed; Clp may return ITLIM at timeout + int itlim_chk = -1; + retval = si->getIntParam(OsiMaxNumIteration, itlim_chk); + if (si->getIterationCount() < itlim_chk){ + term = LP_TIME_LIMIT; + } /* If max iterations and had switched to primal, bound is no good */ if (si->getModelPtr()->secondaryStatus() == 10){ term = LP_ABANDONED; @@ -2825,9 +2831,17 @@ int solve_hotstart(LPdata *lp_data, int *iterd) term = LP_D_OBJLIM; else if (si->isProvenOptimal()) term = LP_OPTIMAL; - else if (si->isIterationLimitReached()) + else if (si->isIterationLimitReached()){ term = LP_D_ITLIM; - else if (si->isAbandoned()) +#ifdef __OSI_CLP__ + // YX: reset term if needed; Clp may return ITLIM at timeout + int itlim_chk = -1; + retval = si->getIntParam(OsiMaxNumIteration, itlim_chk); + if (si->getIterationCount() < itlim_chk){ + term = LP_TIME_LIMIT; + } +#endif + }else if (si->isAbandoned()) term = LP_ABANDONED; /* if(term == D_UNBOUNDED){