mirror of
https://github.com/fverdugo/XM_40017.git
synced 2026-11-15 01:47:17 +01:00
1 file changed
+17
-2
+17
-2
@@ -72,7 +72,7 @@
|
||||
"## The traveling sales person (TSP) problem\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"In this notebook, we will study another algorithm that works with graphs, the [traveling sales person (TSP) problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem). The classical formulation of this problem is as follows (quoted from Wikipedia) \"Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once?\" This problem has applications in combinatorial optimization, theoretical computer science, and operations research. It is very expensive problem to solve (NP-hard problem), which makes parallel computing often required to solve it.\n",
|
||||
"In this notebook, we will study another algorithm that works with graphs, the [traveling sales person (TSP) problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem). The classical formulation of this problem is as follows (quoted from Wikipedia) \"Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once?\" This problem has applications in combinatorial optimization, theoretical computer science, and operations research. It is a very expensive problem to solve (NP-hard problem), which makes parallel computing often required.\n",
|
||||
"\n",
|
||||
"<div class=\"alert alert-block alert-info\">\n",
|
||||
"<b>Note:</b> There are two key variations of this problem. One in which the sales person returns to the initial city, and another in which the sales person does not return to the initial city. We will consider the second variant for simplicity.\n",
|
||||
@@ -265,7 +265,22 @@
|
||||
"id": "f769627c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" This returns a vector of tuples that contains information about the connections to this city of the form (destination, distance). In this case, city 3 is connected to city 3 at distance 0 (itself), then with city 1 at distance 3, then with city 4 at distance 3, and finally with city 2 at distance 4. Note that the connections are sorted by their distance in ascending order (here is where the nearest city first heuristic is used). "
|
||||
" This returns a vector of tuples that contains information about the connections to this city of the form (destination, distance). In this case, city 3 is connected to city 3 at distance 0 (itself), then with city 1 at distance 3, then with city 4 at distance 3, and finally with city 2 at distance 4. Note that the connections are sorted by their distance in ascending order (here is where the nearest city first heuristic is used). Remember the graph with the distance between cities:"
|
||||
]
|
||||
},
|
||||
{
|
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+hD86GvSxT8biNsLP3+Y+htcJvGrkokwB3rBf5d4BaMXVWLvkc48H+KteKpo24JfWge/CUYEdVtAO7NxDE0HdwWsasSCXBHe4F/D7iFYlfVoqMJB/6Z1DfwobtCHyz4/4/SBb9bl4Hz484Et328ekQacl/3Av9hcIvHrqpF36Q7Ax+6L/ShefBHmPTGrRMI/LrMNyH14g71Av8RcEvErqpFXycc+Gdj3frrrhtDH5rPZ1xg8Lu1wL2aOIZmgdupuO2LDJn7ihf4j9HyTEDRfY1w4J9DdwQ+dG/oQ/PgL2BeY7cKuBcTx1AvuL3z364k1f2rfEbcDsClDPx7/Q54toWVPAM9p2VaVmu+SrjN/XnAZ7ADvxvsDVyQePweMCpSLTH039z1w9Zh1/hPzW/T7kFg1cQTzwK3tbiSH0HPHdnVJBLkDvHO8ttZbo34Br5C+Az/PLrnDL9fN5/p9xuOffCFzvhznPfBPZPBcbRzfvV1h2474LvRVwi3ub+Q7jrDl7lmA/sDf/ae7x9Ou6oT/sgQjIhdQEU8gLVs6cSTWRTSoi8R7lX7e2A/7OCX7vQesBe2LyTPnvuDH2zGtCx9C+i0t/rdWRQiUkefxc7i/a/wv6e7P+x1eWegkdgZf+hSz8ER6xKRFvRftvEP5D/Q3YEPCv0QBb9IhR2IXbbxD+CLUeCDQr+RUcAlhIO/ahMBiXSNLine truncated
|
||||
}
|
||||
},
|
||||
"cell_type": "markdown",
|
||||
"id": "6758ba5d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div>\n",
|
||||
"<img src=\"attachment:g27477.png\" align=\"left\" width=\"125\"/>\n",
|
||||
"</div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user