File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Upcoming Version
66
77**Bug Fixes **
88
9+ * Fix the parsing of solutions returned by the CBC solver when solving from a file to not
10+ assume that variables start with `x `.
911* Fix the retrieval of solutions from the SCIP solver, and do not turn off presolve.
1012
1113Version 0.5.2
Original file line number Diff line number Diff line change @@ -453,6 +453,11 @@ def solve_problem_from_file(
453453 status = Status (SolverStatus .warning , TerminationCondition .unknown )
454454 status .legacy_status = data
455455
456+ # Use HiGHS to parse the problem file and find the set of variable names, needed to parse solution
457+ h = highspy .Highs ()
458+ h .readModel (path_to_string (problem_fn ))
459+ variables = {v .name for v in h .getVariables ()}
460+
456461 def get_solver_solution () -> Solution :
457462 objective = float (data [len ("Optimal - objective value " ) :])
458463
@@ -467,7 +472,7 @@ def get_solver_solution() -> Solution:
467472 usecols = [1 , 2 , 3 ],
468473 index_col = 0 ,
469474 )
470- variables_b = df .index .str [ 0 ] == "x"
475+ variables_b = df .index .isin ( variables )
471476
472477 sol = df [variables_b ][2 ]
473478 dual = df [~ variables_b ][3 ]
You can’t perform that action at this time.
0 commit comments