Skip to content

Commit

Permalink
xpress: add test exercising retrieving RC/Slacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Nov 15, 2024
1 parent ff6e78f commit 03ec9d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pyomo/solvers/tests/checks/test_xpress_persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,23 @@ def test_basics(self):
res = opt.solve()
self.assertAlmostEqual(m.x.value, -0.4, delta=1e-6)
self.assertAlmostEqual(m.y.value, 0.2, delta=1e-6)

opt.load_duals()
self.assertEqual(len(m.dual), 1)
self.assertAlmostEqual(m.dual[m.c1], -0.4, delta=1e-6)
del m.dual

opt.load_rc()
self.assertEqual(len(m.rc), 2)
self.assertAlmostEqual(m.rc[m.x], 0, delta=1e-8)
self.assertAlmostEqual(m.rc[m.y], 0, delta=1e-8)
del m.rc

opt.load_slacks()
self.assertEqual(len(m.slack), 1)
self.assertAlmostEqual(m.slack[m.c1], 0, delta=1e-6)
del m.slack

m.c2 = pe.Constraint(expr=m.y >= -m.x + 1)
opt.add_constraint(m.c2)
self.assertEqual(opt.get_xpress_attribute('cols'), 2)
Expand Down

0 comments on commit 03ec9d2

Please sign in to comment.