Skip to content

Commit

Permalink
Add test on constraint and objective values
Browse files Browse the repository at this point in the history
  • Loading branch information
jinningwang committed Apr 20, 2024
1 parent 28e9488 commit a0f6d5e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_routine.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ def test_generate_symbols(self):
self.ss.DCOPF.syms.generate_symbols()
self.assertTrue(self.ss.DCOPF._syms, "Symbol generation failed!")

def test_value_method(self):
"""
Test Contraint and Objective values.
"""

self.ss.DCOPF.run(solver='ECOS')
self.assertTrue(self.ss.DCOPF.converged, "DCOPF did not converge!")

# --- constraint values ---
for constr in self.ss.DCOPF.constrs.values():
np.testing.assert_almost_equal(constr.v, constr.v2, decimal=6)

# --- objective value ---
self.assertAlmostEqual(self.ss.DCOPF.obj.v, self.ss.DCOPF.obj.v2, places=6)


class TestOModel(unittest.TestCase):
"""
Expand Down

0 comments on commit a0f6d5e

Please sign in to comment.