37 lines
837 B
Python
37 lines
837 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",
|
|
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())
|
|
|