Programming: Everyday Decision-Making Algorithms
Kühne Logistics University Hamburg - Winter 2024
Tip
We really appreciate active participation and interaction!
Tip
No worries, we will help you out if you have any questions!
Tip
This is just in order to provide you with working solutions after each deadline.
We will mostly not cover Python during the lectures!
Question: Anybody know why?
Tip
Don’t worry, we will help you out if you have any questions!
Tip
We are convinced that this course will be quite interesting and teach you more for your daily life than most other courses!
Warning
But you should not simply use them to replace your learning.
Tip
Great resources to start are books and small challenges. You can find a list of book recommendations at the end of the lecture. Small challenges to solve can for example be found on Codewars.
Tip
IDE = Integrated Development Environment
Tip
If the installation does not work, let us know!
Tip
Unsure on how to work with VS Code and notebooks? Take a look at the tutorial from VS Code and/or ask us! We are happy to help you out!
Caution
Not all packages available in Python are available here, thus you might need a computer to solve certain problems. For our course, this should not be a problem.
Task: Create a directory for the course and create a new file called hello_world.py
with the following code:
Hello, World!
Run it with the green ‘run’ button or by pressing F5!
Note
“Hello world” is a classic example to start with. Often used as a test to check if your computer is working properly and that you have installed the necessary software.
Any questions
so far?
Question: Anybody know what optimal stopping is?
Anybody an
example of
optimal stopping?
Photo by Aditya Ghosh on Unsplash
Photo by Scott Graham on Unsplash
Photo by Shelby Deeter on Unsplash
Photo by Joseph Pearson on Unsplash
Note
The name is a bit misleading, as the problem is not about hiring a secretary, but about finding the best candidate. It comes from the 1960s and thus a little outdated.
n
candidatesQuestion: Anybody know what ordinal ranking is?
Question: Anybody an idea how we can fail?
Ideas?
The optimal strategy is to:
Question: Anybody see a pattern?
n/e
1e
is the base of the natural logarithm (≈ 2.718)Percentage of options to look at: 0.368%
Look at first 7.358 candidates
Note
No worries if you don’t understand the code! We are essentialy just using the formula to calculate the percentage of candidates to look at.
Let’s visualize the success of a simulation with 20 candidates:
Question: Imagine a dating scenario, where the other person can also reject you. Optimal stopping point?
What if we don’t have a fixed number of candidates, but rather a fixed amount of time?
Question: How should we behave?
Note
Side note for drivers: An increase in occupancy from 90 to 95% doubles the search time for all drivers!
Question: Can you imagine a scenario where it would be unwise to use optimal stopping?
Questions?
Note
That’s it for todays lecture!
We now have covered a brief introduction into optimal stopping and seen how to set up Python. Now we can start with the tutorials!
Note
Think Python is a great book to start with. It’s available online for free. Schrödinger Programmiert Python is a great alternative for German students, as it is a very playful introduction to programming with lots of examples.
For more interesting literature, take a look at the literature list of this course.
Lecture I - Optimal Stopping | Dr. Tobias Vlćek | Home