def floor_is_lava(robot_manager, robot, cost=False): _displacement_velocity_hill = displacement_velocity_hill( robot_manager, robot, cost) _contacts = measures.contacts(robot_manager, robot) _contacts = max(_contacts, 0.0001) if _displacement_velocity_hill >= 0: fitness = _displacement_velocity_hill / _contacts else: fitness = _displacement_velocity_hill * _contacts return fitness
def fitness_function(robot_manager, robot): contacts = measures.contacts(robot_manager, robot) assert(contacts != 0) return fitness.displacement_velocity_hill(robot_manager, robot)
def fitness_function_lava(robot_manager, robot): contacts = measures.contacts(robot_manager, robot) assert (contacts != 0) return fitness.floor_is_lava(robot_manager, robot, False)