<?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: VRP- with multiple tables in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421105#M2134</link>
    <description>&lt;P&gt;Sorry, I described the problem a little bit wrong .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data vehicle_data and node_data like as follows.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data vehicle_data;&lt;BR /&gt;input vehicle capacity type&lt;BR /&gt;datalines;&lt;BR /&gt;1 20 a&lt;BR /&gt;2 50 a&lt;BR /&gt;3 25 b&lt;BR /&gt;4 30 all&lt;BR /&gt;5 40 a&lt;BR /&gt;6 15 b&lt;BR /&gt;7 25 a&lt;BR /&gt;8 20 all&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data node_data;&lt;BR /&gt;input node vehicle_type ;&lt;BR /&gt;datalines;&lt;BR /&gt;1 a&lt;BR /&gt;2 b&lt;BR /&gt;3 b&lt;BR /&gt;4 a&lt;BR /&gt;5 a&lt;BR /&gt;6 a&lt;BR /&gt;7 b&lt;BR /&gt;8 b&lt;BR /&gt;9 b&lt;BR /&gt;10 a&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;The capacity constraint I&amp;nbsp; wrote is total_time. I am calculating travel time between nodes and adding capacity(it is time variable),&lt;BR /&gt;total_time should less than or equal to 5 hours. But I am not sure&amp;nbsp; that is calculated seperately for each type o vehicle.&lt;BR /&gt;And I want to restrict vehicles as their type.For instance, vehicle which is type a , should visit the node that has job a. Vehicle which type is all ,can visit every node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 08:17:27 GMT</pubDate>
    <dc:creator>orangejuss</dc:creator>
    <dc:date>2017-12-14T08:17:27Z</dc:date>
    <item>
      <title>VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/420676#M2126</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a code like this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_decomp_examples14.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_decomp_examples14.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,but with two tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First table is node_table includes nodes,vehicle_type etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second table is vehicle_table includes type, capacity .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;vehicle_type from node_table and type from vehicle_table are same. Should I&amp;nbsp; specify this in code, and how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to add a capacity&amp;nbsp; constraint&amp;nbsp; for each type of vehicle?How can I add this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance:)&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 06:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/420676#M2126</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2017-12-13T06:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/420910#M2128</link>
      <description>&lt;P&gt;Suppose your vehicle_table looks like this (with possibly different capacity values across vehicles):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vehicle_data;
   input vehicle capacity;
   datalines;
1 3000
2 3000
3 3000
4 3000
5 3000
6 3000
7 3000
8 3000
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then in the PROC OPTMODEL code, you would have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   set VEHICLES;
   num capacity {VEHICLES};
   read data vehicle_table into VEHICLES=[vehicle] capacity;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you would also need to change the Flow declaration as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var Flow {ARCS, k in VEHICLES} &amp;gt;= 0 &amp;lt;= capacity[k];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Regarding&amp;nbsp;vehicle_type, do you want to restrict which vehicles can service each node?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 17:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/420910#M2128</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-13T17:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421105#M2134</link>
      <description>&lt;P&gt;Sorry, I described the problem a little bit wrong .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data vehicle_data and node_data like as follows.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data vehicle_data;&lt;BR /&gt;input vehicle capacity type&lt;BR /&gt;datalines;&lt;BR /&gt;1 20 a&lt;BR /&gt;2 50 a&lt;BR /&gt;3 25 b&lt;BR /&gt;4 30 all&lt;BR /&gt;5 40 a&lt;BR /&gt;6 15 b&lt;BR /&gt;7 25 a&lt;BR /&gt;8 20 all&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data node_data;&lt;BR /&gt;input node vehicle_type ;&lt;BR /&gt;datalines;&lt;BR /&gt;1 a&lt;BR /&gt;2 b&lt;BR /&gt;3 b&lt;BR /&gt;4 a&lt;BR /&gt;5 a&lt;BR /&gt;6 a&lt;BR /&gt;7 b&lt;BR /&gt;8 b&lt;BR /&gt;9 b&lt;BR /&gt;10 a&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;The capacity constraint I&amp;nbsp; wrote is total_time. I am calculating travel time between nodes and adding capacity(it is time variable),&lt;BR /&gt;total_time should less than or equal to 5 hours. But I am not sure&amp;nbsp; that is calculated seperately for each type o vehicle.&lt;BR /&gt;And I want to restrict vehicles as their type.For instance, vehicle which is type a , should visit the node that has job a. Vehicle which type is all ,can visit every node.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 08:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421105#M2134</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2017-12-14T08:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421235#M2137</link>
      <description>&lt;P&gt;Here's how you can enforce the type restrictions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vehicle_data;
   input vehicle capacity type $;
   datalines;
1 20 a
2 50 a
3 25 b
4 30 all
5 40 a
6 15 b
7 25 a
8 20 all
;
data node_data;
   input node vehicle_type $;
   datalines;
1 a
2 b
3 b
4 a
5 a
6 a
7 b
8 b
9 b
10 a
;

proc optmodel;
   set VEHICLES;
   num capacity {VEHICLES};
   str type {VEHICLES};
   read data vehicle_data into VEHICLES=[vehicle] capacity type;

   set NODES;
   str vehicle_type {NODES};
   read data node_data into NODES=[node] vehicle_type;

   set NODES_k {k in VEHICLES} = {i in NODES: type[k] in {'all',vehicle_type[i]}};
   put NODES_k[*]=;
   set ARCS_k {k in VEHICLES} = {i in NODES_k[k], j in NODES_k[k]: i ne j};

   var Flow {k in VEHICLES, &amp;lt;i,j&amp;gt; in ARCS_k[k]} &amp;gt;= 0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, if you prefer to keep the indexing of the original example, with k last:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   set ARCS_VEHICLES = setof {k in VEHICLES, &amp;lt;i,j&amp;gt; in ARCS_k[k]} &amp;lt;i,j,k&amp;gt;;
   var Flow {&amp;lt;i,j,k&amp;gt; in ARCS_VEHICLES} &amp;gt;= 0;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And similar changes for UseNode and UseArc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does your capacity constraint look like?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421235#M2137</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-14T16:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421450#M2140</link>
      <description>&lt;P&gt;Thank you:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the constraint I wrote look like this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;num time_minute&lt;SPAN&gt;{&amp;lt;i,j&amp;gt; in arcs}&lt;/SPAN&gt;= traveltime[i,j]+capacity[j];&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;con _capacity{&amp;lt;i,j&amp;gt; in arcs}: sum{k in vehicles} time_minute[i,j] *usearc[i,j,k]&amp;lt;5*60 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 07:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421450#M2140</guid>
      <dc:creator>orangejuss</dc:creator>
      <dc:date>2017-12-15T07:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: VRP- with multiple tables</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421706#M2142</link>
      <description>&lt;P&gt;I suspect that you want a constraint for each vehicle instead, as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con _capacity{k in vehicles}: sum{&amp;lt;i,j&amp;gt; in arcs} time_minute[i,j] *usearc[i,j,k]&amp;lt;=5*60 ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And notice the &amp;lt;= rather than &amp;lt;.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 20:23:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/VRP-with-multiple-tables/m-p/421706#M2142</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-15T20:23:05Z</dc:date>
    </item>
  </channel>
</rss>

