All problems
Wolfe Curvature Condition Check
Problem
The Wolfe curvature condition requires |g_new dot d| <= c2 * |g_old dot d| for a descent direction d and 0 < c2 < 1.
Given the new and old gradients, the direction, and c2, return True when the condition holds.
Hint
Compare absolute directional derivatives of the old and new points.
Test cases
case 1
in: [[0.5,0],[1,0],[-1,0],0.9]
expected: true
case 2
in: [[2,0],[1,0],[-1,0],0.5]
expected: false
case 3
in: [[0,0],[1,2],[1,1],0.1]
expected: true
Starter codePython
def wolfe_curvature_condition_check(g_new, g_old, direction, c2):
# Your code here
pass3 test cases · run your code against them in the editor