rust-or / good_lp

Linear Programming for Rust, with a user-friendly API. This crate allows modeling LP problems, and lets you solve them with various solvers.
https://crates.io/crates/good_lp
MIT License
238 stars 34 forks source link

Iteratively adding constraints to a large model #61

Closed hangsuUNC closed 2 months ago

hangsuUNC commented 2 months ago

Hi,

I was trying to use good-lp to solve a mixed integer linear programing problem. Is it possible to iteratively adding constraints to a model? If yes, is there an example how to use the add_constraints() function?

Thanks,

Hang

lovasoa commented 2 months ago

The function you are looking for is probably https://docs.rs/good_lp/latest/good_lp/solvers/trait.SolverModel.html#method.with

there are many examples in this repo and in the documentation