Skip to content

Commit e202c68

Browse files
WilkenSteinerstefan-k
authored andcommitted
Fix Wolfe condition and thus #2
1 parent e6c3b9a commit e202c68

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/solver/linesearch/hagerzhang.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
//! * [Hager-Zhang line search](struct.HagerZhangLineSearch.html)
99
//!
10-
//! TODO: Not all stopping criteria implemented
11-
//!
1210
//! # Reference
1311
//!
1412
//! William W. Hager and Hongchao Zhang. "A new conjugate gradient method with guaranteed descent
@@ -533,10 +531,9 @@ where
533531
}
534532

535533
fn terminate(&mut self, _state: &IterState<O>) -> TerminationReason {
536-
if self.best_f - self.finit <= self.delta * self.best_x * self.dginit {
537-
return TerminationReason::LineSearchConditionMet;
538-
}
539-
if self.best_g >= self.sigma * self.dginit {
534+
if self.best_f - self.finit <= self.delta * self.best_x * self.dginit
535+
&& self.best_g >= self.sigma * self.dginit
536+
{
540537
return TerminationReason::LineSearchConditionMet;
541538
}
542539
if (F::from_f64(2.0).unwrap() * self.delta - F::from_f64(1.0).unwrap()) * self.dginit

0 commit comments

Comments
 (0)