What has Disney’s Frozen in common with computer science?
Here are some songs from the Frozen movies you didn’t notice are struggling with fundamental artificial intelligence and computer science problems. In them, the protagonists have to confront the same algorithmic trade-offs as reinforcement learning agents, optimization algorithms and, surprisingly, any real human, too.
1. Into the Unknown
The first song - “Into the Unknown” - shows the internal struggle of optimizing the exploration-exploitation trade-off:
Elsa is in a position where “exploitation” is a robust choice. She is in a great castle with her loved ones. Exploitation means taking the decision that given the current information is best. Exploitation protects both from the losses of bad decisions but also doesn’t allow to discover even better options.
“Everyone I've ever loved is here within these walls
I'm afraid of what I'm risking if I follow you
Into the unknown”
But Elsa can’t stop the voice that calls her for adventure! She wonders whether she should choose “exploration”. Instead of doing what currently seems best, more information could identify an even better option. Exploration is risky, one can lose the good one has. Elsa explicitly wonders about what she could lose, but can’t shake the feeling that there is something bigger waiting for her.
In the Lyrics Elsa sings to the voice calling her for adventure:
“Are you here to distract me
So I make a big mistake?
Or are you someone out there
Who's a little bit like me?
Who knows deep down
I'm not where I'm meant to be?
Every day's a little harder
As I feel my power grow
Don't you know there's part of me
That longs to go
Into the unknown!”
Should you have watched the movies, you understood all of this implicitly. This shows how relevant these questions of computer science are to real life.
2. The Next right thing
The Frozen 2 song “The Next Right Thing” shows the problem of computational complexity and solves it with a greedy algorithm. Okay okay, bear with me…step by step!
“I won't look too far ahead
It's too much for me to take”
She can’t figure out what the best thing to do is. Thinking it all through and acting on it is simply too much. Similarly, the cost of calculating through a whole problem space to find the best solution is very costly for an algorithm. This is the problem of “computational complexity”. So instead of brute-forcing an optimal solution, simpler heuristics are used. They are less costly and still find relatively good solutions:
“break it down to this next breath, this next step
This next choice is one that I can make
So I'll walk through this night
Stumbling blindly toward the light
And do the next right thing”
This is clearly a greedy algorithm. Anna is making the best choice at each stage instead of trying to figure out where she ultimately should be going. Greedy algorithms are myopic algorithms, intentionally short-sighted. Given that Anna was emotionally overwhelmed and not in a position for long-term thinking, making progress towards a local optimum was a reasonable strategy.
Should you want to learn more, in their book "Algorithms To Live By" Brian Christian and Tom Griffith write about these and other algorithms and their implications for the human condition. You can for example find the exploration-exploitation trade-off, as also struggled with by Elsa in "Into the Unknown", in Chapter 2!