From 8a55ce784328f7161482dc385d81bf44543bd58f Mon Sep 17 00:00:00 2001 From: Alessandro Zocca Date: Fri, 20 Oct 2023 14:00:22 +0200 Subject: [PATCH] Update dinner-seat-allocation.ipynb --- notebooks/04/dinner-seat-allocation.ipynb | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/notebooks/04/dinner-seat-allocation.ipynb b/notebooks/04/dinner-seat-allocation.ipynb index ec7e5980..b9660104 100644 --- a/notebooks/04/dinner-seat-allocation.ipynb +++ b/notebooks/04/dinner-seat-allocation.ipynb @@ -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", - "" + "* 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)" ] }, { @@ -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", - "" + "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)" ] }, { @@ -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." ] }, { @@ -1377,13 +1387,6 @@ "plt.tight_layout()\n", "plt.show()" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {