Learning to adapt for intelligent robot behavior