scipopt / russcip

Rust interface for SCIP
https://crates.io/crates/russcip
Apache License 2.0
30 stars 10 forks source link

Add indicator constraints #119

Closed mohammadfawaz closed 5 months ago

mohammadfawaz commented 6 months ago

I have locally made a change to enable indicator constraints with the following interface:

    // Indicator constraint: `binvar == 1` implies `coefs * vars <= rhs`
    fn add_cons_indicator(
        &mut self,
        binvar: Rc<Variable>,
        vars: Vec<Rc<Variable>>,
        coefs: &mut [f64],
        rhs: f64,
        name: &str,
    ) -> Rc<Constraint>;

which uses SCIP's SCIPcreateConsBasicIndicator.

This is quite useful for manipulating all kinds of Boolean expressions such as OR constraints etc.

Would love to see this as part of the russcip official published crate instead of publishing my own.

@mmghannam I am happy to put up a PR with my local changes to enable this. Are you okay with that?