Skip to content

Commit

Permalink
Change diff to almost_equal.
Browse files Browse the repository at this point in the history
  • Loading branch information
1ozturkbe committed Dec 12, 2019
1 parent e176a73 commit 8fbcbdf
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions robust/testing/t_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,17 @@ def test_methods(self):
for method in methods:
for uncertainty_set in uncertainty_sets:
rm = RobustModel(m, uncertainty_set, gamma=gamma, twoTerm=method['twoTerm'],
boyd=method['boyd'], simpleModel=method['simpleModel'],
nominalsolve=nominal_solution)
boyd=method['boyd'], simpleModel=method['simpleModel'],
nominalsolve=nominal_solution)
sol = rm.robustsolve(verbosity=0)
# sol.save(os.path.dirname(__file__) +
# 'diffs/test_methods/' +
# method['name'] + '_' + uncertainty_set)
# self.assertTrue(sol.almost_equal(pickle.load(open(os.path.dirname(__file__) +
# '/diffs/test_methods/' +
# method['name'] + '_' + uncertainty_set)),
# reltol=1e-2, sens_abstol=1e-2))
print(sol.diff(pickle.load(open(os.path.dirname(__file__) +
'/diffs/test_methods/' +
method['name'] + '_' + uncertainty_set))))
prev_sol = pickle.load(open(os.path.dirname(__file__) +
'/diffs/test_methods/' +
method['name'] + '_' + uncertainty_set))
for vk in m.varkeys:
self.assertAlmostEqual(sol(vk), prev_sol(vk), places=6)

TESTS = [TestPrimitives]

Expand Down

0 comments on commit 8fbcbdf

Please sign in to comment.