Motion Planning with Complex Tasks