Minimum performance delta
This commit is contained in:
@@ -56,6 +56,7 @@ class AiHttpGameHandler(GameHandler):
|
|||||||
MAP_PASS_MIN_SCORE = 20 # Minimum score to consider a map passed. Only used if PLAY_ALL_MAPS_PER_GENERATION is False. If True, all maps are played in a generation.
|
MAP_PASS_MIN_SCORE = 20 # Minimum score to consider a map passed. Only used if PLAY_ALL_MAPS_PER_GENERATION is False. If True, all maps are played in a generation.
|
||||||
MAP_DIFFICULTY_VARIANCE = 5 # Lower value will make the map selection more variable, higher value will make the map selection more consistent with the current performance. Only used if PLAY_ALL_MAPS_PER_GENERATION is False. A value too high may produce no evolving behavior
|
MAP_DIFFICULTY_VARIANCE = 5 # Lower value will make the map selection more variable, higher value will make the map selection more consistent with the current performance. Only used if PLAY_ALL_MAPS_PER_GENERATION is False. A value too high may produce no evolving behavior
|
||||||
CONSISTENCY_PENALTY_WEIGHT = 0.4 # Penalty for inconsistent map scores
|
CONSISTENCY_PENALTY_WEIGHT = 0.4 # Penalty for inconsistent map scores
|
||||||
|
MINIMUM_PERFORMANCE_DELTA = 0.05 # Minimum performance delta to add every generation. This ensures that the map will always change even if the ai is stuck in a local optimum. Only used if PLAY_ALL_MAPS_PER_GENERATION is False. A value too high may produce no evolving behavior
|
||||||
|
|
||||||
def __init__(self, host: str | None = None, port: int | None = None,
|
def __init__(self, host: str | None = None, port: int | None = None,
|
||||||
max_workers: int | None = None):
|
max_workers: int | None = None):
|
||||||
@@ -268,7 +269,7 @@ class AiHttpGameHandler(GameHandler):
|
|||||||
top_90_scores = sorted_scores[:top_90_count]
|
top_90_scores = sorted_scores[:top_90_count]
|
||||||
avg_top_90_score = sum(top_90_scores) / len(top_90_scores)
|
avg_top_90_score = sum(top_90_scores) / len(top_90_scores)
|
||||||
performance_delta = (avg_top_90_score - self.MAP_PASS_MIN_SCORE) / self.MAP_DIFFICULTY_VARIANCE
|
performance_delta = (avg_top_90_score - self.MAP_PASS_MIN_SCORE) / self.MAP_DIFFICULTY_VARIANCE
|
||||||
performance_delta = max(0.05, performance_delta)
|
performance_delta = max(self.MINIMUM_PERFORMANCE_DELTA, performance_delta)
|
||||||
session["performance"] = max(0.0, session.get("performance", 0.0) + performance_delta)
|
session["performance"] = max(0.0, session.get("performance", 0.0) + performance_delta)
|
||||||
# print(f"Generation {session['generation']} completed on difficulty {map_difficulty}. Best score: {best_score:.2f}. Updated performance: {session['performance']:.2f}", flush=True)
|
# print(f"Generation {session['generation']} completed on difficulty {map_difficulty}. Best score: {best_score:.2f}. Updated performance: {session['performance']:.2f}", flush=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user