The confusion arises from the way the Armijo condition is implemented within the code compared to its typical mathematical representation. Let's break down both representations to clarify why the implementation is correct.
Typical Armijo Condition
In optimization, the Armijo condition (also known as the sufficient decrease condition) is usually expressed as:
[ f(x + \alpha d) \leq f(x) + \sigma \alpha \nabla f(x)^T d ]
Here:
- ( f ) is the objective function.
- ( \nabla f(x) ) is the gradient of ( f ) at point ( x ).
- ( d ) is the descent direction (often chosen as ( -\nabla f(x) ) for gradient descent).
- ( \alpha ) is the step size.
- ( \sigma ) is a parameter ( (0 < \sigma < 1) ) that ensures sufficient decrease.
This condition ensures that the step size ( \alpha ) leads to a sufficient reduction in the objective function.
Implementation in the Code
In the provided MATLAB function, the Armijo condition is implemented within a while loop as follows:
while f(x + alpha * d) > f(x) + sigma * alpha * grad' * d
alpha = beta * alpha;
end
Why Use > Instead of <=?
-
Purpose of the Loop: The loop's purpose is to find an appropriate step size ( \alpha ) that satisfies the Armijo condition. It continues to reduce ( \alpha ) until the condition is met.
-
Checking for Violation: By using f(x + alpha * d) > f(x) + sigma * alpha * grad' * d, the code checks whether the current step size ( \alpha ) violates the Armijo condition.
-
Backtracking Strategy: If the condition is violated (i.e., the sufficient decrease is not achieved), the step size ( \alpha ) is reduced by multiplying it with the backtracking parameter ( \beta ) (where ( 0 < \beta < 1 )). This process repeats until the Armijo condition is satisfied.
Equivalence to the Typical Condition
-
The while loop continues as long as the Armijo condition is not satisfied. Once f(x + alpha * d) <= f(x) + sigma * alpha * grad' * d becomes true, the loop terminates, and the step size ( \alpha ) is considered acceptable.
-
Therefore, the implementation implicitly ensures that when the loop exits, the Armijo condition holds.
Summary
-
Mathematical Representation: ( f(x + \alpha d) \leq f(x) + \sigma \alpha \nabla f(x)^T d )
-
Code Implementation: The code uses f(x + alpha * d) > f(x) + sigma * alpha * grad' * d within a loop to detect when the condition is not met and reduce ( \alpha ) accordingly.
Both approaches are equivalent; the code's implementation is a standard way to enforce the Armijo condition by repeatedly adjusting ( \alpha ) until the desired decrease in the objective function is achieved.
Additional Considerations
-
Parameters ( \sigma ) and ( \beta ): Choosing appropriate values for these parameters is crucial for the convergence and efficiency of the algorithm. Typically, ( \sigma ) is small (e.g., ( 10^{-4} )) to ensure sufficient decrease, and ( \beta ) is chosen close to 1 (e.g., ( 0.5 )) to allow for reasonable step sizes.
-
Termination Criteria: Besides the Armijo condition, the algorithm also checks if the norm of the gradient ( | \nabla f(x) | ) is below a specified tolerance ( \epsilon ), which serves as another termination criterion.
Conclusion
The implementation in the code correctly utilizes the Armijo condition by checking for its violation and adjusting the step size ( \alpha ) accordingly. This approach ensures that each update step leads to a sufficient decrease in the objective function, aligning with the theoretical foundation of the Armijo rule.
References:
Note: Always ensure that the parameters ( \sigma ) and ( \beta ) are chosen appropriately for your specific problem to guarantee convergence and efficiency.
In summary: The code correctly uses f(x + αd) > f(x) + σ α ∇f(x)^T d to determine when to reduce α; it checks for the Armijo condition’s violation (i.e., when the sufficient decrease is not met) and backtracks until the condition f(x + αd) ≤ f(x) + σ α ∇f(x)^T d is satisfied.