Programming: Everyday Decision-Making Algorithms
Kühne Logistics University Hamburg - Winter 2024
Question: What comes to your mind when you think of randomness?
Question: What’s the opposite of randomness?
Question: How would you test if a pair of dice is fair?
Important
Even in computer science, randomness is not just about generating random numbers!
Question: Where do you encounter randomness in daily life?
correct-horse-battery-staple
is secureTr0ub4dor&3
is less secure despite looking complexNote
Randomness is everywhere around us!
Important
Sometimes a quick “good enough” solution is better than waiting for the perfect one.
Question: Difference between true and pseudo-randomness?
True Randomness
Pseudo-randomness
Question: How many possible combinations exist in a shuffled deck of cards?
80658175170943878571660636856403766975289505440883277824000000000000
Important
Computing and evaluating all possible combinations is not feasible!
Question: Anybody ever heard of “Monte Carlo methods”?
Question: How could we estimate π?
Question: How and in which order would you visit 10 cities by plane with minimal total distance?
3628800
Question: What could be a strategy?
Question: What could be the problem with this approach?
Important
Not feasible for real-world problems!
Question: How would you escape a local optimum?
Question: Why accept worse solutions sometimes?
What’s more important for a society?
Freedom
Equality
Question: Any problem with this question?
You might randomly be:
Question: If you didn’t know who you’d be born as, what kind of society would you design?
Important
But that’s not all! We also need to measure success and failure!
Question: What could be the problem with these measures?
Question: What is a selection bias?
Definition: Selection bias occurs when the sample data you’re analyzing isn’t truly representative of the population you’re trying to study.
Famous Example
During WWII, engineers studied returning planes to determine where to add armor. Initially, they focused on areas with most bullet holes. Abraham Wald pointed out they should instead armor the areas with no bullet holes - those were the critical areas where planes didn’t survive to return!
Question: How can randomness promote fairness?
Question: Which would you prefer?
Tip
Answer depends on your risk aversion!
Question: When should we embrace vs. reduce randomness?
Embrace When:
Reduce When:
Tip
Many real-world problems benefit from embracing uncertainty rather than fighting it!
Tip
Many problems benefit from fast, good-enough solutions rather than perfect ones.
Note
That’s it for today’s lecture!
We’ve covered the basics of randomness and its applications. In the upcoming tutorials, we’ll learn how to use LLMs to generate code with randomness.
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 V - Randomness | Dr. Tobias Vlćek | Home
Social Life