def testGoldsteinConditionsWithSuppliedGradientTwo(self): problem = OptimizationProblem(f, grad) op = ClassicalNewton(problem) actual = op.solve((1)) self.assert_almost_equal(expected, actual, 0.0001)
def testRosenBrockWithHardInitialGuessAndSuppliedGradient(self): problem = OptimizationProblem(f, grad) op = ClassicalNewton(problem) res = op.solve((-1.2, 1), search='exact') np.testing.assert_almost_equal(self.ros_res, res)
def testRosenBrockWithEasyInitialGuess(self): problem = OptimizationProblem(f) op = ClassicalNewton(problem) res = op.solve((2,2), search='inexact', cond = 'GS') np.testing.assert_almost_equal(self.ros_res, res)
def testRosenBrockWithStandardInitialGuess(self): problem = OptimizationProblem(f) op = ClassicalNewton(problem) res = op.solve(search='exact') np.testing.assert_almost_equal(self.ros_res, res)