diff --git a/FEATURES.md b/FEATURES.md index 9d7043302e..a5e198a407 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -4,3 +4,10 @@ Added `int64_t mip_total_lp_iterations` to `HighsCallbackDataOut` and modified accessor function +`Highs::writeSolution` and `Highs::writeBasis` now being done via `HighsIO` logging, so can be redirected to logging callback. + +Introduced `const double kHighsUndefined` as value of undefined values in a user solution. It's equal to `kHighsInf` + +Added `Highs::setSolution(const HighsInt num_entries, const HighsInt* index, const double* value);` to allow a sparse primal solution to be defined. + + diff --git a/check/TestCallbacks.cpp b/check/TestCallbacks.cpp index 437fdaf7b3..d97bc0d271 100644 --- a/check/TestCallbacks.cpp +++ b/check/TestCallbacks.cpp @@ -277,8 +277,8 @@ TEST_CASE("highs-callback-solution-basis-logging", "[highs-callback]") { highs.run(); highs.setCallback(userInterruptCallback, p_user_callback_data); highs.startCallback(kCallbackLogging); - highs.writeSolution("", kSolutionStylePretty); - highs.writeBasis(""); + if (dev_run) highs.writeSolution("", kSolutionStylePretty); + if (dev_run) highs.writeBasis(""); } TEST_CASE("highs-callback-simplex-interrupt", "[highs-callback]") { diff --git a/src/lp_data/Highs.cpp b/src/lp_data/Highs.cpp index fee0502b58..ac8196715a 100644 --- a/src/lp_data/Highs.cpp +++ b/src/lp_data/Highs.cpp @@ -3406,14 +3406,7 @@ HighsStatus Highs::completeSolutionFromDiscreteAssignment() { HighsLp& lp = model_.lp_; // Determine whether the solution contains undefined values, in // order to decide whether to check its feasibility - bool contains_undefined_values = false; - for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) { - if (solution_.col_value[iCol] == kHighsUndefined) { - contains_undefined_values = true; - break; - } - } - assert(solution_.hasUndefined() == contains_undefined_values); + const bool contains_undefined_values = solution_.hasUndefined(); if (!contains_undefined_values) { bool valid, integral, feasible; // Determine whether this solution is integer feasible @@ -3466,6 +3459,7 @@ HighsStatus Highs::completeSolutionFromDiscreteAssignment() { } } } + assert(!solution_.hasUndefined()); const HighsInt num_discrete_variable = num_unfixed_discrete_variable + num_fixed_discrete_variable; const HighsInt num_continuous_variable = lp.num_col_ - num_discrete_variable;