Skip to content

Add support for NLP/MINLP/QP/MIQP#7

Merged
GermanHeim merged 31 commits into
mainfrom
nlp-minlp
May 31, 2026
Merged

Add support for NLP/MINLP/QP/MIQP#7
GermanHeim merged 31 commits into
mainfrom
nlp-minlp

Conversation

@GermanHeim

Copy link
Copy Markdown
Collaborator

Description

Adds support for solving NLP/MINLP/QP/MIQP models.

The PR adds:

  • A classifier helper to classify models
  • Adds support for GAMS and Gurobi backends
  • Adds tests
  • Updates READMEs
  • General fixes

Some notes:

Checklist

  • I have updated the documentation accordingly
  • I have added tests that cover my changes
  • I have run cargo fmt and cargo clippy to ensure code quality
  • All default tests pass (cargo test)
  • cargo test --features gams passes (requires GAMS)
  • cargo test --features gurobi passes (requires Gurobi)

GermanHeim added 27 commits May 27, 2026 08:43
Also refactor GAMS translation since we were over the clippy line limit lint. It is more manageable now.
This commit doesn't use generic expression trees since we need to modify the grb crate to support V13 natively.
I have asked the developer if he could review a PR for it, and I am waiting for his response. Once we add it, we need to update `nonlinear.rs`.
We are not using it for now. Nice to see my previous changes just vanish like this. I will try to add some parallelization later on.
Translated for the GAMS model library (SEQ=116)
Adds nonlinear specs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds nonlinear and quadratic modeling support across the expression layer and solver backends, with GAMS/Gurobi translation paths, tests, examples, and documentation updates.

Changes:

  • Adds division/classification support in oximo-expr and updates model-kind/nonlinear detection.
  • Extends GAMS and Gurobi backends for QP/MIQP/NLP/MINLP translation and solver capability reporting.
  • Adds nonlinear backend tests, a MINLP example, and README updates.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents expanded model kinds and nonlinear expressions.
crates/oximo/README.md Mirrors root README feature/model-kind updates.
crates/oximo/examples/process_selection.rs Adds a process-selection MINLP example.
crates/oximo-gurobi/tests/nonlinear.rs Adds live Gurobi tests for QP/NLP/MINLP/division lowering.
crates/oximo-gurobi/src/translate.rs Adds nonlinear constraint/objective lowering and broader model support.
crates/oximo-gurobi/src/nonlinear.rs Implements Gurobi auxiliary-variable nonlinear lowering.
crates/oximo-gurobi/src/lib.rs Expands supported model kinds.
crates/oximo-gurobi/README.md Documents nonlinear Gurobi support.
crates/oximo-gurobi/Cargo.toml Removes unused Rayon dependency.
crates/oximo-gams/src/translate.rs Adds GAMS nonlinear emission and solve-type selection.
crates/oximo-gams/src/solver_options.rs Adds solver capability validation for GAMS solve types.
crates/oximo-gams/src/options.rs Updates solver capability docs and option solve-type docs.
crates/oximo-gams/src/lib.rs Expands supported model kinds.
crates/oximo-gams/README.md Documents expanded GAMS backend support.
crates/oximo-expr/tests/arithmetic.rs Adds division and classification tests.
crates/oximo-expr/src/visit.rs Traverses division nodes.
crates/oximo-expr/src/simplify.rs Simplifies constant division.
crates/oximo-expr/src/ops.rs Adds division operator overloads.
crates/oximo-expr/src/linear.rs Adds division construction with constant-denominator folding.
crates/oximo-expr/src/lib.rs Exports expression classification.
crates/oximo-expr/src/eval.rs Evaluates division nodes.
crates/oximo-expr/src/classify.rs Adds linear/quadratic/nonlinear expression classification.
crates/oximo-expr/src/arena.rs Adds Div expression node.
crates/oximo-expr/README.md Documents division support.
crates/oximo-core/tests/model.rs Adds MINLP division classification coverage.
crates/oximo-core/src/model.rs Marks division as nonlinear in model-kind detection.
crates/oximo-core/README.md Removes outdated nonlinear limitation note.
Cargo.lock Reflects Rayon dependency removal from Gurobi crate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/oximo-core/src/model.rs Outdated
nonconst >= 2
}
N::Pow(_, _) | N::Sin(_) | N::Cos(_) | N::Exp(_) | N::Log(_) => true,
N::Div(_, _) | N::Pow(_, _) | N::Sin(_) | N::Cos(_) | N::Exp(_) | N::Log(_) => true,
Comment on lines +147 to +148
println!(" cargo run --example minlp_process_selection --features gams");
println!(" cargo run --example minlp_process_selection --features gurobi");
Replace the `has_nonlinear` function with a `ExprClass` classifier, were we import it and classify into `oximo-core::model`.

The idea originated from a GitHub Copilot Pull Request Review, by the code was designed by me. I don't think it was Assisted (not adding commit trailer).
@GermanHeim GermanHeim merged commit 99f6a49 into main May 31, 2026
3 checks passed
@GermanHeim GermanHeim deleted the nlp-minlp branch May 31, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants