NEOS - Traveling Salesman Problem
https://neos-guide.org/taxonomy/term/16
enMultiple Traveling Salesman Problem (mTSP)
https://neos-guide.org/content/multiple-traveling-salesman-problem-mtsp
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p><b>Summary:</b> The Multiple Traveling Salesman Problem (\(m\)TSP) is a generalization of the Traveling Salesman Problem (TSP) in which more than one salesman is allowed. Given a set of cities, one depot where \(m\) salesmen are located, and a cost metric, the objective of the \(m\)TSP is to determine a tour for each salesman such that the total tour cost is minimized and that each city is visited exactly once by only one salesman.</p>
<h3><a name="top" id="top">Case Study Contents</a></h3>
<ul><li><a href="#problem">Problem Statement</a></li>
<li><a href="#formulation">Mathematical Formulation</a></li>
<li><a href="#gams">GAMS Model</a></li>
<li><a href="#references">References</a></li>
</ul><h2><a name="problem" id="problem">Problem Statement</a></h2>
<p>The Multiple Traveling Salesman Problem (\(m\)TSP) is a generalization of the Traveling Salesman Problem (TSP) in which more than one salesman is allowed. Given a set of cities, one depot (where \(m\) salesmen are located), and a cost metric, the objective of the \(m\)TSP is to determine a set of routes for \(m\) salesmen so as to minimize the total cost of the \(m\) routes. The cost metric can represent cost, distance, or time. The requirements on the set of routes are:</p>
<ul><li>All of the routes must start and end at the (same) depot.</li>
<li>Each city must be visited exactly once by only one salesman.</li>
</ul><p>The \(m\)TSP is a <i>relaxation</i> of the vehicle routing problem (VRP); if the vehicle capacity in the VRP is a sufficiently large value so as not to restrict the vehicle capacity, then the problem is the same as the \(m\)TSP. Therefore, all of the formulations and solution approaches for the VRP are valid for the \(m\)TSP. The \(m\)TSP is a <i>generalization</i> of the TSP; if the value of \(m\) is 1, then the \(m\)TSP problem is the same as the TSP. Therefore, all of the formulations and solution approaches for the \(m\)TSP are valid for the TSP.</p>
<p>Bektas (2006) lists a number of variations on the \(m\)TSP.</p>
<ol><li><b>Multiple depots</b>: Instead of one depot, the multi-depot \(m\)TSP has a set of depots, with \(m_j\) salesmen at each depot \(j\). In the <i>fixed destination</i> version, a salesman returns to the same depot from which he started. In the <i>non-fixed destination</i> version, a salesman does not need to return to the same depot from which he started but the same number of salesmen must return as started from a particular depot. The multi-depot \(m\)TSP is important in robotic applications involving ground and aerial vehicles. For example, see Oberlin et al. (2009).</li>
<li><b>Specifications on the number of salesmen</b>: The number of salesmen may be a fixed number \(m\), or the number of salesmen may be determined by the solution but bounded by an upper bound \(m\).</li>
<li><b>Fixed charges</b>: When the number of salesmen is not fixed, there may be a fixed cost associated with activating a salesman. In the <i>fixed charge</i> version of the \(m\)TSP, the overall cost to minimize includes the fixed charges for the salesmen plus the costs for the tours.</li>
<li><b>Time windows</b>: As with the TSP and the VRP, there is a variation of the \(m\)TSP with time windows. Associated with each node is a time window during which the node must be visited by a tour. The \(m\)TSPTW has many applications, such as school bus routing and airline scheduling.</li>
</ol><h2><a name="formulation" id="formulation">Mathematical Formulation</a></h2>
<p>Here we present an assignment-based integer programming formulation for the \(m\)TSP. </p>
<p>Consider a graph \(G=(V,A)\), where \(V\) is the set of \(n\) nodes, and \(A\) is the set of edges. Associated with each edge \((i,j) \in A\) is a cost (or distance) \(c_{ij}\). We assume that the depot is node 1 and there are \(m\) salesmen at the depot. We define a binary variable \(x_{ij}\) for each edge \((i,j) \in A\); \(x_{ij}\) takes the value 1 if edge \((i,j)\) is included in a tour and \(x_{ij}\) takes the value 0 otherwise. For the subtour elimination constraints, we define an integer variable \(u_i\) to denote the position of node \(i\) in a tour, and we define a value \(p\) to be the maximum number of nodes that can be visited by any salesman.</p>
<p><b>Objective</b><br />
Minimize \( \sum_{(i,j) \in A} c_{ij} x_{ij}\)</p>
<p><b>Constraints</b><br />
Ensure that exactly \(m\) salesmen depart from node 1<br />
\(\sum_{j \in V: (1,j) \in A} x_{1j} = m\)</p>
<p>Ensure that exactly \(m\) salesmen return to node 1<br />
\(\sum_{j \in V: (j,1) \in A} x_{j1} = m\)</p>
<p>Ensure that exactly one tour enters each node<br />
\(\sum_{i \in V: (i,j) \in A} x_{ij} = 1, \forall j \in V\)</p>
<p>Ensure that exactly one tour exits each node<br />
\(\sum_{j \in V: (i,j) \in A} x_{ij} = 1, \forall i \in V\)</p>
<p>Include subtour elimination constraints (Miller-Tucker-Zemlin)<br />
\(u_i - u_j + p \cdot x_{ij} \leq p-1, \forall 2 \leq i \neq j \leq n\)</p>
<p>The literature includes a number of alternative formulations. Some of the alternatives to the two-index variable, assignment-based formulation are a two-index variable formulation with the original subtour elimination constraints (see Laporte and Nobert, 1980), a three-index variable formulation (see Bektas, 2006), and a \(k\)-degree center tree-based formulation (see Christofides et al., 1981 and Laporte, 1992).</p>
<p>To solve this integer linear programming problem, we can use one of the <a href="http://www.neos-server.org/neos/solvers/index.html">NEOS Server solvers</a> in the Mixed Integer Linear Programming (MILP) category. Each MILP solver has one or more input formats that it accepts. </p>
<h2><a name="gams" id="gams">GAMS Model</a></h2>
<p>Click <a href="http://www.neos-guide.org/sites/default/files/bayg29m3.txt">here</a> for a GAMS model for the bayg29 instance from the TSPLIB. The formulation was provided by Erwin Kalvelagen in a blog post <a href="http://yetanothermathprogrammingconsultant.blogspot.com/2009/03/mtspvrp-example.html">here</a>.</p>
<p>If we submit this model to <a href="http://www.neos-server.org/neos/solvers/milp:XpressMP/GAMS.html">XpressMP</a> with a CPU time limit of 1 hour, we obtain a solution with a total cost of 2176 (gap of 4.3%) and the following tours:</p>
<ul><li>Tour 1: i13 - i4 - i10 - i20 - i2 - i13<br />
cost = 60 + 39 + 25 + 49 + 87 = 260</li>
<li>Tour 2: i13 - i18 - i14 - i17 - i22 - i11 - i15 - i13<br />
cost = 128 + 32 + 51 + 47 + 63 + 68 + 86 = 475</li>
<li>Tour 3: i13 - i24 - i8 - i28 - i12 - i6 - i1 - i13<br />
cost = 56 + 48 + 64 + 71 + 46 + 60 + 82 = 427</li>
<li>Tour 4: i13 - i29 - i3 - i26 - i9 - i5 - i21 - i13<br />
cost =160 + 60 + 78 + 57 + 42 + 50 + 82 = 529</li>
<li>Tour 5: i13 - i19 - i25 - i7 - i23 - i27 - i16 - i13<br />
cost = 71 + 52 + 72 + 111 + 74 + 48 + 57 = 485</li>
</ul><h2><a name="references" id="references">References</a></h2>
<ul><li>Bektas, T. 2006. The multiple traveling salesman problem: an overview of formulations and solution procedures.<i> OMEGA: The International Journal of Management Science</i> <b>34</b>(3), 209-219.</li>
<li>Christofides, N., A. Mingozzi, and P. Toth. 1981. Exact algorithms for the vehicle routing problem, based on spanning tree and shortest path relaxations. <i>Mathematical Programming</i> <b>20</b>, 255-282.</li>
<li>Laporte, G. 1992. The vehicle routing problem: an overview of exact and approximate algorithms. <i>European Journal of Operational Research</i> <b>59</b>, 345-358.</li>
<li>Laporte, G. and Y. Nobert. 1980. A cutting planes algorithm for the \(m\)-salesmen problem. <i>Journal of the Operational Research Society</i> <b>31</b>, 1017-1023.</li>
<li>Oberlin, P., S. Rathinam, and S. Darbha. 2009. A transformation for a heterogeneous, multi-depot, multiple traveling salesman problem. In <i>Proceedings of the American Control Conference</i>, 1292-1297, St. Louis, June 10 - 12, 2009.</li>
</ul></div></div></div><section class="field field-name-field-method field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Optimization Category (Linear Programing, Integer, MIP and etc.): </h2><ul class="field-items"><li class="field-item even"><a href="/taxonomy/term/5" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Combinatorial Optimization</a></li><li class="field-item odd"><a href="/taxonomy/term/16" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Traveling Salesman Problem</a></li></ul></section><section class="field field-name-field-file field-type-file field-label-above view-mode-rss"><h2 class="field-label">File: </h2><div class="field-items"><div class="field-item even"><span class="file"><img class="file-icon" alt="Plain text icon" title="text/plain" src="/modules/file/icons/text-plain.png" /> <a href="https://neos-guide.org/sites/default/files/bayg29m3.txt" type="text/plain; length=5934">bayg29m3.txt</a></span></div></div></section>Mon, 18 Jun 2012 16:18:20 +0000cmelan266 at https://neos-guide.orghttps://neos-guide.org/content/multiple-traveling-salesman-problem-mtsp#commentsTraveling Salesman Problem
https://neos-guide.org/content/traveling-salesman-problem
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p>Back to <a href="/content/combinatorial-optimization">Combinatorial Optimization</a></p>
<ul><li><a href="#intro">Introduction</a></li>
<li><a href="#software">Software Resources</a></li>
<li><a href="#resources">Online Resources</a></li>
<li><a href="#references">References</a></li>
</ul><h2><a name="intro" id="intro">Introduction</a></h2>
<p>Perhaps the most famous combinatorial optimization problem is the <b>Traveling Salesman Problem</b> (TSP). Given a complete graph on \(n\) vertices and a weight function defined on the edges, the objective of the TSP is to construct a <i>tour</i> (a circuit that passes through each vertex exactly once) of minimum total weight. The TSP is an example of a <i>hard</i> combinatorial optimization problem; the decision version of the problem is \(\mathcal{NP}\)-complete.</p>
<p><b>Integer Programming Formulation</b><br />
The TSP can be formulated as an integer linear programming problem. Let \(N\) be the set of vertices (cities) and let \(c_{ij}\) be the weight of the edge connecting vertex \(i\) and vertex \(j\). Let decision variable \(x_{ij}\) take the value 1 if the tour includes the edge connecting \(i\) and \(j\) and the value 0 otherwise.</p>
<p>Minimize \( \sum_{i \in N} \sum_{j \in N} c_{ij} x_{ij}\)</p>
<p>subject to: must enter each vertex exactly once<br />
\(\sum_{i \in N} x_{ij} = 1, \quad \forall j \in N\)</p>
<p>subject to: must exit each vertex exactly once<br />
\(\sum_{j \in N} x_{ij} = 1, \quad \forall i\in N\)</p>
<p>subject to: subtour elimination constraints<br />
\(\sum_{i, j \in S} x_{ij} \leq |S| - 1, \quad \forall S \subset N\)</p>
<p>subject to: integrality constraints<br />
\(x_{ij}\) integer</p>
<h2><a name="software" id="software">Software Resources</a></h2>
<ul><li>A <a href="http://www.neos-server.org/neos/solvers/co:concorde/TSP.html">NEOS version</a> of the <a href="http://www.math.uwaterloo.ca/tsp/concorde/index.html">Concorde solver</a> is available for users to solve TSP instances online.</li>
<li>Stephan Mertens's <a href="http://www-e.uni-magdeburg.de/mertens/TSP/" rel="nofollow">TSP Algorithms in Action</a> uses Java applets to illustrate some simple heuristics and compare them to optimal solutions on 10-25 node problems.</li>
<li>Onno Waalewijn has constructed Java TSP applets exhibiting the behavior of different methods for <a href="http://www.waalewijn.com/tspfast.html" rel="nofollow">heuristic</a> and <a href="http://www.waalewijn.com/tspx.html" rel="nofollow">exhaustive</a> search on various test problems.</li>
<li>The <a href="http://tsp.r-forge.r-project.org">TSP Package for R</a> provides infrastructure for specifying instances of a TSP and its (possibly optimal) solution as well as several heuristics to find good solutions. It also provides an interface to the <a href="http://www.math.uwaterloo.ca/tsp/concorde/index.html">Concorde solver</a>.</li>
<li><a href="http://code.google.com/p/google-maps-tsp-solver">TSP Solver for Google Maps API</a> is a component for Google Maps API developers to compute the fastest route that visits a given set of locations.</li>
</ul><p>For practical purposes, the traveling salesman problem is only the simplest case of what are generally known as vehicle-routing problems. Commercial software packages for <i>vehicle routing</i>, or more generally for <i>supply chain management</i>, may have TSP routines. <i>OR/MS Today</i> periodically publishes a <a href="http://www.orms-today.org/surveys/Vehicle_Routing/vrss.html" rel="nofollow">vehicle routing software survey</a>. The most recent survey appeared in the February 2014 issue.</p>
<h2><a name="resources" id="resources">Online Resources</a></h2>
<ul><li><a href="http://www.math.uwaterloo.ca/tsp/index.html">The Traveling Salesman Problem</a> website provides information on the history, applications, and current research on the TSP as well as information about the <a href="http://www.math.uwaterloo.ca/tsp/concorde/index.html">Concorde</a> solver.</li>
<li><a href="http://en.wikipedia.org/wiki/Travelling_salesman_problem">Travelling Salesman Problem</a> on Wikipedia provides some information on the history, solution approaches, and related problems.</li>
<li><a href="http://www.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/">TSPLIB</a> provides a library of sample instances for the TSP and related problems.</li>
</ul><h2><a name="references" id="references">References</a></h2>
<ul><li>Applegate, D. L., Bixby, R. E., Chvátal, V., and Cook, W. J. 2006. <i>The Traveling Salesman Problem: A Computational Study.</i> Princeton University Press, Princeton, NJ.</li>
<li>Cook, W. J. 2011. <i>In Pursuit of the Travelling Salesman: Mathematics at the Limits of Computation</i>. Princeton University Press, Princeton, NJ.</li>
<li>Lawler, E. L., Lenstra, J. K., Rinnooy Kan, A. H. G., and Shmoys, D. B. 1985. <i>The Traveling Salesman Problem: A Guided Tour of Combinatorial Optimization.</i> John Wiley and Sons, New York.</li>
<li>Reinelt, G. 1994. <i>The Traveling Salesman: Computational Solutions for TSP Applications.</i> Springer-Verlag, Heidelberg.</li>
</ul></div></div></div>Mon, 18 Jun 2012 16:16:26 +0000cmelan265 at https://neos-guide.orghttps://neos-guide.org/content/traveling-salesman-problem#commentsRogo Puzzle
https://neos-guide.org/content/rogo-puzzle
<div class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-rss"><div class="field-items"><div class="field-item even" property="content:encoded"><p><b>Summary</b>: Given a \(n \times m\) grid with numbered cells and forbidden cells, the objective of the Rogo puzzle is to find a loop of fixed length through the grid such that the sum of the numbers in the cells on the loop is maximized.</p>
<!--
<img src="/sites/default/files/u2/Rogologo.png"><p>-->
<h3><a name="top" id="top">Case Study Contents</a></h3>
<ul><li><a href="#problem">Problem Statement</a></li>
<li><a href="/content/rogo-puzzle-applet">Solve the Puzzle</a></li>
<li><a href="#formulation">Mathematical Formulation</a></li>
<li><a href="#gams">GAMS Model</a></li>
<li><a href="#references">References</a></li>
</ul><h2><a name="problem" id="problem">Problem Statement</a></h2>
<p>Rogo is a puzzle game that was developed in 2009 by Nicola Petty and Shane Dye, who are faculty members at the University of Canterbury in Christchurch, New Zealand. The <a href="http://www.rogopuzzle.co.nz">Rogo</a> website contains background information, instructions, and a daily Rogo puzzle. Rogo is also available for the iPhone, iPad, and iPod touch.</p>
<p>Given a rectilinear grid with numbered squares and forbidden squares, the objective of Rogo is to find a loop of fixed length (pre-specified) with the maximum score. The score is calculated by summing the numbers in the squares on the loop. The rules of the game are (1) the loop can start on any square, (2) the loop must end at the starting square, (3) the loop may contain only horizontal and vertical steps (diagonal steps are forbidden), (4) the loop may visit a square at most once, and (5) the loop may not include any forbidden squares. A loop with a length of 20 steps and a score of 44 is shown in the grid below.<br /><img src="/sites/default/files/u2/ROGOgame.jpg" /></p>
<p>An example of an illegal move is shown in the grid below; the move is illegal because the square with the "2" in the second column has already been visited on the loop.<br /><img src="/sites/default/files/u2/Illegal_move.png" /></p>
<p>An example of an illegal loop is shown below; the loop does not return to its starting point.<br /><img src="/sites/default/files/u2/Illegal_move_2.png" /></p>
<h2><a href="/content/rogo-puzzle-applet">Solve the Puzzle</a></h2>
<p>Click <a href="/content/rogo-puzzle-applet">here</a> to use the interactive Rogo solver.</p>
<p><a href="#top">Back to the top</a></p>
<h2><a name="formulation" id="formulation">Mathematical Formulation</a></h2>
<!--
<img src="/sites/default/files/u2/Subtour.png"><p>--><br />
Given an \(n \times m\) grid with numbered cells and forbidden cells, the objective of Rogo is to find a loop of fixed length through the grid such that the sum of the numbers in the cells of the loop is maximized. The key to the formulation is writing constraints to enforce the loop requirements:
<ul><li>the loop must start and end at the same cell,</li>
<li>each non-forbidden cell may be visited at most once,</li>
<li>the loop must be exactly the number of specified steps.</li>
</ul><p>Rogo is an example of a puzzle based on a well-known and extensively studied operations research problem called the <b>Traveling Salesman Problem</b> (TSP). Given a list of cities and their pairwise distances, the objective of the TSP is to find the shortest possible tour that visits each city exactly once. Rogo is a special case of the TSP. Because Rogo has a limit on the number of steps and not every cell (city) can be visited, it is a subset-selection TSP. Also, because some of the cells in Rogo have a reward value, it is similar to the prize-collecting TSP. </p>
<!--
There are often close relationships between puzzles and the methods of operations research. For Rogo, it can be formulated as a transformation of the [[Traveling Salesman Problem (TSP)]]. The Traveling Salesman Problem is an NP-hard problem in combinatorial optimization studied in operations research and theoretical computer science. Given a list of cities (vertices) and their pairwise distances, the task is to find the shortest possible tour that visits each city exactly once. Rogo is more similar to a prize-collecting traveling salesman problem, in which the salesman gets a bonus for every city he visits, and a penalty for every city he fails to visit. The difference between Rogo and price-collecting TSP is that we no longer get a penalty, but the total distance we "travel" should equal exactly to a fixed number of steps.
--><p>
The general formulation of the asymmetric TSP is provided below, where \(V\) is the set of cities. The binary variable \(x_{ij}\) takes the value of 1 if the salesman travels between city \(i\) and city \(j\), and the distance \(d_{ij}\) is the distance to travel from \(i\) to \(j\). The first constraint set specifies that there must be an edge that leaves city \(i\). The second constraint set specifies that there must be an edge that enters city \(j\). These two sets of constraints are not sufficient to enforce the loop conditions, however, since they allow for "subtours", which are disjoint loops. The third constraint set is the subtour elimination constraint set, which specifies that every subset \(S\) of cities may contain at most \(|S|-1\) edges. </p>
<h3>TSP Formulation</h3>
<p>Minimize \(\sum_{i \in V}\sum_{j \in V} d_{ij}*x_{ij}\)</p>
<p>subject to<br />
\(\sum_{j \in V} x_{ij} = 1, \forall i \in V\)</p>
<p>\(\sum_{i \in V} x_{ij} = 1, \forall j \in V\)</p>
<p>\(\sum_{i \in S}\sum_{j \in S} x_{ij} \le |S| - 1, \forall S \subseteq V, 2 \le |S| \le |V| - 1\)</p>
<p>Note that since the formulation requires a constraint for each subset \(S\), there can be a very large (exponential) number of subtour elimination constraints. An alternate formulation includes the Miller-Tucker-Zemlin (MTZ) constraints. The formulation with the MTZ constraints is a weaker formulation but it includes a smaller (polynomial) number of constraints. The MTZ formulation is often sufficient for small instances. Let \(u_i\) be the position of city \(i\) in the tour. Then, the MTZ constraints are:</p>
<p>\(u_1 =1\)<br />
\(2 \leq u_i \leq |V|, \forall i \neq 1\)<br />
\(u_i - u_j + 1 \leq (|V|-1)(1 - x_{ij}), \forall 1 \leq i \neq j \leq n\)</p>
<h3>Rogo Formulation</h3>
<p>The TSP formulation with the MTZ constraints is a starting point for the formulation of Rogo. The following modifications are required:</p>
<ul><li>There are forbidden cells in the grid, so not all arcs are allowed. A set of feasible arcs is defined.</li>
<li>The loop does not need to visit every cell, so knowing the starting point is required. A binary variable, \(\delta_i\), is defined to indicate whether or not cell \(i\) is the starting point of the loop.</li>
</ul><p><b>Sets</b><br />
\(V\) = set of cells<br />
\(A\) = set of feasible arcs</p>
<p><b>Parameters</b><br />
\(n\) = number of steps<br />
\(p_i\) = value of cell \(i\), \(\forall i \in V\)</p>
<p><b>Variables</b><br />
\(x_{ij} = \left\{ \begin{array}{ll}<br />
1 & \mbox{if arc \((i,j)\) is in the loop, \(\forall (i,j) \in A\)} \\<br />
0 & \mbox{otherwise}<br />
\end{array} \right. \)<br />
\(y_i = \left\{ \begin{array}{ll}<br />
1 & \mbox{if cell \(i\) is in the loop, \(\forall i \in V\)} \\<br />
0 & \mbox{otherwise}<br />
\end{array} \right. \)<br />
\(\delta_i = \left\{ \begin{array}{ll}<br />
1 & \mbox{if cell \(i\) is the starting point, \(\forall i \in V\)} \\<br />
0 & \mbox{otherwise}<br />
\end{array} \right. \)<br />
\(u_i\) = position of cell \(i\) in the loop, \(\forall i \in V\)</p>
<p>Maximize \(\sum_{i \in V} p_i y_i\)</p>
<p>Subject to:<br />
1. The loop must have \(n\) steps.<br />
\(\sum_{i \in V} y_i = n\)</p>
<p>2. If a cell is entered, it must be exited.<br />
\(\sum_{j:(i,j) \in A} x_{ij} = y_i, \forall i \in V\)</p>
<p>\(\sum_{i:(i,j) \in A} x_{ij} = y_j, \forall j \in V\)</p>
<p>3. If cell \(i\) is the starting point, its relative position in the loop should be exactly one.<br />
\(u_i - \delta_i \geq 0\)</p>
<p>\(u_i + (n - 1)*\delta_i \leq n\)</p>
<p>4. The loop can have only one starting point.<br />
\(\sum_{i \in V} \delta_i = 1\)</p>
<p>5. The MTZ constraints are modified to accommodate that not every cell is visited.<br />
\(u_i - u_j + n*(x_{ij} - \delta_j) \leq n-1, 1 \leq i \neq j \leq n\)</p>
<p>To solve this mixed integer linear programming problem, we can use one of the <a href="http://www.neos-server.org/neos/solvers/index.html">NEOS Server solvers</a> in the Mixed Integer Linear Programming (MILP) category. Each MILP solver has one or more input formats that it accepts. </p>
<p><a href="#top">Back to the top</a></p>
<h2><a name="gams" id="gams">GAMS Model</a></h2>
<p>As an example, we provide a GAMS model for <a href="http://www.rogopuzzle.co.nz/paper-rogos/intro-rogo-3">"Introductory Rogo #3"</a> puzzle from the Rogo website.</p>
<p>set V /1*40/;<br />
scalars nrow /5/, ncol /8/;<br />
scalar steps /12/;</p>
<p>alias(V,i,j);</p>
<p>set arc(i,j);</p>
<p>parameter p(V) /1 2, 2 0, 3 3, 4 0, 5 1, 6 0, 7 0, 8 2,<br />
9 0, 10 3, 11 0, 12 0, 13 0, 14 0, 15 4, 16 0,<br />
17 4, 18 0, 19 1, 20 0, 21 0, 22 4, 23 0, 24 1,<br />
25 0, 26 0, 27 -100, 28 2, 29 2, 30 -100, 31 0, 32 0,<br />
33 0, 34 0, 35 2, 36 0, 37 0, 38 2, 39 0, 40 0/;</p>
<p>arc(i,j) = yes\$(abs(ord(i)-ord(j))=ncol or (ord(j)-ord(i))\$(mod(ord(i),ncol) ne 0 and<br />
mod(ord(j),ncol) ne 1)=1 or (ord(i)-ord(j))\$(mod(ord(j),ncol) ne 0 and mod(ord(i),ncol) ne 1)=1);</p>
<p>binary variable<br />
y(V)<br />
x(i,j)<br />
delta(v);</p>
<p>positive variable<br />
u(V);</p>
<p>variable<br />
obj;</p>
<p>equations<br />
connections(i)<br />
connections2(j)<br />
loop_size<br />
mtz(i,j)<br />
assign1(V)<br />
assign2(V)<br />
objective<br />
assign3;</p>
<p>objective.. sum(v,p(v)*y(v)) =e= obj;</p>
<p>loop_size.. sum(V,y(V)) =e= steps;</p>
<p>connections(i).. sum(j\$arc(i,j),x(i,j)) =e= y(i);</p>
<p>connections2(j).. sum(i\$arc(i,j),x(i,j)) =e= y(j);</p>
<p>assign1(V).. u(V)-delta(V) =g= 0;</p>
<p>assign2(V).. u(V) +(steps-1)*delta(V) =l= steps;</p>
<p>assign3.. sum(V,delta(V)) =e= 1;</p>
<p>mtz(i,j)$(ord(i) ne ord(j)).. u(i)-u(j) + steps*(x(i,j)-delta(j)) =l= steps-1;</p>
<p>model project /all/;<br />
solve project using mip max obj;</p>
<p><a href="#top">Back to the top</a></p>
<h2><a name="references" id="references">References</a></h2>
<ul><li>Balas, E., The prize collecting traveling salesman problem. Carngie Mellon University, Pittsburg, Pennsylvania. <a href="http://onlinelibrary.wiley.com/doi/10.1002/net.3230190602/pdf">http://onlinelibrary.wiley.com/doi/10.1002/net.3230190602/pdf</a> </li>
<li>Linderoth, J. Tools and Environment in Optimization (ISyE/CS 635). University of Wisconsin - Madison. May 2011. </li>
<li>Operations research, Sudoko, Rogo, and Puzzles. Retrieved from Michael Trick’s Operations Research Blog, <a href="http://mat.tepper.cmu.edu/blog/?p=1302">http://mat.tepper.cmu.edu/blog/?p=1302</a></li>
<li>Petty, N. & Dye, S. (2010). Determining degree of difficulty in Rogo, a TSP-based paper puzzle. Proceedings of the 45th Annual Conference of the ORSNZ, November 2010.</li>
<li>Rogo – the New Puzzle Game (2011), by Creative Heuristics Ltd. Retrieved from <a href="http://www.rogopuzzle.co.nz/">http://www.rogopuzzle.co.nz/</a></li>
</ul><p>Original contribution by Jackie Lamb and Nanjing Jian, May 2011.</p>
</div></div></div><section class="field field-name-field-method field-type-taxonomy-term-reference field-label-above view-mode-rss"><h2 class="field-label">Optimization Category (Linear Programing, Integer, MIP and etc.): </h2><ul class="field-items"><li class="field-item even"><a href="/taxonomy/term/5" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Combinatorial Optimization</a></li><li class="field-item odd"><a href="/taxonomy/term/16" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">Traveling Salesman Problem</a></li></ul></section>Tue, 10 Apr 2012 01:28:47 +0000cmelan33 at https://neos-guide.orghttps://neos-guide.org/content/rogo-puzzle#comments