File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ Release Notes
33
44.. Upcoming Version
55
6+ * Fix compatibility for xpress versions below 9.6 (regression)
67
78Version 0.5.8
89--------------
Original file line number Diff line number Diff line change 108108
109109 available_solvers .append ("xpress" )
110110
111+ # xpress.Namespaces was added in xpress 9.6
112+ try :
113+ from xpress import Namespaces as xpress_Namespaces
114+ except ImportError :
115+
116+ class xpress_Namespaces : # type: ignore[no-redef]
117+ ROW = 1
118+ COLUMN = 2
119+ SET = 3
120+
121+
111122with contextlib .suppress (ModuleNotFoundError ):
112123 import mosek
113124
@@ -1605,13 +1616,13 @@ def solve_problem_from_file(
16051616 def get_solver_solution () -> Solution :
16061617 objective = m .getObjVal ()
16071618
1608- var = m .getnamelist (xpress . Namespaces .COLUMN , 0 , m .attributes .cols - 1 )
1619+ var = m .getnamelist (xpress_Namespaces .COLUMN , 0 , m .attributes .cols - 1 )
16091620 sol = pd .Series (m .getSolution (), index = var , dtype = float )
16101621
16111622 try :
16121623 _dual = m .getDual ()
16131624 constraints = m .getnamelist (
1614- xpress . Namespaces .ROW , 0 , m .attributes .rows - 1
1625+ xpress_Namespaces .ROW , 0 , m .attributes .rows - 1
16151626 )
16161627 dual = pd .Series (_dual , index = constraints , dtype = float )
16171628 except (xpress .SolverError , xpress .ModelError , SystemError ):
You can’t perform that action at this time.
0 commit comments