facing issue in NA VRP C# code customization

2304
7
01-26-2014 10:27 PM
Highlighted
New Contributor
I have downloaded Csharp sample code for VRP from SDk help


I wanted to add just one extra parameter say(Cost) which has time unit and analyze the same network.

Problem Faced :

1. When I tried adding one more attribute "Cost" (Usage typ///) value= minutes, I get an exception "Input string is not in a correct format"

2. When I change distance unit attribute from mile to meter I get exception "No Orders Routed"

Please do help.

Thanks
Tags (2)
Reply
0 Kudos
7 Replies
Highlighted
Occasional Contributor III
Hello!

Which sample did you download?  Was it this one:

http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Sample_Vehicle_routing_problem_s...


Which version of the software are you on?


As for your questions:

"1. When I tried adding one more attribute "Cost" (Usage typ///) value= minutes, I get an exception "Input string is not in a correct format"

Where did you add a cost attribute?  What line of code threw the exception?   What network dataset are you using?


"2. When I change distance unit attribute from mile to meter I get exception "No Orders Routed"

Were you getting a correct solve before?  Which line of code are you using to change the distance attribute.



Thanks for being patient.  We'll figure this out.

Reply
0 Kudos
Highlighted
New Contributor
downloaded sample C# code from

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000001s3000000

using ArcGIS desktop 10

I added one more cost attribute having unit Minutes to Network dataset layer

My core problem,

*********************************************************************************************

Actually my problem is am trying to add more cost attributes other than "Time" and "Distance", for e.g. (CO2, Operating Cost etc) while optimizing the routes using VRP tool of NA for research purpose. SO that i can understand which is the most influencing attribute. This exercise am doing for optimizing Solid waste collection routes.

**********************************************************************************************
But, as default it considers either "Time" or "distance" impedance.

So am trying to customize the code, so that it can take other distributes also other than "Time" and "cost" and give routing according to specified impedance.

Want to check how routing affects with optimizing routing with each parameter. So i can say if you use Time as factor this is the routing for solid waste collection, and if CO2 is factor this is the routing for solid waste collection. And simultaneously how each parameter is behaving while optimizing each parameter. For e.g. if am optimizing SWM routing with "Time" , so what is incurred operating cost, distance traveled, CO2 emission from SWM vehicles. And if am optimizing with "Operating Cost" then how much time taken, distance traveled and Co2 emission and so on....

**********************************************************************************************

We get correct solution for "Time" and "Distance" but not for parameters other than those.
**********************************************************************************************

So now my first query is ,

1. isn't it possible to incorporate attributes other than Time and Distance ? if yes how ?

2. Is there any restriction in customizing sample code? Do we have to change any setting of code or ArcGIS NA VRP tool ?
Reply
0 Kudos
Highlighted
by
Occasional Contributor
Hi,

VRP solver uses the time impedance to calculate OD matrix and assign orders to route based on the time information from the OD matrix. The distance attribute will be accumulated along the route. Unfortunately, VRP solver only supports optimizing the route with the impedance in time unit. If you put monetary attribute in time impedance, it won't work.

Route solver supports various impedance attributes and accumulated attributes. If you know the order assignment on routes, you may try to use route solver to calculate all kinds of accumulated costs.

Thanks.

Anna
Reply
0 Kudos
Highlighted
New Contributor
Hi,

VRP solver uses the time impedance to calculate OD matrix and assign orders to route based on the time information from the OD matrix. The distance attribute will be accumulated along the route. Unfortunately, VRP solver only supports optimizing the route with the impedance in time unit. If you put monetary attribute in time impedance, it won't work.

Route solver supports various impedance attributes and accumulated attributes. If you know the order assignment on routes, you may try to use route solver to calculate all kinds of accumulated costs.

Thanks.

Anna


Thanks for reply.

Is that mean i can not customize code to use other than time impedance and get accumulated attributes for rest of attributes??
Reply
0 Kudos
Highlighted
by
Occasional Contributor
Unfortunately, you can not use other than time impedance to optimize routes in VRP solver.
Reply
0 Kudos
Highlighted
New Contributor
Can you suggest any alternative way out for same?
Reply
0 Kudos
Highlighted
by
Occasional Contributor
One workaround could be:
I assume that you have a constant value of operational cost on each edge in the network. If that is the case, you may try to set the unit of your operational cost as a time unit in the network dataset and use it as the time impedance. Since travel cost on each edge is calculated as travel time (which is operational cost in your case) * CostPerUnitTime + travel distance * CostPerUnitDistance, you will need to set a proper value for CostPerUnitTime, i.e. 1. The solution will show you the low cost order assignment and sequence. However, all the time information output becomes meaningless and you shouldn't use any time windows in the problem setting. You may load the order assignment from VRP solver to Route solver, and choose a true time impedance to obtain the valid time output information.

Hope this works for you.

Thanks.

Anna
Reply
0 Kudos