Applied Optimization with Julia
University of Hamburg - Fall 2024
Please take a moment at the start of the lecture to fill out the lecture evaluation survey. Thanks!
Question: Have you ever heard of the Hajj?
Rhamy-Al-Jamarat ritual
Pilgrims throw pebbles against three pillars, which symbolize the temptations of the devil. They repeat this ritual with small variations on four consecutive days.
Question: What could become a problem?
Caution
Uncoordinated access within confined area can escalate into crowd disasters!
Question: What could we do to prevent this?
How is Hajj pedestrian
traffic different from the
regular urban pedestrian
traffic in cities?
Question: What is the most dangerous type here?
Caution
Multi-directional and intersecting flows are the most dangerous type!
General idea
Adhere to one-way flow systems and define path options for each camp under consideration of a unidirectional flow system.
Question: What could be the objective?
Question: How can we try to model this?
Question: Where is the goal conflict?
Each camp has a set of feasible one-way paths that include the stoning ritual.
Path may contain one or more bottlenecks, regarded as resources subject to a capacity.
Pilgrims departure from a camp at a time \(x\) and pass through the bottleneck later.
Our model should assign one of the feasible paths to a camp on all four ritual days.
These bottlenecks should not be overcrowded at any time during the Hajj.
How can we model
time preferences?
Group time preferences
May be computed, i.e., down-sampled given a distribution of pilgrims over time.
Question: What could become a problem?
Question: Any idea how we can do that later?
Question: What could be the sets here?
But we further need subsets!
That looks
complicated…
Question: Why use subsets?
Tip
A smaller problem size reduces the solution space and helps the solver in finding the optimal solution faster!
Question: What could be possible parameters?
Our first goal is to:
Satisfy time preferences of the pilgrims as much as possible under the consideration of infrastructure bottleneck flow capacities by assigning “something” to a time slot.
We need the following sets:
Question: What could be our decision variable?
Question: Do you get the idea here?
It’s a binary assignment of a group to a time slot and a path.
Our second goal (more a constraint):
For the sake of simplicity and safety, pilgrims coming from one camp will always have to be assigned the same path.
We need the following sets:
Question: What could be our second variable?
Question: Does anyone remember the third part?
Our third goal (again, more a constraint):
We need to keep track of the relative utilization of each resource to restrict the fluctuations between periods to ensure a safer event.
We need the following sets:
Question: What could be our third variable?
Question: What does relative utilization mean?
Let’s start with our
objective function!
Our main objective is to:
Satisfy time preferences of the pilgrims as much as possible under the consideration of infrastructure bottleneck flow capacities by assigning “something” to a time slot. Hint: We thus could aim to minimize the total dissatisfaction with the timetable.
Question: How could we minimize the total dissatisfaction?
We need the following parameters and variables:
Question: What could be our objective function?
\[ \text{minimize} \quad \sum_{s \in \mathcal{S}}\sum_{t \in \mathcal{T}}\sum_{p \in \mathcal{P}} f_{s,t} \times X_{s,t,p} \]
Question: Is our objective function linear?
Question: Anybody an idea why?
Question: Which constraints do we need?
The goal of this constraint is to:
Assign one path to each camp over the entire time horizon.
We need the following variables:
Question: What could be the constraint?
\[ \sum_{p \in \mathcal{P}_c} Y_{c,p} = 1 \quad \forall c \in \mathcal{C} \]
The goal of this constraint is to:
Assign one time slot to each group over the entire time horizon using the same path we have assigned to the camp in the previous constraint.
We need the following variables:
Question: What could be the constraint?
\[ \sum_{t \in \mathcal{T}_s} X_{s,t,p} = Y_{c,p} \quad \forall c \in \mathcal{C}, p \in \mathcal{P}_c, s \in \mathcal{S}_c \]
We use the following sets:
The goal of this constraint is to:
Compute the relative utilization of each resource while also ensuring that the utilization does not exceed the capacity limit. This one is very tricky!
Difficulties:
We need the following:
Question: What could be the constraint?
\[ \sum_{p \in \mathcal{P}_r}\sum_{s \in S_p} n_s \times X_{s,t-a_{p,r},p} = b_{r,t}\times U_{r,t} \quad \forall r \in \mathcal{R}, t \in \mathcal{T} \]
We use the following:
Let’s pause!
Have you understood
this part?
The goal of this constraint is to:
Keep the relative utilization of each resource within bounds to ensure a safer event.
We need the following:
Question: What could be the constraint?
\[ U_{r,t} - U_{r,t-1} \leq \sigma_r \quad \forall (r,t) \in \left| \mathcal{R}\times \mathcal{T}\right| \]
\[ U_{r,t-1} - U_{r,t} \leq \sigma_r \quad \forall (r,t) \in \left| \mathcal{R}\times \mathcal{T}\right| \]
Question: Can somebody explain why this works?
\[\begin{align*} \text{min} \quad \sum_{s\in \mathcal{S}}\sum_{t \in \mathcal{T}_s}\sum_{p \in P_s} f_{s,t} \times X_{s,t,p} \end{align*}\]
subject to:
\[\begin{align*} & \sum_{p \in \mathcal{P}_c} Y_{c,p} = 1 && \forall c \in \mathcal{C} \\ & \sum_{t \in \mathcal{T}_s} X_{s,t,p} = Y_{c,p} && \forall c \in \mathcal{C}, p \in \mathcal{P}_c, s \in \mathcal{S}_c \end{align*}\]
\[\begin{align*} & \sum_{p \in \mathcal{P}_r}\sum_{s \in S_p} n_s \cdot X_{s,t-a_{p,r},p} = b_{r,t}\cdot U_{r,t} && \forall r \in \mathcal{R}, t \in \mathcal{T} \\ & U_{r,t} - U_{r,t-1} \leq \sigma_r && \forall (r,t) \in \left| \mathcal{R}\times \mathcal{T}\right| \\ & U_{r,t-1} - U_{r,t} \leq \sigma_r && \forall (r,t) \in \left| \mathcal{R}\times \mathcal{T}\right| \end{align*}\]
Note
Restricting the relative utilization of each resource to a certain bound.
\[\begin{align*} & X_{s,t,p} \in \{0,1\} && \forall s \in \mathcal{S}, \forall t \in \mathcal{T}_s, \forall p \in \mathcal{P}_s \\ & Y_{c,p} \in \{0,1\} && \forall c \in \mathcal{C}, p \in \mathcal{P}_c \\ & U_{r,t} \in [0,1] && \forall r \in \mathcal{R}, t \in \mathcal{T} \end{align*}\]
Note
All variables, except for \(U_{r,t}\), are binary.
Questions: On model characteristics
Questions: On model assumptions
Can this be
applied?
Note
Optimization was part of a project by Knut Haase and his team (Haase et al. 2016).
And that’s it for todays lecture!
We now have covered a scheduling problem based on a real-world application and are ready to start solving some new tasks in the upcoming tutorial.
Questions?
For more interesting literature to learn more about Julia, take a look at the literature list of this course.
Lecture IX - Safety Planning for the Islamic Pilgrimage | Dr. Tobias Vlćek | Home