OpenMDAO/OpenMDAO-Framework — Issue #698: MetaModel Reset Training Data Event Bug
Author: JustinSGray
Created: 2011-11-14 20:09:24+00:00
State: open

The metamodel should not change the values of the current metamodel inputs when reset training data flag is triggered. Currently, the values get reset the trait defaults

from openmdao.lib.components.api import MetaModel
from openmdao.lib.surrogatemodels.api import KrigingSurrogate
from openmdao.lib.datatypes.api import Float
from openmdao.main.api import Component, Assembly

class Dummy(Component):
x = Float(1.2,iotype="in")
y = Float(0,iotype="out")

def execute(self):
self.y = 2*self.x

class Sim(Assembly):
def __init__(self):
super(Sim,self).__init__()

self.add('mm',MetaModel())
self.mm.surrogate = {'default':KrigingSurrogate()}
self.mm.model = Dummy()

s = Sim()

s.mm.train_next = True
s.mm.x = 1
s.run()
print s.mm.x

s.mm.train_next = True
s.mm.x = 2
s.run()
print s.mm.x

s.mm.x = 10
s.mm.reset_training_data = True
#all meta model inputs should remain at their current values
print s.mm.x #gets set back to 0, which is the default value for the trait