Skip to content

Commit 6000c20

Browse files
committed
Refined TSP examples (TSP, luggage, milk) + portfolio optimization
1 parent a77bcc6 commit 6000c20

File tree

8 files changed

+463
-444
lines changed

8 files changed

+463
-444
lines changed

lost_luggage_distribution/lost_luggage_distribution.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@
7474
"y_{i,k} \\leq z_{k} \\quad \\forall i \\in L \\setminus \\{0\\}, \\; k \\in V\n",
7575
"\\end{equation}\n",
7676
"\n",
77-
"**Travel time**: No van travels for more than 120 min. Observe that the travel time to return to the depot is not considered.\n",
77+
"**Travel time**: No van travels for more than 120 min. Note that we do not consider the travel time to return to the depot.\n",
7878
"\n",
7979
"\\begin{equation}\n",
80-
"\\sum_{i \\in L} \\sum_{j \\in L \\setminus \\{0\\}} t_{i,j}*x_{i,j,k} \\leq 120 \\quad \\forall k \\in V\n",
80+
"\\sum_{i \\in L} \\sum_{j \\in L \\setminus \\{0\\}} t_{i,j} \\cdot x_{i,j,k} \\leq 120 \\quad \\forall k \\in V\n",
8181
"\\end{equation}\n",
8282
"\n",
8383
"**Visit all customers**: Each customer location is visited by exactly one van.\n",
@@ -382,7 +382,7 @@
382382
"metadata": {},
383383
"source": [
384384
"### Callback Definition\n",
385-
"The following function determines lazy constraints to eliminate sub-tours."
385+
"Subtour constraints prevent a van from visiting a set of destinations without starting or ending at the Heathrow depot. Because there are an exponential number of these constraints, we don't want to add them all to the model. Instead, we use a callback function to find violated subtour constraints and add them to the model as lazy constraints."
386386
]
387387
},
388388
{

lost_luggage_distribution/lost_luggage_distribution_gcl.ipynb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
"This modeling example is at the advanced level, where we assume that you know Python and the Gurobi Python API and that you have advanced knowledge of building mathematical optimization models. Typically, the objective function and/or constraints of these examples are complex or require advanced features of the Gurobi Python API.\n",
1616
"\n",
1717
"**Download the Repository** <br /> \n",
18-
"You can download the repository containing this and other examples by clicking [here](https://github.com/Gurobi/modeling-examples/archive/master.zip). \n",
19-
"\n",
20-
"**Gurobi License** <br /> \n",
21-
"In order to run this Jupyter Notebook properly, you must have a Gurobi license. If you do not have one, you can request an [evaluation license](https://www.gurobi.com/downloads/request-an-evaluation-license/?utm_source=3PW&utm_medium=OT&utm_campaign=WW-MU-MUI-OR-O_LEA-PR_NO-Q3_FY20_WW_JPME_Lost_Luggage_Distribution_COM_EVAL_GitHub&utm_term=Lost%20Luggage%20Distribution&utm_content=C_JPM) as a *commercial user*, or download a [free license](https://www.gurobi.com/academia/academic-program-and-licenses/?utm_source=3PW&utm_medium=OT&utm_campaign=WW-MU-EDU-OR-O_LEA-PR_NO-Q3_FY20_WW_JPME_Lost_Luggage_Distribution_COM_EVAL_GitHub&utm_term=Lost%20Luggage%20Distribution&utm_content=C_JPM) as an *academic user*."
18+
"You can download the repository containing this and other examples by clicking [here](https://github.com/Gurobi/modeling-examples/archive/master.zip)."
2219
]
2320
},
2421
{
@@ -74,10 +71,10 @@
7471
"y_{i,k} \\leq z_{k} \\quad \\forall i \\in L \\setminus \\{0\\}, \\; k \\in V\n",
7572
"\\end{equation}\n",
7673
"\n",
77-
"**Travel time**: No van travels for more than 120 min. Observe that the travel time to return to the depot is not considered.\n",
74+
"**Travel time**: No van travels for more than 120 min. Note that we do not consider the travel time to return to the depot.\n",
7875
"\n",
7976
"\\begin{equation}\n",
80-
"\\sum_{i \\in L} \\sum_{j \\in L \\setminus \\{0\\}} t_{i,j}*x_{i,j,k} \\leq 120 \\quad \\forall k \\in V\n",
77+
"\\sum_{i \\in L} \\sum_{j \\in L \\setminus \\{0\\}} t_{i,j} \\cdot x_{i,j,k} \\leq 120 \\quad \\forall k \\in V\n",
8178
"\\end{equation}\n",
8279
"\n",
8380
"**Visit all customers**: Each customer location is visited by exactly one van.\n",
@@ -391,7 +388,7 @@
391388
"metadata": {},
392389
"source": [
393390
"### Callback Definition\n",
394-
"The following function determines lazy constraints to eliminate sub-tours."
391+
"Subtour constraints prevent a van from visiting a set of destinations without starting or ending at the Heathrow depot. Because there are an exponential number of these constraints, we don't want to add them all to the model. Instead, we use a callback function to find violated subtour constraints and add them to the model as lazy constraints:"
395392
]
396393
},
397394
{

0 commit comments

Comments
 (0)