Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ jobs:
- name: Run tests with Clarabel on WASM
run: wasm-pack test --node --no-default-features --features clarabel

test-pumpkin-solver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: install deps
run: NO_CPLEX=true ./build/setup.sh
- name: Build pumpkin-solver
run: cargo build --features pumpkin-solver --tests
- name: Run tests with pumpkin-solver
run: cargo test --no-default-features --features pumpkin-solver

bench:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ all_default_solvers = [
"scip_bundled",
"lp-solvers",
"clarabel",
"pumpkin-solver",
] # cplex-rs is not included because it is incompatible with lpsolve
minilp = [
"microlp",
Expand All @@ -45,6 +46,7 @@ russcip = { version = "0.6.4", optional = true }
lp-solvers = { version = "1.0.0", features = ["cplex"], optional = true }
cplex-rs = { version = "0.1", optional = true }
clarabel = { version = "0.10.0", optional = true, features = [] }
pumpkin-solver = { version = "0.1.4", optional = true }
fnv = "1.0.5"

[dev-dependencies]
Expand All @@ -66,7 +68,7 @@ all-features = false
# Use almost the same as all_default_solvers. Similarly, cplex-rs is not
# included because it is incompatible with lpsolve. Additionally,
# russcip/bundled is not included because network access is blocked on docs.rs.
features = ["coin_cbc", "microlp", "lpsolve", "highs", "lp-solvers", "clarabel"]
features = ["coin_cbc", "microlp", "lpsolve", "highs", "lp-solvers", "clarabel", "pumpkin-solver"]
default-target = "x86_64-unknown-linux-gnu"
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "docsrs"]
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ You can find a resource allocation problem example in
This library offers an abstraction over multiple solvers. By default, it uses [cbc][cbc], but
you can also activate other solvers using cargo features.

| solver feature name | integer variables | no C compiler\* | no additional libs\* | fast\* | WASM\* |
| ---------------------- | ----------------- | --------------- | ---------------------- | ---- | ---- |
| [`coin_cbc`][cbc] | ✅ | ✅ | ❌ | ✅ | ❌ |
| [`highs`][highs] | ✅ | ❌ | ✅¹ | ✅ | ❌ |
| [`lpsolve`][lpsolve] | ✅ | ❌ | ✅ | ❌ | ❌ |
| [`microlp`][microlp] | ✅ | ✅ | ✅ | ❌ | ✅ |
| [`lp-solvers`][lps] | ✅ | ✅ | ✅ | ❌ | ❌ |
| [`scip`][scip] | ✅ | ✅ | ✅² | ✅ | ❌ |
| [`cplex-rs`][cplex] | ✅ | ❌ | ✅³ | ✅ | ❌ |
| [`clarabel`][clarabel] | ❌ | ✅ | ✅ | ✅ | ✅ |
| solver feature name | integer variables | no C compiler\* | no additional libs\* | fast\* | WASM\* |
| --------------------------- | ----------------- | --------------- | ---------------------- | ---- | ---- |
| [`coin_cbc`][cbc] | ✅ | ✅ | ❌ | ✅ | ❌ |
| [`highs`][highs] | ✅ | ❌ | ✅¹ | ✅ | ❌ |
| [`lpsolve`][lpsolve] | ✅ | ❌ | ✅ | ❌ | ❌ |
| [`microlp`][microlp] | ✅ | ✅ | ✅ | ❌ | ✅ |
| [`lp-solvers`][lps] | ✅ | ✅ | ✅ | ❌ | ❌ |
| [`scip`][scip] | ✅ | ✅ | ✅² | ✅ | ❌ |
| [`cplex-rs`][cplex] | ✅ | ❌ | ✅³ | ✅ | ❌ |
| [`clarabel`][clarabel] | ❌ | ✅ | ✅ | ✅ | ✅ |
| [`pumpkin-solver`][pumpkin] | ✅ | ✅ | ✅ | ✅ | ❌ |

- \* *no C compiler*: builds with only cargo, without requiring you to install a C compiler
- \* *no additional libs*: works without additional libraries at runtime, all the dependencies are statically linked
Expand Down Expand Up @@ -210,6 +211,20 @@ trait, which allows you to access the dual values of the constraints (the shadow

[clarabel]: https://github.com/oxfordcontrol/Clarabel.rs

### [Pumpkin][pumpkin]

Pumpkin is a combinatorial optimization solver based on lazy clause generation.
It is written in pure Rust and supports integer variables along with several global constraints,
including cumulative, arithmetic (linear in/equalities, integer division, integer multiplication,
maximum, absolute value) and clausal constraints.

It produces certificates of unsatisfiability and can be used as both a library and a command-line
tool, serving also as a MiniZinc backend. Dual licensed under
[MIT](https://github.com/ConSol-Lab/pumpkin/blob/main/LICENSE-MIT) and
[Apache-2.0](https://github.com/ConSol-Lab/pumpkin/blob/main/LICENSE-APACHE).

[pumpkin]: https://github.com/ConSol-Lab/pumpkin

## Variable types

`good_lp` internally represents all [variable](https://docs.rs/good_lp/latest/good_lp/variable/struct.Variable.html) values and coefficients as `f64`.
Expand Down
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub use expression::Expression;
feature = "highs",
feature = "scip",
feature = "cplex-rs",
feature = "pumpkin-solver",
)))]
#[cfg(feature = "clarabel")]
pub use solvers::clarabel::clarabel as default_solver;
Expand Down Expand Up @@ -120,6 +121,21 @@ pub use solvers::microlp::microlp;
#[cfg(feature = "microlp")]
/// When the "coin_cbc" cargo feature is absent, microlp is used as the default solver
pub use solvers::microlp::microlp as default_solver;
#[cfg(feature = "pumpkin-solver")]
#[cfg_attr(docsrs, doc(cfg(feature = "pumpkin-solver")))]
pub use solvers::pumpkin_solver::pumpkin;
#[cfg(not(any(
feature = "coin_cbc",
feature = "microlp",
feature = "lpsolve",
feature = "highs",
feature = "lp-solvers",
feature = "scip",
feature = "cplex-rs",
feature = "clarabel"
)))]
#[cfg(feature = "pumpkin-solver")]
pub use solvers::pumpkin_solver::pumpkin as default_solver;
#[cfg(feature = "scip")]
#[cfg_attr(docsrs, doc(cfg(feature = "highs")))]
pub use solvers::scip::scip;
Expand Down Expand Up @@ -161,6 +177,7 @@ pub const default_solver: LpSolver<
feature = "scip",
feature = "cplex-rs",
feature = "clarabel",
feature = "pumpkin-solver",
)))]
compile_error!(
"No solver available. \
Expand Down
4 changes: 4 additions & 0 deletions src/solvers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub mod lp_solvers;
#[cfg_attr(docsrs, doc(cfg(feature = "clarabel")))]
pub mod clarabel;

#[cfg(feature = "pumpkin-solver")]
#[cfg_attr(docsrs, doc(cfg(feature = "pumpkin-solver")))]
pub mod pumpkin_solver;

/// An entity that is able to solve linear problems
pub trait Solver {
/// The internal model type used by the solver
Expand Down
Loading
Loading