Applied Optimization with Julia
Important
You can take a handwritten DIN A4 sheet of paper with you!
Before starting the exam:
A company that ships ice cream wants to maximize their profit. It can do that by transporting its different sorts of ice cream from their only production facility to several supermarkets.
Each delivered sort of ice cream makes the ice cream company a different profit per unit. The transportation costs per truckload are totally negligible as is the routing, as all supermarkets are located very close to each other. The company should maximally deliver the agreed number of units of each ice cream sort to each individual supermarket.
To do so, the company owns one truck which has a fixed total capacity for a number of units of ice cream. Note, that each unit of ice cream consumes a different amount of space in the truck! The required space for each unit of ice cream is given for each sort. The optimal number of units from each sort to ship to each supermarket should be computed by the model.
Define all sets, parameters and variables required to model the problem described above. Select a suitable notation of your choice. Make sure to explicitly state in your notation which elements are sets, parameters and variables.
Tip
Note that the problem does not have to be modeled yet!
Please define the objective function to model the described problem based on your defined notation.
Tip
If you need additional sets, parameters or variables that are not yet defined, please define them as well.
Please define all necessary constraints and the variable ranges to model the described problem based on your notation.
Tip
If you need additional sets, parameters or variables that are not yet defined, please define them as well.
Is the model formulation a linear problem with binary variables?
Please explain your answer briefly.
The supermarkets are furious because the company doesn’t always deliver the agreed truckloads of ice cream. Therefore, they want to penalize the company in the future, if it delivers less than the agreed amount. For each demand of a supermarket that could not be fulfilled, the company will have to pay a one-time fee for the ice-cream sort.
How can you expand your model to reflect this new situation? Write down all additional or modified sets, parameters, variables, constraints and the objective function while describing each with a few words.
Tip
Note, that you only need to write down new and modified elements!
Next to the production facility of the ice cream company sits a company that sells frozen fish. Due to declining fish stocks in the ocean, the company does not need all of its trucks. It offers to rent their trucks for a certain price to the ice cream company so it can transport more ice cream. These trucks have twice the capacity of the truck currently in use by the ice cream company.
How can you expand your model to reflect this new situation? Write down all additional or modified Sets, parameters, variables, constraints and the objective function while describing each with a few words.
Tip
Note, that you only need to write down new and modified elements! If you haven’t solved the previous task, work with the model defined before.
What is the goal of the Territory Design Problem (Districting Problem)?
Please answer in 2-3 sentences.
\(t_{mi}\) | A | B | C | D |
---|---|---|---|---|
1 | 0 | 0 | 1 | 1 |
2 | 1 | 0 | 1 | 0 |
3 | 1 | 0 | 0 | 1 |
4 | 1 | 0 | 1 | 1 |
5 | 1 | 1 | 0 | 1 |
6 | 1 | 1 | 0 | 1 |
Please compute the coappearance matrix that results from these transactions.
Briefly explain in 2-3 sentences what a global optimum in an optimization problem is.
Name three optimization problems, e.g. Knapsack Problem.
You are welcome to answer this question in bullet points.
Explain briefly in 2-3 sentences what so-called “Big-M” constraints can be used for in mathematical modeling.
Programming Tips
The following Julia code contains seven errors. Highlight the errors in the code and briefly describe what would need to be done to correct them.
Note
Assume that all variables containing data are loaded correctly, e.g. availablePanels and requestedPanels are already defined.
# Load the necessary packages
using JuMP
using HiGHS
# Define the size of the problem instance
nrSuppliers = length(availablePanels)
nrCustomers = length(requestedPanels)
# Create model instance
transport = Model(HiGHS.Optimizer)
# Define variable
@variable(transport_model, X[i = nrSuppliers,j = 1:nrCustomers], Bin)
# Define objective
@objective(transport_model, Max,
sum(travelCosts[i,j]* X[i] for i in 1:nrSuppliers, j in 1:nrCustomers)
)
# Define the constraints
@constraint(transport_model,
restrictAvailable[i=1:nrSuppliers],
sum(X[i,j] for j in 1:nrCustomers) <= available[i]
)
@constraint(transport_model,
restrictDemand[j=1:nrCustomers],
sum(X[i,j] for i in 1:nrSuppliers) === requested[j]
)
# Start optimization
start_optimization(transport_model)
In an optimization model, the following equations are given:
\[ \sum_{m\in \mathcal{M}} 7 * U_{gm} * T_m - \sum_{k \in \mathcal{K}} R_k \leq D_g \quad \forall g \in \mathcal{G} \]
Please define the equations in correct Julia syntax.
Note
Assume that all required sets, variables, and parameters have already been defined.
For an optimization model the following binary variable is supposed to be created:
\(X_{i,j}\) where \(i \in \{1,2,...,10\}\) and \(j \in \{1,2,...,5\}\).
Specify the definition of the variable in correct Julia syntax.
What is the difference between a linear and a nonlinear problem? Please describe the difference in a few sentences.
Remember
And that’s it for todays lecture!
We now have covered the structure of the exam and you have a better idea of what to expect from the exam. In our upcoming tuorial, we will go through some additional examples and practice tasks.
Questions?
For more interesting literature to learn more about Julia, take a look at the literature list of this course.
Lecture X - Intermission: Exam Preparation | Dr. Tobias Vlćek | Home