Similar Items: Efficient Legged Robot Locomotion Through Optimized Gait Planning for Unstructured Planetary Terrain