Exemple #1
0
 def test07(self):
     """Try just saving just if fixed"""
     model = self.setup_model02()
     model.x[1].fix(1)
     wts = StoreSpec.isfixed()
     to_json(model, fname=self.fname, human_read=True, wts=wts)
     model.g.deactivate()
     model.x[1].setlb(-4)
     model.x[1].unfix()
     model.x[2].fix(6)
     from_json(model, fname=self.fname, wts=wts)
     assert (abs(value(model.x[1]) - 1) < 1e-5)
     assert (abs(model.x[1].lb + 4) < 1e-5)
     assert (abs(value(model.x[2]) - 6) < 1e-5)
     assert (model.x[1].fixed)
     assert (not model.x[2].fixed)
     assert (not model.g.active)
 def test07(self):
     """Try just saving just if fixed"""
     model = self.setup_model02()
     model.x[1].fix(1)
     wts = StoreSpec.isfixed()
     to_json(model, fname=self.fname, human_read=True, wts=wts)
     model.g.deactivate()
     model.x[1].setlb(-4)
     model.x[1].unfix()
     model.x[2].fix(6)
     from_json(model, fname=self.fname, wts=wts)
     assert value(model.x[1]) == 1
     assert model.x[1].lb == -4
     assert value(model.x[2]) == 6
     assert model.x[1].fixed
     assert not model.x[2].fixed
     assert not model.g.active