Skip to content

Commit

Permalink
Update dinner-seat-allocation.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrozocca committed Oct 20, 2023
1 parent 12d8cc3 commit 8a55ce7
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions notebooks/04/dinner-seat-allocation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,14 @@
"To illustrate this, we first visualize the seating problem using a graph where:\n",
"* the nodes on the left-hand side stand for the families and the numbers next to them provide the family size;\n",
"* the nodes on the left-hand side stand for the tables and the numbers next to them provide the table size;\n",
"* each left-to-right arrow stand comes with a number denoting the capacity of arc $(f, t)$ -- how many people of family $f$ can be assigned to table $t$.\n",
"\n",
"<img src=\"seating_model_basic.png\" width=\"800\" height=\"600\">"
"* each left-to-right arrow stand comes with a number denoting the capacity of arc $(f, t)$ -- how many people of family $f$ can be assigned to table $t$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](seating_model_basic.png)"
]
},
{
Expand Down Expand Up @@ -1088,9 +1093,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"By adding two more nodes to the graph above, we can formulate the problem as a slightly different flow problem where all the data is formulated as the arc capacity, see figure below. In a network like this, we can imagine a problem of sending resources from the _root node_ \"door\" to the _sink node_ \"seat\", subject to the restriction that for any node that is not the start nor the target, the sum of incoming and outgoing flows are equal (_balance constraint_). If there exists a flow in this new graph that respects the arc capacities and the sum of outgoing flows at the source is equal to the total number of individuals, that is $\\sum_{f \\in F} m_f = 39$, it means that there exists a family-to-table assignment that meets our requirements.\n",
"\n",
"<img src=\"seating_flow_model.png\" width=\"800\" height=\"600\">"
"By adding two more nodes to the graph above, we can formulate the problem as a slightly different flow problem where all the data is formulated as the arc capacity, see figure below. In a network like this, we can imagine a problem of sending resources from the _source node_ \"door\" to the _target node_ \"seat\", subject to the restriction that for any node that is neither the source nor the target, the sum of incoming and outgoing flows are equal (_balance constraint_). If there exists a flow in this new graph that respects the arc capacities and the sum of outgoing flows at the source is equal to the total number of individuals, that is $\\sum_{f \\in F} m_f$, it means that there exists a family-to-table assignment that meets our requirements."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](seating_flow_model.png)"
]
},
{
Expand Down Expand Up @@ -1234,7 +1244,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Even for this very small example, we see that network algorithms generate a solution significantly faster than using the MILO formulation above."
"Even for this very small example, we see that network algorithms generate a solution significantly faster than using the MILO formulation above. Realizing that the optimization problem we are tackling is a particular problem class for which a tailored algorithm is available can result in solving times orders of magnitude faster, particularly for large instances."
]
},
{
Expand Down Expand Up @@ -1377,13 +1387,6 @@
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 8a55ce7

Please sign in to comment.