Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qlip

qlip (Quadratic Lorentz "Lightcone" Interior Point solver, pronounced "clip") is an interior point method solver for solving second order cone programming (SOCP) problems.

It is written in Rust, utilizing faer crate for linear algebra.

qlip is an educational and illustrative solver. It is designed to be clear, fully documented, and easy to understand, serving primarily as a demonstration of interior point methods rather than a production-ready tool.

It uses the following standard problem formulation:

minimize    c^T x
subject to  A x = b
            G x + s = h
            s \in K

Usage

We do not recommend using qlip for any production use

To use qlip, add it as a dependency in your Cargo.toml:

[dependencies]
qlip = { version = "0.1.0", git = "https://github.com/cuno3/qlip.git" }

Example

Here is a minimal example showing how to set up and solve a simple LP with qlip: minimize x subject to x >= 0. Since we require standard conic form, we rewrite x >= 0 as -x + s = 0 with s \in NonNegative(1).

use faer::{col, sparse::{SparseColMat, Triplet}};
use qlip::{Problem, Cone, Config, Status};

fn main() {
    // c = [1.0]
    let c = col![1.0];

    // No equality constraints (A is 0x1)
    let a = SparseColMat::try_new_from_triplets(0, 1, &[]).unwrap();
    let b = faer::Col::<f64>::zeros(0);

    // G = [-1.0], h = [0.0] -> -x + s = 0 -> s = x >= 0
    let g = SparseColMat::try_new_from_triplets(1, 1, &[Triplet::new(0, 0, -1.0)]).unwrap();
    let h = col![0.0];

    let cones = vec![Cone::NonNegative(1)];

    let problem = Problem::new(c, a, b, g, h, cones);
    let mut solver = problem.build(Config::default()).unwrap();

    let status = solver.solve();
    assert_eq!(status, Status::Optimal);

    let solution = solver.solution();
    println!("Status: {:?}", status);
    println!("Optimal x: {:.4}", solution.x[0]);
}

Acknowledgments

The implementation of qlip was inspired by and references the algorithms from several excellent open-source solvers, notably ECOS and Clarabel.

Additionally, the theoretical foundations and implementation details heavily benefited from the following textbooks:

Copying

Copyright (c) 2026 CuNO3.
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

About

Quadratic Lorentz "Lightcone" Interior Point solver

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages