def maximize(self, engine: Engine): engine.differentiate() variables = engine.variables for variable in variables: self.__gradient_engine.symbol(engine.gradient(variable)) self.__gradient_engine.bind = engine.bind variable.value += self.__rate * self.__gradient_engine.value() engine.modified()
def maximize(self, engine: Engine): engine.differentiate() variables = engine.variables for variable in variables: variable.value += self.__rate * Engine( engine.gradient(variable)).value()