Skip to content

Commit 69db9dd

Browse files
committed
Merge branch '3924-fix-scip-exact-mode-segfaults-double-free-on-exit-2' into 'master'
Resolve "SCIP exact mode segfaults (double free?) on exit" status See merge request integer/scip!3853
2 parents 9cb6102 + 2bc0c08 commit 69db9dd

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

src/scip/lpexact.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,7 @@ SCIP_RETCODE lpExactFlushAddRows(
21352135
lp->solved = FALSE;
21362136
lp->primalfeasible = FALSE;
21372137
lp->primalchecked = FALSE;
2138+
lp->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
21382139

21392140
return SCIP_OKAY;
21402141
}
@@ -2247,6 +2248,7 @@ SCIP_RETCODE lpExactFlushChgCols(
22472248
lp->solved = FALSE;
22482249
lp->dualfeasible = FALSE;
22492250
lp->dualchecked = FALSE;
2251+
lp->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
22502252
}
22512253

22522254
/* change bounds in LP */
@@ -2259,6 +2261,7 @@ SCIP_RETCODE lpExactFlushChgCols(
22592261
lp->solved = FALSE;
22602262
lp->primalfeasible = FALSE;
22612263
lp->primalchecked = FALSE;
2264+
lp->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
22622265
}
22632266

22642267
lp->nchgcols = 0;
@@ -2366,6 +2369,7 @@ SCIP_RETCODE lpExactFlushChgRows(
23662369
lp->solved = FALSE;
23672370
lp->primalfeasible = FALSE;
23682371
lp->primalchecked = FALSE;
2372+
lp->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
23692373
}
23702374

23712375
lp->nchgrows = 0;
@@ -3678,6 +3682,7 @@ SCIP_RETCODE SCIPlpExactFlush(
36783682
/* we can't retrieve the solution from Qsoptex after anything was changed, so we need to resolve the lp */
36793683
#ifdef SCIP_WITH_QSOPTEX
36803684
lp->solved = FALSE;
3685+
lp->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
36813686
#endif
36823687

36833688
assert(lp->nlpicols == lp->ncols);
@@ -7893,12 +7898,14 @@ SCIP_RETCODE lpExactRestoreSolVals(
78937898
storedsolvals = lpexact->storedsolvals;
78947899
if( storedsolvals != NULL )
78957900
{
7896-
lpexact->solved = storedsolvals->lpissolved;
78977901
#ifdef SCIP_WITH_QSOPTEX
78987902
lpexact->solved = FALSE;
7903+
lpexact->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
7904+
#else
7905+
lpexact->solved = storedsolvals->lpissolved;
7906+
lpexact->lpsolstat = storedsolvals->lpsolstat;
78997907
#endif
79007908
SCIPrationalSetRational(lpexact->lpobjval, storedsolvals->lpobjval);
7901-
lpexact->lpsolstat = storedsolvals->lpsolstat;
79027909
lpexact->primalfeasible = storedsolvals->primalfeasible;
79037910
lpexact->primalchecked = storedsolvals->primalchecked;
79047911
lpexact->dualfeasible = storedsolvals->dualfeasible;

src/scip/lpexact_bounding.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,12 +1206,18 @@ SCIP_RETCODE projectShift(
12061206
int shift;
12071207
SCIP_Bool isfeas;
12081208

1209+
assert(lp != NULL);
1210+
assert(lp->solved);
1211+
assert(lpexact != NULL);
1212+
assert(set != NULL);
1213+
assert(safebound != NULL);
1214+
12091215
/* project-and-shift method:
12101216
* 1. projection step (to ensure that equalities are satisfied):
12111217
* - compute error in equalities: r=c-Ay^
12121218
* - backsolve system of equations to find correction of error: z with Dz=r
12131219
* - add corretion to approximate dual solution: bold(y)=y^+[z 0]
1214-
* 2. shifing step (to ensure that inequalities are satisfied):
1220+
* 2. shifting step (to ensure that inequalities are satisfied):
12151221
* - take convex combination of projected approximate point bold(y) with interior point y*
12161222
* 3. compute dual objective value of feasible dual solution and set bound
12171223
*/
@@ -1269,8 +1275,7 @@ SCIP_RETCODE projectShift(
12691275
SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &maxv) );
12701276
SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &dualbound) );
12711277

1272-
/* flush exact lp */
1273-
/* set up the exact lpi for the current node */
1278+
/* set up the exact lpi for the current node and flush exact lp */
12741279
SCIP_CALL( SCIPlpExactSyncLPs(lpexact, blkmem, set) );
12751280
SCIP_CALL( SCIPlpExactFlush(lp->lpexact, blkmem, set, eventqueue) );
12761281

@@ -2010,15 +2015,12 @@ SCIP_RETCODE boundShift(
20102015
int i;
20112016
int j;
20122017

2013-
assert(lpexact != NULL);
20142018
assert(lp != NULL);
2015-
assert(lp->solved || lpexact->lpsolstat == SCIP_LPSOLSTAT_NOTSOLVED);
2019+
assert(lp->solved);
2020+
assert(lpexact != NULL);
20162021
assert(set != NULL);
20172022
assert(safebound != NULL);
20182023

2019-
lpexact->lpsolstat = SCIP_LPSOLSTAT_NOTSOLVED;
2020-
lpexact->solved = 0;
2021-
20222024
if( !SCIPlpExactBoundShiftUseful(lpexact) )
20232025
return SCIP_OKAY;
20242026

0 commit comments

Comments
 (0)