Angry brids

Angry Birds' birds

Three fundamental courses that an aspiring control engineer should take are Linear Systems, Nonlinear Systems and Optimal Control. I have been lucky enough to take Optimal Control with the inspiring Magnus Egerstedt. The idea of using Angry Birds to study and demonstrate the use of optimal control came, in fact, from one of his lectures.

Two canonical problems in optimal control are:

  • initial conditions optimization
  • switching time optimization

Given a dynamical system, the initial conditions optimization problem consists in finding the best initial conditions, i.e. those that minimize a desired cost. In switching time optimization, the objective is to minimize a cost functional by varying the switching times between a collection of given system dynamics.

The subject perfectly lends itself to being explained by and applied to the famous video game Angry Birds. The game consists in throwing birds with a sling with the goal of killing pigs that are present in the environment.

In the case of the bird “Red” (see figure above), the goal is to pick the optimal initial conditions, namely speed and direction of the throw, to kill the pigs. The bird “Chuck” has the ability of instantaneously increasing its speed, therefore the goal is that of picking the optimal time to switch to the accelerated mode.

The code to simulate these two problems and to play Angry Birds using MATLAB can be found here.