-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cbc command line ignores "seconds" #467
Comments
Actually, using CbcModel's |
Sorry @jhmgoossens I somehow missed your original report when it came in. Yes, this is a sticky point that needs to be addressed somehow. Ideally, we would unify the parameter mechanisms in CbcSolver and CbcModel, but as a quick fix, the synchronization should take place when the parameter is actually set in CbcSolver, not later on. What is happening (I guess) is that the parameters are set in CbcSolver, then you are changing a parameters in CbcMode, and only afterwards is the synchronization occurring (right prior to the solve call). For a quick fix, we can incorporate the sychronization into the parameter setting itself, which was the original intent. In fact, there is a |
Ok, two-way pushing of changes would be a way to resolve this until a more rigorous refactoring. I'll try to understand what's going on. |
I don't think two-way pushing is necessary, since it wasn't that way before. We just need to ensure that the pushing into CbcModel occurs right away and not after one of the parameters was subsequently set to a different value that was really meant to over-ride the first one. One of the things I had in mind with the new parameters class was CbcModel and CbcSolver could possibly just share the same parameter object. That just eliminates the issue altogether. I think it would not be too difficult to achieve this, but it would probably involve a lot of rote substitution and could end up breaking a lot of old code unless we leave the parameter setting functions of CbcModel in place and just change their implementation. There are certainly parameters I could imagine a user wanting to change in a callback (changing frequency of cut generation or primal heuristics, for example). But it would also seem to be easy to allow this with the parameter object. |
Actually, it looks like most of the mechanics are already there, just completely untested. The parameters already have push functions defined and the model parameters all share a common push function. This is set here. Lines 2354 to 2362 in 41709ce
The implementation of pushCbcModelIntParam is here.Lines 1219 to 1274 in 41709ce
So the pushing is already set up for some of the parameters. One would just need to check that this mapping is correct. Currently, the push functions are off by default. To do the actual pushing, there is an optional parameter to the set methods of CoinParam , like here.https://github.com/coin-or/CoinUtils/blob/79344533de4c7d57315ad75b08cc834614fdd8dd/src/CoinParam.hpp#L341-L343 One potential gotcha is that it is necessary for a pointer to the model to set prior to calling the push function. This is done with Line 1849 in 41709ce
|
Yes, but that is a workaround that I would like to get rid of, so it would still be great if you could help investigate and do some testing! |
The latest build of Cbc (command line tool) and CbcMain ignore the "seconds" time limit argument.
If this is a known remaining TODO on the list for the Cbc refactoring #374, then please close & ignore this issue.
The "seconds" option seems to be recognized:
seconds was changed from 1e+08 to 5
but is not actually used during the run--the solve just keeps going--because the dblParam CbcMaximumSeconds is not set to the requested value.
Example:
cbc -import mas74.mps -seconds 5 -solve -quit
What does work:
setMaximumSeconds(5.0)
works fine though.cbcParameters[CbcParam::TIMELIMIT]->setDblVal(5.0)
works well.I tried
cbc -import mas74.mps -timelimit 5 -solve -quit
but that fails with Unrecognized parameter.
The text was updated successfully, but these errors were encountered: