The Thompson sampling algorithm