Hello,
I am using the MIP solver and trying to set a time limit on the solve. I could not find any documentation for this exactly, but saw an example with the CP solver in which the following line of code was used:
self.solver.parameters.max_time_in_seconds = 5
When I tried this (Python 3.7) for my model, it threw the following error: "Failed to run set-cover 'Solver' object has no attribute 'parameters'"So I removed ".parameters" and the following no longer throws an error:self.solver = pywraplp.Solver('simple_mip_program', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
self.solver.max_time_in_seconds = 60.0That being said, it doesn't actually seem to cap the solve time, as I've had solves take several hours. Any ideas on what I'm doing wrong here?Thanks
https://developers.google.com/optimization/reference/python/linear_solver/pywraplp#settimelimit
https://developers.google.com/optimization/reference/python/linear_solver/pywraplp#settimelimit
--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/866820a5-004f-496f-a351-421e7f5264b1%40googlegroups.com.
I think you may want to doself.solver.SetTimeLimit( integer_time_in_ms )
See documentation here: https://developers.google.com/optimization/reference/python/linear_solver/pywraplp#settimelimithttps://developers.google.com/optimization/reference/python/linear_solver/pywraplp#settimelimithttps://developers.google.com/optimization/reference/python/linear_solver/pywraplp#settimelimit
On 31 Dec 2019, at 15:19, Mike Prince <mike....@convoy.com> wrote:
Hello,I am using the MIP solver and trying to set a time limit on the solve. I could not find any documentation for this exactly, but saw an example with the CP solver in which the following line of code was used:self.solver.parameters.max_time_in_seconds = 5When I tried this (Python 3.7) for my model, it threw the following error: "Failed to run set-cover 'Solver' object has no attribute 'parameters'"So I removed ".parameters" and the following no longer throws an error:self.solver = pywraplp.Solver('simple_mip_program', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
self.solver.max_time_in_seconds = 60.0That being said, it doesn't actually seem to cap the solve time, as I've had solves take several hours. Any ideas on what I'm doing wrong here?Thanks--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools...@googlegroups.com.