Hello again! First, let me start by saying I am not sure if this should be an issue for coin_cbc or good_lp and it could simply be that how I'm building the model isn't a 1:1 comparison to my building of the model in python with the use of pywraplp.
Next, the basic timings:
144 s - Rust single threaded - uses ~ 10% of all cores.
81 s - Rust thread safe x16 parallel threads using rust built model (using `good_lp` interface) - uses ~ 40% of all cores.
31 s - Python thread safe x16 parallel threads - uses ~100% of all cores.
Each is solving 7,353 instances of a model where only two bounds need changing. The Python implementation is reading the data from json file, parsing, solving and then post-processing the results where-as the Rust implementation is using hardcoded static input data and only counting the resulting optimal solutions. They are all using the Google OR-Tools distributed Cbc build.
An interesting thing is when I export the model via pywraplp and then read the model using coin_cbc I get an error from cbc the the import contained two read errors (two bounds with no match for a column), which when removed resolved the error and didn't alter the result.
I profiled the Rust code and it stated 93% of the time was being spent in the solve() but why so slow?!? The only thing I could think of was the model being different and indeed they are (see attached with txt extension). To verify I needed to read the .mps into but that is only available when using the raw::model which means I am also bypassing anything happening from there all the way up to good_lps Solvers. Not ideal but since the profiler said it was in the solve and feasibility checks I'm thinking there shouldn't be anything with that much overhead.
EDIT: I cut out all of the code originally in this post based on the comments from @TeXitoi below and have put a repo up with a MWE. See post below...
Hello again! First, let me start by saying I am not sure if this should be an issue for
coin_cbcorgood_lpand it could simply be that how I'm building the model isn't a 1:1 comparison to my building of the model in python with the use ofpywraplp.Next, the basic timings:
Each is solving 7,353 instances of a model where only two bounds need changing. The Python implementation is reading the data from json file, parsing, solving and then post-processing the results where-as the Rust implementation is using hardcoded static input data and only counting the resulting optimal solutions. They are all using the Google OR-Tools distributed Cbc build.
An interesting thing is when I export the model via
pywraplpand then read the model usingcoin_cbcI get an error from cbc the the import contained two read errors (two bounds with no match for a column), which when removed resolved the error and didn't alter the result.I profiled the Rust code and it stated 93% of the time was being spent in the
solve()but why so slow?!? The only thing I could think of was the model being different and indeed they are (see attached withtxtextension). To verify I needed to read the.mpsinto but that is only available when using theraw::modelwhich means I am also bypassing anything happening from there all the way up togood_lps Solvers. Not ideal but since the profiler said it was in the solve and feasibility checks I'm thinking there shouldn't be anything with that much overhead.EDIT: I cut out all of the code originally in this post based on the comments from @TeXitoi below and have put a repo up with a MWE. See post below...