Programming Groups of Rational Agents