Skip to content

Commit 311eb3a

Browse files
committed
add a little test for dynamic gradient-based rho
1 parent 121285f commit 311eb3a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mpisppy/tests/test_gradient_rho.py

+13
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,18 @@ def test_grad_extensions(self):
267267
self.ph_object = self._run_ph_farmer()
268268
self.assertAlmostEqual(self.ph_object.conv, 2.128968965420187, places=1)
269269

270+
def test_dyn_grad_extensions(self):
271+
print("** test dynamic grad extensions **")
272+
self.cfg.grad_rho_file_out = './_test_rho.csv'
273+
#self.cfg.grad_cost_file_in = './examples/rho_test_data/grad_cost.csv'
274+
self.cfg.xhatpath = './examples/rho_test_data/farmer_cyl_nonants.npy'
275+
self.cfg.max_iterations = 4
276+
self.cfg.dynamic_rho_dual_crit = True
277+
self.cfg.dynamic_rho_dual_thresh = 0.1
278+
self.ph_object = self._run_ph_farmer()
279+
print(f"{self.ph_object.conv=}")
280+
self.assertAlmostEqual(self.ph_object.conv, 0.039598, places=1)
281+
282+
270283
if __name__ == '__main__':
271284
unittest.main()

0 commit comments

Comments
 (0)