Skip to content

Commit 3aca707

Browse files
authored
Merge pull request ERGO-Code#1806 from ERGO-Code/fix-1805
Now passing nullptr to writeModelBoundSolution if lp.integrality_.size() = 0
2 parents 78df449 + eae4ede commit 3aca707

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lp_data/HighsModelUtils.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,12 @@ void writeSolutionFile(FILE* file, const HighsOptions& options,
398398
if (style == kSolutionStyleOldRaw) {
399399
writeOldRawSolution(file, lp, basis, solution);
400400
} else if (style == kSolutionStylePretty) {
401-
writeModelBoundSolution(
402-
file, true, lp.num_col_, lp.col_lower_, lp.col_upper_, lp.col_names_,
403-
have_primal, solution.col_value, have_dual, solution.col_dual,
404-
have_basis, basis.col_status, lp.integrality_.data());
401+
const HighsVarType* integrality =
402+
lp.integrality_.size() > 0 ? lp.integrality_.data() : nullptr;
403+
writeModelBoundSolution(file, true, lp.num_col_, lp.col_lower_,
404+
lp.col_upper_, lp.col_names_, have_primal,
405+
solution.col_value, have_dual, solution.col_dual,
406+
have_basis, basis.col_status, integrality);
405407
writeModelBoundSolution(file, false, lp.num_row_, lp.row_lower_,
406408
lp.row_upper_, lp.row_names_, have_primal,
407409
solution.row_value, have_dual, solution.row_dual,

0 commit comments

Comments
 (0)