Skip to main content

InteriorPoint

Struct InteriorPoint 

Source
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

Source

pub fn new(max_iter: usize, tol: f32, initial_mu: f32) -> InteriorPoint

Creates a new Interior Point optimizer.

§Arguments
  • max_iter - Maximum number of outer iterations
  • tol - Convergence tolerance
  • initial_mu - Initial barrier parameter (typically 1.0-10.0)
§Example
use aprender::optim::InteriorPoint;

let optimizer = InteriorPoint::new(50, 1e-6, 1.0);
Source

pub fn with_beta(self, beta: f32) -> InteriorPoint

Sets barrier decrease factor.

§Arguments
  • beta - Barrier decrease factor (0 < beta < 1, typically 0.1-0.5)
§Example
use aprender::optim::InteriorPoint;

let optimizer = InteriorPoint::new(50, 1e-6, 1.0)
    .with_beta(0.1); // Aggressive barrier decrease
Source

pub fn minimize<F, G, H, J>( &mut self, objective: F, gradient: G, inequality: H, inequality_jac: J, x0: Vector<f32>, ) -> OptimizationResult
where F: Fn(&Vector<f32>) -> f32, G: Fn(&Vector<f32>) -> Vector<f32>, H: Fn(&Vector<f32>) -> Vector<f32>, J: Fn(&Vector<f32>) -> Vec<Vector<f32>>,

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for InteriorPoint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Optimizer for InteriorPoint

Source§

fn step(&mut self, _params: &mut Vector<f32>, _gradients: &Vector<f32>)

Stochastic update (mini-batch mode) - for SGD, Adam, RMSprop. Read more
Source§

fn reset(&mut self)

Resets the optimizer state (momentum, history, etc.). Read more
Source§

fn minimize<F, G>( &mut self, _objective: F, _gradient: G, _x0: Vector<f32>, ) -> OptimizationResult
where F: Fn(&Vector<f32>) -> f32, G: Fn(&Vector<f32>) -> Vector<f32>,

Batch optimization (deterministic mode) - for L-BFGS, CG, Damped Newton. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,