<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Vehicle routing Problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Vehicle-routing-Problem/m-p/418222#M2103</link>
    <description>&lt;P&gt;Node 1 plays the role of your dummy node.&amp;nbsp; You just need to modify the distances, as shown in&amp;nbsp;&lt;A href="http://go.documentation.sas.com/?docsetId=ormpex&amp;amp;docsetTarget=ormpex_ex27_sect009.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;this doc example&lt;/A&gt;&amp;nbsp;and pages 8-9 of&amp;nbsp;&lt;A href="http://support.sas.com/resources/papers/proceedings14/SAS101-2014.pdf" target="_self"&gt;this SAS Global Forum 2014 paper&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2017 17:03:22 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2017-12-04T17:03:22Z</dc:date>
    <item>
      <title>Vehicle routing Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Vehicle-routing-Problem/m-p/418068#M2102</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to write a vehicle routing problem as follows.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there anyway to declare a dummy node that has 0 values of time,demand and 0 distance to every node.And every vehicle must start and end on this dummy node?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* number of vehicles available */&lt;BR /&gt;%let num_vehicles = 8;&lt;BR /&gt;/* capacity of each vehicle */&lt;BR /&gt;%let capacity = 3000;&lt;BR /&gt;/* node, x coordinate, y coordinate, demand time */&lt;BR /&gt;data vrpdata;&lt;BR /&gt;input node x y demand time;&lt;BR /&gt;datalines;&lt;BR /&gt;1 145 215 0 30&lt;BR /&gt;2 151 264 1100 25&lt;BR /&gt;3 159 261 700 15&lt;BR /&gt;4 130 254 800 35&lt;BR /&gt;5 128 252 1400 10&lt;BR /&gt;6 163 247 2100 10&lt;BR /&gt;7 146 246 400 20&lt;BR /&gt;8 161 242 800 25&lt;BR /&gt;9 142 239 100 10&lt;BR /&gt;10 163 236 500 10&lt;BR /&gt;11 148 232 600 35&lt;BR /&gt;12 128 231 1200 5&lt;BR /&gt;13 156 217 1300 10&lt;BR /&gt;14 129 214 1300 15&lt;BR /&gt;15 146 208 300 15&lt;BR /&gt;16 164 208 900 10&lt;BR /&gt;17 141 206 2100 35&lt;BR /&gt;18 147 193 1000 25&lt;BR /&gt;19 164 193 900 20&lt;BR /&gt;20 129 189 2500 10&lt;BR /&gt;21 155 185 1800 10&lt;BR /&gt;22 139 182 700 20&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;BR /&gt;/* read the node location and demand data */&lt;BR /&gt;set NODES;&lt;BR /&gt;num x {NODES};&lt;BR /&gt;num y {NODES};&lt;BR /&gt;num demand {NODES};&lt;BR /&gt;num capacity = &amp;amp;capacity;&lt;BR /&gt;num num_vehicles = &amp;amp;num_vehicles;&lt;BR /&gt;read data vrpdata into NODES=[node] x y demand ;&lt;BR /&gt;set ARCS = {i in NODES, j in NODES: i ne j};&lt;BR /&gt;set VEHICLES = 1..num_vehicles;&lt;/P&gt;&lt;P&gt;/* define the depot as node 1 */&lt;BR /&gt;num depot = 1;&lt;/P&gt;&lt;P&gt;/* define the arc cost as the rounded Euclidean distance */&lt;BR /&gt;num cost {&amp;lt;i,j&amp;gt; in ARCS} = round(sqrt((x[i]-x[j])^2 + (y[i]-y[j])^2));&lt;/P&gt;&lt;P&gt;/* Flow[i,j,k] is the amount of demand carried on arc (i,j) by vehicle k */&lt;BR /&gt;var Flow {ARCS, VEHICLES} &amp;gt;= 0 &amp;lt;= capacity;&lt;BR /&gt;/* UseNode[i,k] = 1, if and only if node i is serviced by vehicle k */&lt;BR /&gt;var UseNode {NODES, VEHICLES} binary;&lt;BR /&gt;/* UseArc[i,j,k] = 1, if and only if arc (i,j) is traversed by vehicle k */&lt;BR /&gt;var UseArc {ARCS, VEHICLES} binary;&lt;/P&gt;&lt;P&gt;/* minimize the total distance traversed */&lt;BR /&gt;min TotalCost = sum {&amp;lt;i,j&amp;gt; in ARCS, k in VEHICLES} cost[i,j] * UseArc[i,j,k];&lt;/P&gt;&lt;P&gt;/* each non-depot node must be serviced by at least one vehicle */&lt;BR /&gt;con Assignment {i in NODES diff {depot}}:&lt;BR /&gt;sum {k in VEHICLES} UseNode[i,k] &amp;gt;= 1;&lt;/P&gt;&lt;P&gt;/* each vehicle must start at the depot node */&lt;BR /&gt;for{k in VEHICLES} fix UseNode[depot,k] = 1;&lt;/P&gt;&lt;P&gt;/* some vehicle k traverses an arc that leaves node i&lt;BR /&gt;if and only if UseNode[i,k] = 1 */&lt;BR /&gt;con LeaveNode {i in NODES, k in VEHICLES}:&lt;BR /&gt;sum {&amp;lt;(i),j&amp;gt; in ARCS} UseArc[i,j,k] = UseNode[i,k];&lt;/P&gt;&lt;P&gt;/* some vehicle k traverses an arc that enters node i&lt;BR /&gt;if and only if UseNode[i,k] = 1 */&lt;BR /&gt;con EnterNode {i in NODES, k in VEHICLES}:&lt;BR /&gt;sum {&amp;lt;j,(i)&amp;gt; in ARCS} UseArc[j,i,k] = UseNode[i,k];&lt;/P&gt;&lt;P&gt;/* the amount of demand supplied by vehicle k to node i must equal demand&lt;BR /&gt;if UseNode[i,k] = 1; otherwise, it must equal 0 */&lt;BR /&gt;con FlowBalance {i in NODES diff {depot}, k in VEHICLES}:&lt;BR /&gt;sum {&amp;lt;j,(i)&amp;gt; in ARCS} Flow[j,i,k] - sum {&amp;lt;(i),j&amp;gt; in ARCS} Flow[i,j,k]&lt;BR /&gt;= demand[i] * UseNode[i,k];&lt;/P&gt;&lt;P&gt;/* if UseArc[i,j,k] = 1, then the flow on arc (i,j) must be at most capacity&lt;BR /&gt;if UseArc[i,j,k] = 0, then no flow is allowed on arc (i,j) */&lt;BR /&gt;con VehicleCapacity {&amp;lt;i,j&amp;gt; in ARCS, k in VEHICLES}:&lt;BR /&gt;Flow[i,j,k] &amp;lt;= Flow[i,j,k].ub * UseArc[i,j,k];&lt;/P&gt;&lt;P&gt;/* decomp by vehicle */&lt;BR /&gt;for {i in NODES, k in VEHICLES} do;&lt;BR /&gt;LeaveNode[i,k].block = k;&lt;BR /&gt;EnterNode[i,k].block = k;&lt;BR /&gt;end;&lt;BR /&gt;for {i in NODES diff {depot}, k in VEHICLES} FlowBalance[i,k].block = k;&lt;BR /&gt;for {&amp;lt;i,j&amp;gt; in ARCS, k in VEHICLES} VehicleCapacity[i,j,k].block = k;&lt;/P&gt;&lt;P&gt;/* solve using decomp (aggregate formulation) */&lt;BR /&gt;solve with MILP / varsel=ryanfoster decomp=(logfreq=20);&lt;BR /&gt;The following OPTMODEL statements create node and edge data for the optimal routing:&lt;BR /&gt;/* create solution data set */&lt;BR /&gt;str color {k in VEHICLES} =&lt;BR /&gt;['red' 'green' 'blue' 'black' 'orange' 'gray' 'maroon' 'purple'];&lt;BR /&gt;create data node_data from [i] x y;&lt;BR /&gt;create data edge_data from [i j k]=&lt;BR /&gt;{&amp;lt;i,j&amp;gt; in ARCS, k in VEHICLES: UseArc[i,j,k].sol &amp;gt; 0.5}&lt;BR /&gt;x1=x[i] y1=y[i] x2=x[j] y2=y[j] linecolor=color[k];&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* create solution data set */&lt;BR /&gt;str color {k in VEHICLES} =&lt;BR /&gt;['red' 'green' 'blue' 'black' 'orange' 'gray' 'maroon' 'purple'];&lt;BR /&gt;create data node_data from [i] x y;&lt;BR /&gt;create data edge_data from [i j k]=&lt;BR /&gt;{&amp;lt;i,j&amp;gt; in ARCS, k in VEHICLES: UseArc[i,j,k].sol &amp;gt; 0.5}&lt;BR /&gt;x1=x[i] y1=y[i] x2=x[j] y2=y[j] linecolor=color[k];&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 06:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Vehicle-routing-Problem/m-p/418068#M2102</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2017-12-04T06:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Vehicle routing Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Vehicle-routing-Problem/m-p/418222#M2103</link>
      <description>&lt;P&gt;Node 1 plays the role of your dummy node.&amp;nbsp; You just need to modify the distances, as shown in&amp;nbsp;&lt;A href="http://go.documentation.sas.com/?docsetId=ormpex&amp;amp;docsetTarget=ormpex_ex27_sect009.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;this doc example&lt;/A&gt;&amp;nbsp;and pages 8-9 of&amp;nbsp;&lt;A href="http://support.sas.com/resources/papers/proceedings14/SAS101-2014.pdf" target="_self"&gt;this SAS Global Forum 2014 paper&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 17:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Vehicle-routing-Problem/m-p/418222#M2103</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-04T17:03:22Z</dc:date>
    </item>
  </channel>
</rss>

