import asyncio import morphology from experiments.stochastic_hillclimber.actors.trainer import Trainer from genotype import construct, save_genotype def test_genotype_construction(): """ genotype_data = construct(morphology, hidden_layer_densities=[3, 2]) # Prüfen, ob Cortex, Sensor, Actuator und Neuronen existieren assert "cortex" in genotype_data assert len(genotype_data["neurons"]) == 3 + 2 + 1 # 3 in 1. HL, 2 in 2. HL, 1 Output print("Genotype construction OK") print("Cortex:", genotype_data["cortex"]) print("---------------------------------") print("Neurons:", genotype_data["neurons"]) print("---------------------------------") print("Actuators:", genotype_data["actuator"]) save_genotype("test.json", genotype_data) """ trainer = Trainer( morphology_spec=morphology, # <— wichtig! callable oder "xor_mimic" hidden_layer_densities=[2], # wie im Buchbeispiel max_attempts=float("inf"), # MA=inf eval_limit=float("inf"), # EL=inf fitness_target=99.9, # FT=99.9 experimental_file="experimental.json", best_file="best.json", exoself_steps_per_eval=0, # 0 = Scape/Cortex entscheiden über Halt ) asyncio.run(trainer.go()) test_genotype_construction()