Hierarchical control and learning of a foraging CyberOctopus