0

I am using pyomo and cbc to solve a model. I have tried to pass options using the following:

opt = SolverFactory('cbc')
opt.options['seconds'] = 3
OR
results = opt.solve(model, options={"seconds": 3}, tee=True) 

In the output, I get the line: "seconds was changed from 1e+100 to 3" but it still takes about 7 seconds to solve. What am I doing wrong with regards to passing options? Thank you

  • Some parts might be uninterruptable and if Cbc checks against your time-limit just before doing 4 secs of uninterruptible work, something like this can happen. Now, this is an educated guess. 4 s *delay* sounds like a lot, but it's not that surprising (core reasoning: those uninterruptible steps are often *heuristic* in a sense that it's hard to estimate the time they will be in uninterruptible state for all use-cases like yours a-priori). I would treat the log-output as confirmation, that you did not do anything wrong! – sascha Sep 14 '21 at 07:56
  • These are similar cases you may find useful: [first](https://stackoverflow.com/questions/60595491/how-you-enable-cbc-to-return-best-solution-when-timelimit-pyomo), [second](https://stackoverflow.com/questions/64211972/how-can-i-limit-the-running-time-of-coin-cbc-as-the-maxseconds-argument-does-no) – furious_bilbo Sep 14 '21 at 11:09
  • Thanks for the help. After reading those cases, it does seem @sascha is correct, there's some sort of presolve that "seconds" doesn't affect. Is there another way to increase solving speed? – user16906647 Sep 14 '21 at 12:43
  • While presolve is very important in general, sometime you might tune it for your case. I guess you should check the docs which kind of params / tunings are available. Without knowing much about implementation details (e.g. if presolve as a whole is uninterruptible), i would look at *probing* first as it's often one of the more costly steps (although usually implemented with *automatic stopping at some point*). Not sure if it can be activated though. According to AMPLs [param-listing](https://www.gams.com/34/docs/S_CBC.html), `passPresolve` would be my first try to tune. – sascha Sep 14 '21 at 12:50

1 Answers1

0

I believe that the 3 seconds are CPU-seconds, meaning the 3 seconds start when the optimization begins - after model preparation, presolve etc. The optimization cuts off after that time.

SentinelD
  • 11
  • 1