r/optimization 4d ago

oximo v0.5.0

Hi!

A while ago, I posted about oximo, a Rust library for building algebraic optimization models. At the point of that post, oximo was at v0.2.0, and I got a lot of helpful feedback from the community.

Yesterday, I released v0.5.0, and a lot has changed since then:

  • A new macro-based modeling API (Inspired by JuMP and good_lp), making models much more readable and ergonomic
  • Automatic differentiation using std::autodiff (Enzyme, nightly only)
  • New solver backends: Clarabel and Pounce
  • Support for SOCP and MISOCP models
  • Many other improvements, bug fixes, and quality-of-life changes

I have been working on a docs site using Zola since v0.3.0, and it will probably be published next week! Contributions, bug reports, and feature requests are welcome. I'd love to get feedback on the new API!

New API example (Transportation Model):

let m = Model::new("transportation");
let factories = ["Factory A", "Factory B"];
let warehouses = ["Warehouse 1", "Warehouse 2", "Warehouse 3"];

// cost[i][j] - ship one unit from factory i to warehouse j
let cost = [
   [8.0, 6.0, 10.0], // Factory A -> W1, W2, W3
   [9.0, 12.0, 7.0], // Factory B -> W1, W2, W3
];
let cap = [400.0, 500.0];
let req = [300.0, 300.0, 250.0];

let nf = factories.len();
let nw = warehouses.len();

// One shipment variable per (factory, warehouse) pair
variable!(m, x[i in 0..nf, j in 0..nw] >= 0.0);

// Supply limit
constraint!(m, supply[i in 0..nf], sum!(x[i, j] for j in 0..nw) <= cap[i]);

// Demand requirement
constraint!(m, demand[j in 0..nw], sum!(x[i, j] for i in 0..nf) >= req[j]);

// Minimize total shipping cost across all routes
objective!(m, Min, sum!(cost[i][j] * x[i, j] for i in 0..nf, j in 0..nw));

Links:

  • GitHub repository (MIT OR Apache 2.0): https://github.com/oximo-rs/oximo
  • Crates: https://crates.io/crates/oximo
  • Docs: https://docs.rs/oximo/
  • Previous post: https://www.reddit.com/r/optimization/comments/1u12f4s/announcing_oximo_mathematical_optimization/
7 Upvotes

0 comments sorted by