Skip to main content

Module objectives

Module objectives 

Source
Expand description

Standard test objectives for the optimizer suite.

Quadratic is a strictly convex bowl with a known global minimizer, used to assert convergence and scipy.optimize agreement on an easy problem. Rosenbrock is the classic non-convex valley with its global minimum at (1, 1), used to stress the gradient-based, quasi-Newton, and derivative-free methods.

§Examples

use stats_claw::optimizers::objectives::Quadratic;
use stats_claw::optimizers::Objective;

let q = Quadratic::new(vec![3.0, -2.0]);
// The minimum value is 0, attained at the center.
assert!(q.value(&[3.0, -2.0]).abs() < 1e-15, "f(c) = {}", q.value(&[3.0, -2.0]));
// The gradient is zero at the center.
use stats_claw::optimizers::norm;
assert!(norm(&q.grad(&[3.0, -2.0])) < 1e-15);

Structs§

Quadratic
Separable quadratic f(x) = Σ (xᵢ − cᵢ)².
Rosenbrock
The two-dimensional Rosenbrock function f(x) = (1 − x₀)² + 100·(x₁ − x₀²)².