21 releases

new 0.2.6 Sep 21, 2023
0.2.5 Jul 27, 2023
0.2.4 Jun 25, 2023
0.2.3 May 27, 2023
0.1.0 Jan 5, 2023

#241 in Rust patterns

Download history 9/week @ 2023-06-03 25/week @ 2023-06-10 32/week @ 2023-06-17 37/week @ 2023-06-24 65/week @ 2023-07-01 11/week @ 2023-07-08 20/week @ 2023-07-15 34/week @ 2023-07-22 12/week @ 2023-07-29 23/week @ 2023-08-05 37/week @ 2023-08-12 41/week @ 2023-08-19 29/week @ 2023-08-26 15/week @ 2023-09-02 55/week @ 2023-09-09 49/week @ 2023-09-16

151 downloads per month
Used in good_lp




tests coverage

A safe Rust interface for SCIP. This crate also exposes access to the SCIP's C-API through the ffi module. The project is currently actively developed, issues/pull-requests are very welcome.


Make sure SCIP is installed, the easiest way to install it is to install a precompiled package from here or through conda by running

conda install --channel conda-forge scip

After which russcip would be able to find the installation in the current Conda environment. Alternatively, you can specify the installation directory through the SCIPOPTDIR environment variable.

russcip is tested against SCIP 8.0.3 but it might work for other versions depending on which functionality you use.


By running

cargo add russcip

or to get the most recent version, add the following to your Cargo.toml

russcip = { git = "https://github.com/scipopt/russcip" }


Model and solve an integer program.

use russcip::prelude::*;

fn main() {
    // Create model
    let mut model = Model::new()

    // Add variables
    let x1 = model.add_var(0., f64::INFINITY, 3., "x1", VarType::Integer);
    let x2 = model.add_var(0., f64::INFINITY, 4., "x2", VarType::Integer);

    // Add constraints
    model.add_cons(vec![x1.clone(), x2.clone()], &[2., 1.], -f64::INFINITY, 100., "c1");
    model.add_cons(vec![x1.clone(), x2.clone()], &[1., 2.], -f64::INFINITY, 80., "c2");

    let solved_model = model.solve();

    let status = solved_model.status();
    println!("Solved with status {:?}", status);

    let obj_val = solved_model.obj_val();
    println!("Objective value: {}", obj_val);

    let sol = solved_model.best_sol().unwrap();
    let vars = solved_model.vars();

    for var in vars {
        println!("{} = {}", &var.name(), sol.val(var));

The raw feature

You can enable this feature by specifying the feature in your Cargo.toml

russcip = { features = ["raw"] }

This enables access to the scip_ptr unsafe function in the Model struct, which gives you access to the underlying SCIP raw pointer. This is can be used in combination with the ffi module to call SCIP functions that are not wrapped yet in the safe interface.

Implementing Custom Plugins

Some of SCIP's plugins are imported to the rust interface as traits. Currently the implemented plugins are:

Name File Docs
Branching rule branchrule.rs docs
Variable Pricer pricer.rs docs
Event Handler eventhdlr.rs docs
Primal Heuristic heuristic.rs docs

To add a custom plugin to a SCIP Model instance, you should implement its trait and call the corresponding include_{PLUGIN_NAME} method. For examples on implementing the specific plugin trait you can check the tests in the corresponding files.

About SCIP

SCIP is currently one of the fastest non-commercial solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP). It is also a framework for constraint integer programming and branch-cut-and-price. It allows for total control of the solution process and the access of detailed information down to the guts of the solver.


~39K SLoC