diff --git a/pyomo/solvers/plugins/solvers/xpress_direct.py b/pyomo/solvers/plugins/solvers/xpress_direct.py index 43316603a41..764314deee9 100644 --- a/pyomo/solvers/plugins/solvers/xpress_direct.py +++ b/pyomo/solvers/plugins/solvers/xpress_direct.py @@ -1126,7 +1126,7 @@ def _load_rc(self, vars_to_load=None): vars_to_load = var_map.keys() xpress_vars_to_load = [var_map[pyomo_var] for pyomo_var in vars_to_load] - vals = self._getRedCost(self._solver_model, xpress_vars_to_load) + vals = self._getRedCosts(self._solver_model, xpress_vars_to_load) for var, val in zip(vars_to_load, vals): if ref_vars[var] > 0: diff --git a/pyomo/solvers/tests/checks/test_xpress_persistent.py b/pyomo/solvers/tests/checks/test_xpress_persistent.py index d5107f9dda7..329ba38e164 100644 --- a/pyomo/solvers/tests/checks/test_xpress_persistent.py +++ b/pyomo/solvers/tests/checks/test_xpress_persistent.py @@ -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)