Add support for NLP/MINLP/QP/MIQP#7
Merged
Merged
Conversation
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
There was a problem hiding this comment.
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-exprand 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.
| 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for solving NLP/MINLP/QP/MIQP models.
The PR adds:
Some notes:
grbcrate that is pinned to the Gurobi V12 API. Once we have Gurobi V13 support (See Support Gurobi V13 ykrist/rust-grb#31), we will need to migrate the API to use the new Gurobi opcode-based API.highscrate does not exportHighs_passHessianyet (See HiGHS does not exportHighs_passHessianrust-or/highs#43, Addtry_pass_hessianto the highs API rust-or/highs#44), so we would need to add thehighs-syscrate if we wanted to add it now.Checklist
cargo fmtandcargo clippyto ensure code qualitycargo test)cargo test --features gamspasses (requires GAMS)cargo test --features gurobipasses (requires Gurobi)