File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed
Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,11 @@ class Highs {
9090 */
9191 HighsStatus clearSolver ();
9292
93+ /* *
94+ * @brief Clear all dual data associated with the model
95+ */
96+ HighsStatus clearSolverDualData ();
97+
9398 /* *
9499 * Methods for model input
95100 */
@@ -1542,6 +1547,12 @@ class Highs {
15421547 // invalidateRanging(), invalidateInfo(), invalidateEkk() and
15431548 // invalidateIis()
15441549 void invalidateSolverData ();
1550+
1551+ // Invalidates all solver dual data in Highs class members by calling
1552+ // invalidateModelStatus(), invalidateRanging(), and invalidateInfo()
1553+ //
1554+ // Used when only the objective changes
1555+ void invalidateSolverDualData ();
15451556 //
15461557 // Invalidates the model status, solution_ and info_
15471558 void invalidateModelStatusSolutionAndInfo ();
Original file line number Diff line number Diff line change @@ -67,6 +67,13 @@ HighsStatus Highs::clearSolver() {
6767 return returnFromHighs (return_status);
6868}
6969
70+ HighsStatus Highs::clearSolverDualData () {
71+ HighsStatus return_status = HighsStatus::kOk ;
72+ clearDerivedModelProperties ();
73+ invalidateSolverDualData ();
74+ return returnFromHighs (return_status);
75+ }
76+
7077HighsStatus Highs::setOptionValue (const std::string& option, const bool value) {
7178 if (setLocalOptionValue (options_.log_options , option, options_.records ,
7279 value) == OptionStatus::kOk )
@@ -3635,15 +3642,19 @@ void Highs::clearStandardFormLp() {
36353642}
36363643
36373644void Highs::invalidateSolverData () {
3638- invalidateModelStatus ();
3645+ invalidateSolverDualData ();
36393646 invalidateSolution ();
36403647 invalidateBasis ();
3641- invalidateRanging ();
3642- invalidateInfo ();
36433648 invalidateEkk ();
36443649 invalidateIis ();
36453650}
36463651
3652+ void Highs::invalidateSolverDualData () {
3653+ invalidateModelStatus ();
3654+ invalidateRanging ();
3655+ invalidateInfo ();
3656+ }
3657+
36473658void Highs::invalidateModelStatusSolutionAndInfo () {
36483659 invalidateModelStatus ();
36493660 invalidateSolution ();
Original file line number Diff line number Diff line change @@ -3948,7 +3948,12 @@ HighsStatus Highs::multiobjectiveSolve() {
39483948 highsLogUser (options_.log_options , HighsLogType::kInfo , " %s" ,
39493949 multi_objective_log->str ().c_str ());
39503950 }
3951- this ->clearSolver ();
3951+ // Solving with a different objective, but don't call
3952+ // this->clearSolver() since this loses the current solution - that
3953+ // may have been provided by the user (#2419). Just clear the dual
3954+ // data.
3955+ //
3956+ this ->clearSolverDualData ();
39523957 if (this ->options_ .blend_multi_objectives ) {
39533958 // Objectives are blended by weight and minimized
39543959 lp.offset_ = 0 ;
You can’t perform that action at this time.
0 commit comments