Vehicle Routing Problems example for Python

2,422 views
Skip to first unread message

Sid Shah

unread,
Mar 20, 2015, 4:43:07 PM3/20/15
to or-tools...@googlegroups.com
Hello,
I was wondering if someone could share an implementaton of ortools for VRP in Python. I have seen the TSP example was able to successfully use it but I am unclear as to how to set up the solver for VRP. 

thx

Shawn

unread,
Mar 22, 2015, 11:20:02 PM3/22/15
to or-tools...@googlegroups.com
I think I remember an example posted on this group email.  Try and search it and you may find an example.  --Shawn

Sid Shah

unread,
Mar 25, 2015, 6:18:41 PM3/25/15
to or-tools...@googlegroups.com
Thanks. I found this example


However when I tried running it , it gave me an error (please see below). The culprit seems to be this line

routing.AddVectorDimension(demands,vehicle_capacity,1,"Demand")

vehicle_capacity is 48 in the example and demands is a list . Can someone tell me how I can initialize AddVectorDimension properly ?

thanks 

 routing.AddVectorDimension(demands,vehicle_capacity,1,"Demand")  File "//anaconda/lib/python2.7/site-packages/ortools-1.3853-py2.7-macosx-10.9-intel.egg/ortools/constraint_solver/pywrapcp.py", line 1797, in AddVectorDimension
 def AddVectorDimension(self, *args): return _pywrapcp.RoutingModel_AddVectorDimension(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'RoutingModel_AddVectorDimension'.
  Possible C/C++ prototypes are:
    operations_research::RoutingModel::AddVectorDimension(int64 const *,int64,bool,std::string const &)
    operations_research::RoutingModel::AddVectorDimension(std::vector< int64,std::allocator< int64 > > const &,int64,bool,std::string const &)

Reply all
Reply to author
Forward
0 new messages