@@ -180,6 +180,7 @@ struct SCIP_LPi
180
180
int nthreads; /* *< number of threads to be used */
181
181
SCIP_Bool fromscratch; /* *< shall solves be performed from scratch? */
182
182
SCIP_Bool solved; /* *< was the current LP solved? */
183
+ SCIP_Bool presolve; /* *< shall the current LP be presolved? */
183
184
SCIP_PRICING pricing; /* *< SCIP pricing setting */
184
185
SCIP_MESSAGEHDLR* messagehdlr; /* *< messagehdlr handler for printing messages, or NULL */
185
186
};
@@ -452,6 +453,7 @@ SCIP_RETCODE lpiSolve(
452
453
453
454
lpi->highs ->zeroAllClocks ();
454
455
456
+ HIGHS_CALL ( lpi->highs ->setOptionValue (" presolve" , lpi->presolve ? " on" : " off" ) );
455
457
/* the optimization result may be reliable even if HiGHS returns a warning status, e.g., HiGHS always returns with a
456
458
* warning status if the iteration limit was hit
457
459
*/
@@ -503,20 +505,21 @@ SCIP_RETCODE lpiSolve(
503
505
/* if basis factorization is unavailable, this may be due to presolving; then solve again without presolve */
504
506
HIGHS_CALL ( lpi->highs ->getOptionValue (" presolve" , presolvestring) );
505
507
assert (presolvestring == " on" || presolvestring == " off" ); /* values used in SCIPlpiSetIntpar() */
508
+
506
509
if ( !lpi->highs ->hasInvert () && presolvestring == " on" )
507
510
{
508
511
SCIP_RETCODE retcode;
509
512
510
513
SCIPdebugMessage (" No inverse: running HiGHS again without presolve . . .\n " );
511
- HIGHS_CALL ( lpi->highs -> setOptionValue ( " presolve" , " off " ) ) ;
514
+ lpi->presolve = FALSE ;
512
515
retcode = lpiSolve (lpi);
513
516
if ( retcode != SCIP_OKAY )
514
517
{
515
518
HighsModelStatus model_status2 = lpi->highs ->getModelStatus ();
516
519
SCIPerrorMessage (" HiGHS terminated with model status <%s> (%d) after trying to recover inverse\n " ,
517
520
lpi->highs ->modelStatusToString (model_status2).c_str (), (int )model_status2);
518
521
}
519
- HIGHS_CALL ( lpi->highs -> setOptionValue ( " presolve" , " on " ) ) ;
522
+ lpi->presolve = TRUE ;
520
523
SCIP_CALL ( retcode );
521
524
}
522
525
@@ -659,6 +662,7 @@ SCIP_RETCODE SCIPlpiCreate(
659
662
(*lpi)->nthreads = 1 ;
660
663
(*lpi)->fromscratch = FALSE ;
661
664
(*lpi)->solved = FALSE ;
665
+ (*lpi)->presolve = TRUE ;
662
666
(*lpi)->pricing = SCIP_PRICING_LPIDEFAULT;
663
667
(*lpi)->messagehdlr = messagehdlr;
664
668
@@ -2770,12 +2774,7 @@ SCIP_RETCODE SCIPlpiGetIntpar(
2770
2774
*ival = 2 ;
2771
2775
break ;
2772
2776
case SCIP_LPPAR_PRESOLVING:
2773
- {
2774
- std::string presolve;
2775
- HIGHS_CALL ( lpi->highs ->getOptionValue (" presolve" , presolve) );
2776
- assert (presolve == " on" || presolve == " off" ); /* values used in SCIPlpiSetIntpar() */
2777
- *ival = (presolve == " on" );
2778
- }
2777
+ *ival = lpi->presolve ;
2779
2778
break ;
2780
2779
case SCIP_LPPAR_PRICING:
2781
2780
*ival = (int )lpi->pricing ; /* store pricing method in LPI struct */
@@ -2832,6 +2831,7 @@ SCIP_RETCODE SCIPlpiSetIntpar(
2832
2831
break ;
2833
2832
case SCIP_LPPAR_PRESOLVING:
2834
2833
assert (ival == TRUE || ival == FALSE );
2834
+ lpi->presolve = ival;
2835
2835
HIGHS_CALL ( lpi->highs ->setOptionValue (" presolve" , ival ? " on" : " off" ) );
2836
2836
break ;
2837
2837
case SCIP_LPPAR_PRICING:
0 commit comments