예제 #1
0
 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()
예제 #2
0
 def maximize(self, engine: Engine):
     engine.differentiate()
     variables = engine.variables
     for variable in variables:
         variable.value += self.__rate * Engine(
             engine.gradient(variable)).value()