Exemple #1
0
 def test_newton_optimization(self):
   opt = StandardOptimizer(function = self.function,
                           x0 = self.x0,
                           step = NewtonStep(),
                           line_search = SimpleLineSearch(),
                           criterion = criterion(ftol = 0.0001, iterations_max = 1000))
   optimum = opt.optimize()
   assert_array_almost_equal(optimum, numpy.array((4., 4., 3., -2.)))
Exemple #2
0
 def test_gradient_optimization(self):
   opt = StandardOptimizer(function = self.function,
                           x0 = self.x0,
                           step = GradientStep(),
                           line_search = FibonacciSectionSearch(min_alpha_step=0.000001),
                           criterion = criterion(ftol = 0.0001, iterations_max = 1000))
   optimum = opt.optimize()
   assert_array_almost_equal(optimum, numpy.array((4., 4., 3., -2.)))
 def test_gradient_optimization(self):
   startPoint = numpy.zeros(2, numpy.float)
   optimi = StandardOptimizer(function = Function2(),
                                        step = FRConjugateGradientStep(),
                                        criterion = criterion(ftol = 0.0000001, gtol=0.0001),
                                        x0 = startPoint,
                                        line_search = StrongWolfePowellRule())
   assert_almost_equal(optimi.optimize(), numpy.array((2., -2)))
 def test_hessian_optimization(self):
   startPoint = numpy.zeros(2, numpy.float)
   optimi = StandardOptimizer(function = Function(),
                                        step = NewtonStep(),
                                        criterion = criterion(iterations_max = 100, ftol = 0.0000001),
                                        x0 = startPoint,
                                        line_search = SimpleLineSearch())
   assert_almost_equal(optimi.optimize(), numpy.array((2., -2)))
 def test_newton_optimization(self):
     opt = StandardOptimizer(function=self.function,
                             x0=self.x0,
                             step=MarquardtStep(gamma=10.),
                             line_search=SimpleLineSearch(),
                             criterion=criterion(ftol=0.00001,
                                                 iterations_max=1000))
     optimum = opt.optimize()
     assert_array_almost_equal(optimum, numpy.array((4., 4., 3., -2.)))
 def test_gradient_optimization(self):
     opt = StandardOptimizer(
         function=self.function,
         x0=self.x0,
         step=GradientStep(),
         line_search=FibonacciSectionSearch(min_alpha_step=0.000001),
         criterion=criterion(ftol=0.00001, iterations_max=1000))
     optimum = opt.optimize()
     assert_array_almost_equal(optimum, numpy.array((4., 4., 3., -2.)))
Exemple #7
0
 def test_gradient_optimization(self):
     startPoint = numpy.zeros(2, numpy.float)
     optimi = StandardOptimizer(function=Function2(),
                                step=FRConjugateGradientStep(),
                                criterion=criterion(ftol=0.0000001,
                                                    gtol=0.0001),
                                x0=startPoint,
                                line_search=StrongWolfePowellRule())
     assert_almost_equal(optimi.optimize(), numpy.array((2., -2)))
Exemple #8
0
 def test_hessian_optimization(self):
     startPoint = numpy.zeros(2, numpy.float)
     optimi = StandardOptimizer(function=Function(),
                                step=NewtonStep(),
                                criterion=criterion(iterations_max=100,
                                                    ftol=0.0000001),
                                x0=startPoint,
                                line_search=SimpleLineSearch())
     assert_almost_equal(optimi.optimize(), numpy.array((2., -2)))