Files
neuroevolution/mathema/car_racing_main.py
2026-02-21 10:58:05 +01:00

37 lines
856 B
Python

import asyncio
from dotenv import load_dotenv
from mathema.core.population_monitor import init_population
from mathema.utils.logging_config import setup_logging
setup_logging()
import logging
log = logging.getLogger(__name__)
async def run_car_test(
pop_id: str = "car_pop_transaction_test23",
gens: int = 200
):
monitor = await init_population((
pop_id,
[{"morphology": "car_racing_features", "neural_afs": ["tanh"]}],
"gt",
"competition"
))
for _ in range(gens):
await monitor.gen_ended.wait()
s = monitor.state
best = await monitor._best_fitness_in_population(s.population_id)
log.info(f"[car] gen={s.pop_gen} best_fitness={best:.6f} eval_acc={s.eval_acc}")
await monitor.stop("normal")
if __name__ == "__main__":
asyncio.run(run_car_test())