Robotic tool use and problem solving based on probabilistic planning and learned affordances