Kuifje02 / vrpy

A python framework for solving the VRP and its variants with column generation.
MIT License
173 stars 42 forks source link

TypeError: __init__() got an unexpected keyword argument 'timeLimit' #140

Closed oalotaik closed 1 year ago

oalotaik commented 1 year ago

Hello there,

whenever I call the solve method, e.g. prob.solve(), I get this error. See below for more details

TypeError Traceback (most recent call last)

in ----> 1 prob.solve() c:\python371\lib\site-packages\vrpy\vrp.py in solve(self, initial_routes, preassignments, pricing_strategy, cspy, exact, time_limit, solver, dive, greedy, max_iter, run_exact, heuristic_only) 252 self._initialize(solver) 253 # Column generation procedure --> 254 self._solve(dive, solver) 255 256 @property c:\python371\lib\site-packages\vrpy\vrp.py in _solve(self, dive, solver) 491 492 def _solve(self, dive, solver): --> 493 self._column_generation() 494 if dive: 495 self._dive = True c:\python371\lib\site-packages\vrpy\vrp.py in _column_generation(self) 514 while self._more_routes: 515 # Generate good columns --> 516 self._find_columns() 517 # Stop if time limit is passed 518 if ( c:\python371\lib\site-packages\vrpy\vrp.py in _find_columns(self) 539 else: 540 duals, relaxed_cost = self.masterproblem.solve( --> 541 relax=True, time_limit=self._get_time_remaining() 542 ) 543 logger.info("iteration %s, %.6s" % (self._iteration, relaxed_cost)) c:\python371\lib\site-packages\vrpy\master_solve_pulp.py in solve(self, relax, time_limit) 43 44 def solve(self, relax, time_limit): ---> 45 self._solve(relax, time_limit) 46 logger.debug("master problem relax %s" % relax) 47 logger.debug("Status: %s" % pulp.LpStatus[self.prob.status]) c:\python371\lib\site-packages\vrpy\master_solve_pulp.py in _solve(self, relax, time_limit) 202 msg=False, 203 timeLimit=time_limit, --> 204 options=["startalg", "barrier", "crossover", "0"], 205 ) 206 ) c:\python371\lib\site-packages\pulp\apis\coin_api.py in __init__(self, path, *args, **kwargs) 269 raise PulpSolverError('Use COIN_CMD if you want to set a path') 270 #check that the file is executable --> 271 COIN_CMD.__init__(self, path=self.pulp_cbc_path, *args, **kwargs) 272 273 def COINMP_DLL_load_dll(path): TypeError: __init__() got an unexpected keyword argument 'timeLimit'
oalotaik commented 1 year ago

I tried older versions as well and I still get this error. Is it just me? No one else seems to have this problem. I thought about editing the source code but it's a terrifying idea.

I hope someone knows what's going on here

torressa commented 1 year ago

I think you're using an old PuLP version. The line raising the Exception is no longer there (https://github.com/coin-or/pulp/blob/master/pulp/apis/coin_api.py#L270) please try upgrading PuLP to the latest version.

oalotaik commented 1 year ago

Thanks a lot, David. You are correct. Upgrading PuLP solved my problem.