Using timeout with pulp interface

2,969 views
Skip to first unread message

Melvin Saab

unread,
Apr 22, 2017, 2:26:30 AM4/22/17
to pulp-or-discuss
I am using pulp to solve an ILP problem, and I am using the default CBC solver. My code sets up the variables, constraints, and object in an LpProblem, myProb. Then I call myProb.solve(). How do I set a time limit to the solve call (because the problem I am trying to solve is large)? Also, I am interested in the best solution achieved when the time limit is exceeded. Is this possible?

Thanks.

Franco Peschiera

unread,
Apr 22, 2017, 5:38:16 AM4/22/17
to pulp-or-discuss

Hey Melvin,

You just need to add the following argument in the call: maxSeconds.


I usually use the following call:


model.solve(pulp.PULP_CBC_CMD(maxSeconds=1000, msg=1, fracGap=0))


which controls the maximum time (in seconds), the level of messaging (to see the progress CBC makes) and the max GAP you desire to have (another stop condition in addition to maxSeconds).


regards,


Franco

Reply all
Reply to author
Forward
0 new messages