Kuifje02 / vrpy

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

Type Error while calling prob.solve() - __init()__ got an unexpected keyword argument 'REF_forward' #27

Closed sumi1234 closed 4 years ago

sumi1234 commented 4 years ago

I am facing issues in using the library. While running the example in the documentation - I keep getting a type error init() got an unexpected keyword argument 'REF_forward'

When I set the pricing_strategy variable as "PrunePath", I don't get this error. However, it seems like the solver is only giving me the MIP solution in that case.

Environment : Anaconda 3 ( Python 3.7.6 ) on Windows 10.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-23-7ab8d68a34cd> in <module>
 #prob.solve()

~\anaconda3\lib\site-packages\vrpy\main.py in solve(self, initial_routes, preassignments, pricing_strategy, cspy, exact, time_limit, solver)
    159                 cspy,
    160                 exact,
--> 161                 solver,
    162             )
    163 

~\anaconda3\lib\site-packages\vrpy\main.py in _find_columns(self, k, more_routes, no_improvement, time_limit, pricing_strategy, cspy, exact, solver)
    272         if not more_routes or pricing_strategy == "Exact":
    273             subproblem = self._def_subproblem(duals, cspy, exact, solver,)
--> 274             self.routes, more_routes = subproblem.solve(time_limit)
    275 
    276         # Keep track of convergence rate

~\anaconda3\lib\site-packages\vrpy\subproblem_cspy.py in solve(self, time_limit)
     90                     REF_forward=self.get_REF("forward"),
     91                     REF_backward=self.get_REF("backward"),
---> 92                     REF_join=self.get_REF("join"),
     93                 )
     94             else:

TypeError: __init__() got an unexpected keyword argument 'REF_forward'
Kuifje02 commented 4 years ago

It seems you are using deprecated versions.

What version are you using ? Please try and use the last version (0.2.0). Note that PrunePaths has been replaced by BestPaths.

So try a pip uninstall vrpy in a terminal, followed by a pip install vrpy and rerun your code. Let me know if this fixes the error.

sumi1234 commented 4 years ago

Thanks so much for the quick response ! This fixed my issue :)

I would just add that I continued to face the same error on just reinstalling vrpy. It was fixed after I uninstalled both cspyand vrpybefore re-installing the latest versions. ( The version of vrpy on my system was 0.1.0 )

Kuifje02 commented 4 years ago

Great, happy to help! Yes indeed, be sure to uninstall cspy as well. When installing vrpy, the latest version of cspy is automatically installed as well.