scipopt / russcip

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

Store state-specific variables inside the state object #28

Closed lovasoa closed 1 year ago

lovasoa commented 1 year ago

https://github.com/mmghannam/russcip/blob/ac0bd3c23c04d1a33b4593c8ab7fe6957df624b0/src/model.rs#L14-L28

Currently there is no compile-time guarantee that, for instance, best_sol is always None when the state is Created and is never None when the state is solved.

Variables that are specific to a state should be stored inside the state to enforce such things at compile time. Something like

 pub enum State { 
     Start, 
     ProblemCreated { vars: Variables }, 
     Solved { vars: Variables, solution: Solution }, 
 } 
lovasoa commented 1 year ago

this is a part of #19 (making illegal states impossible to represent)

mmghannam commented 1 year ago

Thank you, great suggestion!

create-issue-branch[bot] commented 1 year ago

Branch issue-28-Store_state-specific_variables_inside_the_state_object created!