pub struct InteriorPoint { /* private fields */ }Expand description
Interior Point (Barrier) method for inequality-constrained optimization.
Solves problems with inequality constraints:
minimize f(x)
subject to: g(x) ≤ 0 (inequality constraints)§Algorithm
Barrier function: B_μ(x) = f(x) - μ Σ log(-g_i(x))
for k = 1, 2, ..., max_iter:
x_k = argmin B_μ(x) (barrier subproblem)
μ_k+1 = β * μ_k (decrease barrier parameter)
if ‖∇B_μ(x)‖ is small: converged§Key Features
- Log-barrier: Enforces g(x) < 0 via -μ log(-g_i(x))
- Path-following: Decreases μ → 0 to approach constrained optimum
- Self-concordant: Converges in O(√n log(1/ε)) iterations
- Warm start: Uses previous solution for next barrier value
§Applications
- Linear programming: Constraints Ax ≤ b
- Quadratic programming: QP with inequality constraints
- Semidefinite programming: Matrix constraints X ⪰ 0
- Support Vector Machines: Soft-margin constraints
- Portfolio optimization: Long-only constraints (x ≥ 0)
§Example
use aprender::optim::InteriorPoint;
use aprender::primitives::Vector;
// Minimize: x₁² + x₂² subject to -x₁ ≤ 0, -x₂ ≤ 0 (i.e., x ≥ 0)
let objective = |x: &Vector<f32>| x[0] * x[0] + x[1] * x[1];
let gradient = |x: &Vector<f32>| Vector::from_slice(&[2.0 * x[0], 2.0 * x[1]]);
// Inequality constraints: g(x) = [-x₁, -x₂] ≤ 0
let inequality = |x: &Vector<f32>| Vector::from_slice(&[-x[0], -x[1]]);
let inequality_jac = |_x: &Vector<f32>| {
vec![Vector::from_slice(&[-1.0, 0.0]), Vector::from_slice(&[0.0, -1.0])]
};
let mut ip = InteriorPoint::new(50, 1e-6, 1.0);
let x0 = Vector::from_slice(&[1.0, 1.0]); // Feasible start
let result = ip.minimize(objective, gradient, inequality, inequality_jac, x0);
// Solution should be [0, 0] (constrained minimum)
assert!(result.solution[0].abs() < 1e-3);
assert!(result.solution[1].abs() < 1e-3);§References
- Nesterov & Nemirovskii (1994). “Interior-Point Polynomial Algorithms in Convex Programming.”
- Boyd & Vandenberghe (2004). “Convex Optimization.” Chapter 11.
- Wright (1997). “Primal-Dual Interior-Point Methods.”
Implementations§
Source§impl InteriorPoint
impl InteriorPoint
Sourcepub fn with_beta(self, beta: f32) -> InteriorPoint
pub fn with_beta(self, beta: f32) -> InteriorPoint
Sourcepub fn minimize<F, G, H, J>(
&mut self,
objective: F,
gradient: G,
inequality: H,
inequality_jac: J,
x0: Vector<f32>,
) -> OptimizationResult
pub fn minimize<F, G, H, J>( &mut self, objective: F, gradient: G, inequality: H, inequality_jac: J, x0: Vector<f32>, ) -> OptimizationResult
Minimizes objective subject to inequality constraints.
Solves: minimize f(x) subject to g(x) ≤ 0
§Arguments
objective- Objective function f(x)gradient- Gradient ∇f(x)inequality- Inequality constraints g(x) ≤ 0 (returns vector)inequality_jac- Jacobian of inequality constraints ∇g(x)x0- Initial feasible point (must satisfy g(x0) < 0 strictly)
§Returns
Optimization result with constraint satisfaction metrics
§Panics
Panics if initial point is infeasible (g(x0) ≥ 0 for any constraint)
Trait Implementations§
Source§impl Clone for InteriorPoint
impl Clone for InteriorPoint
Source§fn clone(&self) -> InteriorPoint
fn clone(&self) -> InteriorPoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InteriorPoint
impl Debug for InteriorPoint
Auto Trait Implementations§
impl Freeze for InteriorPoint
impl RefUnwindSafe for InteriorPoint
impl Send for InteriorPoint
impl Sync for InteriorPoint
impl Unpin for InteriorPoint
impl UnsafeUnpin for InteriorPoint
impl UnwindSafe for InteriorPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more