def test_warm_start(self): # create metamodel with warm_restart = True meta = MetaModel() meta.add_param('x1', 0.) meta.add_param('x2', 0.) meta.add_output('y1', 0.) meta.add_output('y2', 0.) meta.default_surrogate = ResponseSurface() meta.warm_restart = True # add to problem prob = Problem(Group()) prob.root.add('meta', meta) prob.setup(check=False) # provide initial training data prob['meta.train:x1'] = [1.0, 3.0] prob['meta.train:x2'] = [1.0, 4.0] prob['meta.train:y1'] = [3.0, 1.0] prob['meta.train:y2'] = [1.0, 7.0] # run against a data point and check result prob['meta.x1'] = 2.0 prob['meta.x2'] = 3.0 prob.run() assert_rel_error(self, prob['meta.y1'], 1.9085, .001) assert_rel_error(self, prob['meta.y2'], 3.9203, .001) # Add 3rd training point, moves the estimate for that point # back to where it should be. prob['meta.train:x1'] = [2.0] prob['meta.train:x2'] = [3.0] prob['meta.train:y1'] = [2.0] prob['meta.train:y2'] = [4.0] meta.train = True # currently need to tell meta to re-train prob.run() assert_rel_error(self, prob['meta.y1'], 2.0, .00001) assert_rel_error(self, prob['meta.y2'], 4.0, .00001)