<?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: How to solve an orienteering problem? in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229594#M1123</link>
    <description>&lt;P&gt;Here's one way, iterating between the MILP solver and the network (TSP) solver in a loop with PROC OPTMODEL. &amp;nbsp;The master MILP problem prescribes which nodes to visit, and the TSP subproblem determines whether those nodes can be visited within the allotted time (or distance).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel printlevel=0;
   /* declare parameters and read data */
   set NODES;
   num x {NODES};
   num y {NODES};
   num score {NODES};
   str name {NODES};
   read data indata into NODES=[_N_] x y score name;
   set ARCS = {i in NODES, j in NODES diff {i}};
   num source;
   for {i in NODES: score[i] = 0} do;
      source = i;
      leave;
   end;
   num distance {&amp;lt;i,j&amp;gt; in ARCS} =
      (if j = source then 0 else sqrt((x[i]-x[j])^2+(y[i]-y[j])^2));

   /* declare optimization model */
   var UseNode {NODES} binary;
   max TotalScore = sum {i in NODES} score[i] * UseNode[i];
   num numsols init 0;
   set SOLS = 1..numsols;
   set NODES_s {SOLS};
   con ExcludeSol {s in SOLS}:
      sum {i in NODES_s[s]} UseNode[i] &amp;lt;= card(NODES_s[s]) - 1;
   fix UseNode[source] = 1;

   /* declare parameters used by network solver */
   set TSP_NODES = {i in NODES: UseNode[i].sol &amp;gt; 0.5};
   set &amp;lt;num,num&amp;gt; TOUR;

   /* row generation loop */
   do while (1);
      /* call MILP solver */
      put 'Solving MILP master...';
      solve;
      put TSP_NODES=;
      /* call network (ATSP) solver */
      put 'Solving ATSP subproblem...';
      solve with network / TSP graph_direction=directed
         subgraph=(nodes=TSP_NODES) links=(weight=distance) out=(tour=TOUR);
      put TOUR=;
      /* check feasibility and either exit loop or include new row */
      if _NETWORK_OBJECTIVE_.sol &amp;lt;= &amp;amp;distance_budget then leave;
      else do;
         numsols = numsols + 1;
         NODES_s[numsols] = TSP_NODES;
      end;
   end;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This version uses Euclidean distance, except that the distance back to the source node is 0.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2015 20:25:06 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2015-12-01T20:25:06Z</dc:date>
    <item>
      <title>How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229558#M1122</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been using PROC OPTNET to solve a traveling salesman problem. Now I want to solve an orienteering problem, which is a selective&amp;nbsp;&lt;SPAN&gt;traveling salesman problem. Each node has a prize and the objective is maximize the total prize of the visited nodes within a time constraint. I cannot find any SAS documentation on this specific type of&amp;nbsp;traveling salesman problem on how to solve it. Could someone please direct me?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 16:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229558#M1122</guid>
      <dc:creator>Willemien</dc:creator>
      <dc:date>2015-10-12T16:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229594#M1123</link>
      <description>&lt;P&gt;Here's one way, iterating between the MILP solver and the network (TSP) solver in a loop with PROC OPTMODEL. &amp;nbsp;The master MILP problem prescribes which nodes to visit, and the TSP subproblem determines whether those nodes can be visited within the allotted time (or distance).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel printlevel=0;
   /* declare parameters and read data */
   set NODES;
   num x {NODES};
   num y {NODES};
   num score {NODES};
   str name {NODES};
   read data indata into NODES=[_N_] x y score name;
   set ARCS = {i in NODES, j in NODES diff {i}};
   num source;
   for {i in NODES: score[i] = 0} do;
      source = i;
      leave;
   end;
   num distance {&amp;lt;i,j&amp;gt; in ARCS} =
      (if j = source then 0 else sqrt((x[i]-x[j])^2+(y[i]-y[j])^2));

   /* declare optimization model */
   var UseNode {NODES} binary;
   max TotalScore = sum {i in NODES} score[i] * UseNode[i];
   num numsols init 0;
   set SOLS = 1..numsols;
   set NODES_s {SOLS};
   con ExcludeSol {s in SOLS}:
      sum {i in NODES_s[s]} UseNode[i] &amp;lt;= card(NODES_s[s]) - 1;
   fix UseNode[source] = 1;

   /* declare parameters used by network solver */
   set TSP_NODES = {i in NODES: UseNode[i].sol &amp;gt; 0.5};
   set &amp;lt;num,num&amp;gt; TOUR;

   /* row generation loop */
   do while (1);
      /* call MILP solver */
      put 'Solving MILP master...';
      solve;
      put TSP_NODES=;
      /* call network (ATSP) solver */
      put 'Solving ATSP subproblem...';
      solve with network / TSP graph_direction=directed
         subgraph=(nodes=TSP_NODES) links=(weight=distance) out=(tour=TOUR);
      put TOUR=;
      /* check feasibility and either exit loop or include new row */
      if _NETWORK_OBJECTIVE_.sol &amp;lt;= &amp;amp;distance_budget then leave;
      else do;
         numsols = numsols + 1;
         NODES_s[numsols] = TSP_NODES;
      end;
   end;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This version uses Euclidean distance, except that the distance back to the source node is 0.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 20:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229594#M1123</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-12-01T20:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229690#M1124</link>
      <description>&lt;P&gt;Thank you, I'll try it. Do you know of any formal SAS documentation (a book, an article) on the orienteering problem?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 13:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229690#M1124</guid>
      <dc:creator>Willemien</dc:creator>
      <dc:date>2015-10-13T13:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229711#M1125</link>
      <description>&lt;P&gt;The closest parts of the formal documentation are probably these vehicle routing examples in which each vehicle visits a subset of nodes:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_decomp_examples12.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_decomp_examples12.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex23_toc.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex23_toc.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex27_toc.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex27_toc.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In each case, you can specialize to a single vehicle and modify the objective as needed.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 14:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229711#M1125</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-10-13T14:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229765#M1126</link>
      <description>&lt;P&gt;Thank you again. I really appreciate your speedy responses.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 18:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/229765#M1126</guid>
      <dc:creator>Willemien</dc:creator>
      <dc:date>2015-10-13T18:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/230739#M1132</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please explain the constraint in the given code? What exactly does it do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; con &lt;SPAN class="token number"&gt;Ex&lt;/SPAN&gt;cludeSol &lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;s &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; SOLS&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;:
      &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;i &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; NODES_s&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;s&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt; UseNode&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; card&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;NODES_s&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;s&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I also do not know what card(NODES_s[s] is. I don't see it defined anywhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 13:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/230739#M1132</guid>
      <dc:creator>Willemien</dc:creator>
      <dc:date>2015-10-20T13:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/230746#M1134</link>
      <description>&lt;P&gt;CARD returns the cardinality of a set:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_details10.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_details10.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The left-hand side of the constraint is a sum of binary variables, and the right-hand side is a constant that is one less than the number of binary variables. &amp;nbsp;So the constraint "cuts off" a given solution by preventing all of the specified binary variables from being set to 1.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 14:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/230746#M1134</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-10-20T14:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve an orienteering problem?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/233267#M1161</link>
      <description>&lt;P&gt;It turns out that this approach (enforcing connectivity and relaxing the distance constraint) does not scale well. &amp;nbsp;Each MILP or TSP solver call is fast, but for large instances too many solver calls are required. &amp;nbsp;The other approach used in the linked doc examples (enforcing the distance constraint and relaxing connectivity) scales much better, requiring relatively few solver calls even for large instances.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 16:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-solve-an-orienteering-problem/m-p/233267#M1161</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-11-05T16:49:54Z</dc:date>
    </item>
  </channel>
</rss>

