Skip to content

Commit e787e31

Browse files
committed
linear_solver: using GLOP instead of XPRESS_LP for python starting basis test
1 parent 0a3a49c commit e787e31

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ortools/linear_solver/python/set_starting_basis_test.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ def build_large_lp(self, solver):
4545
for j in range(0, i):
4646
c.SetCoefficient(solver.variable(j), random.random() * 200 - 100)
4747

48-
def test_xpress(self):
48+
def test_glop(self):
4949
# Build an LP and solve it, then fetch LP basis
50-
solver = pywraplp.Solver.CreateSolver("XPRESS_LP")
51-
if not solver:
52-
return
50+
solver = pywraplp.Solver.CreateSolver("GLOP")
5351
self.build_large_lp(solver)
5452
solver.Solve()
55-
self.assertGreaterEqual(solver.iterations(), 1)
53+
self.assertGreaterEqual(solver.iterations(), 10)
5654

5755
var_basis = []
5856
con_basis = []
@@ -62,7 +60,7 @@ def test_xpress(self):
6260
con_basis.append(con.basis_status())
6361

6462
# Re-build the same optimization problem in another MPSolver
65-
solver_with_basis = pywraplp.Solver.CreateSolver("XPRESS_LP")
63+
solver_with_basis = pywraplp.Solver.CreateSolver("GLOP")
6664
self.build_large_lp(solver_with_basis)
6765
# Set same basis as previous Solver
6866
solver_with_basis.SetStartingLpBasis(var_basis, con_basis)
@@ -73,7 +71,7 @@ def test_xpress(self):
7371
solver_with_basis.Objective().Value(),
7472
delta=1,
7573
)
76-
self.assertEqual(solver_with_basis.iterations(), 0)
74+
self.assertLessEqual(solver_with_basis.iterations(), 6)
7775

7876

7977
# Main Part

0 commit comments

Comments
 (0)