return True if not os.path.isfile("./" + RUN_DIR + "/pickledPops/Gen_0.pickle"): random.seed(SEED) np.random.seed(SEED) my_sim = Sim(dt_frac=DT_FRAC, simulation_time=SIM_TIME, fitness_eval_init_time=INIT_TIME) my_env = Env(temp_amp=TEMP_AMP, fluid_environment=FLUID_ENV, aggregate_drag_coefficient=AGGREGATE_DRAG_COEF, lattice_dimension=VOXEL_SIZE, grav_acc=GRAV_ACC, frequency=FREQ, muscle_stiffness=STIFFNESS, block_position=BLOCK_POS, block_material=BLOCK_MAT, external_block=True) my_objective_dict = ObjectiveDict() my_objective_dict.add_objective(name="fitness", maximize=True, tag=FITNESS_TAG, # meta_func=min_energy ) my_objective_dict.add_objective(name="age", maximize=False, tag=None) my_objective_dict.add_objective(name="n_muscle", maximize=False, tag=None, node_func=partial(count_occurrences, keys=[3]), output_node_name="material") # logging only: my_objective_dict.add_objective(name="n_vox", maximize=False, tag=None, logging_only=True, node_func=partial(count_occurrences, keys=[1, 3]), output_node_name="material") my_pop = Population(my_objective_dict, MyGenotype, MyPhenotype, pop_size=POP_SIZE)
# print np.sum(np.random.rand(*IND_SIZE)) # seed=1; 226.98967645847415 MyGenotype.NET_DICT = {"phase_offset": np.random.rand(*IND_SIZE)} my_sim = Sim(dt_frac=DT_FRAC, simulation_time=SIM_TIME, fitness_eval_init_time=INIT_TIME) my_env = Env(temp_amp=TEMP_AMP, fluid_environment=FLUID_ENV, aggregate_drag_coefficient=AGGREGATE_DRAG_COEF, lattice_dimension=VOXEL_SIZE, grav_acc=GRAV_ACC, frequency=FREQ, muscle_stiffness=STIFFNESS) my_objective_dict = ObjectiveDict() my_objective_dict.add_objective(name="fitness", maximize=True, tag="<normAbsoluteDisplacement>") my_objective_dict.add_objective(name="age", maximize=False, tag=None) my_pop = Population(my_objective_dict, MyGenotype, Phenotype, pop_size=POP_SIZE) my_optimization = ParetoOptimization(my_sim, my_env, my_pop) my_optimization.run(max_hours_runtime=MAX_TIME, max_gens=MAX_GENS, num_random_individuals=NUM_RANDOM_INDS, directory=RUN_DIR,
random.seed(SEED) np.random.seed(SEED) my_sim = Sim(dt_frac=DT_FRAC, simulation_time=SIM_TIME, fitness_eval_init_time=INIT_TIME) my_env = Env(temp_amp=TEMP_AMP, fluid_environment=FLUID_ENV, aggregate_drag_coefficient=AGGREGATE_DRAG_COEF, lattice_dimension=VOXEL_SIZE, grav_acc=GRAV_ACC, frequency=FREQ, muscle_stiffness=STIFFNESS) my_objective_dict = ObjectiveDict() my_objective_dict.add_objective(name="fitness", maximize=True, tag=FITNESS_TAG, meta_func=favor_appendages) my_objective_dict.add_objective(name="age", maximize=False, tag=None) my_pop = Population(my_objective_dict, MyGenotype, MyPhenotype, pop_size=POP_SIZE) my_optimization = ParetoOptimization(my_sim, my_env, my_pop) my_optimization.run(max_hours_runtime=MAX_TIME, max_gens=MAX_GENS, num_random_individuals=NUM_RANDOM_INDS,
my_sim = Sim(dt_frac=DT_FRAC, simulation_time=SIM_TIME, fitness_eval_init_time=INIT_TIME) my_env = Env( temp_amp=TEMP_AMP, frequency=FREQ, muscle_stiffness=STIFFNESS, fat_stiffness=STIFFNESS, # fluid_environment=FLUID_ENV, aggregate_drag_coefficient=AGGREGATE_DRAG_COEF, lattice_dimension=VOXEL_SIZE, grav_acc=GRAV_ACC, ) my_objective_dict = ObjectiveDict() my_objective_dict.add_objective(name="fitness", maximize=True, tag="<normAbsoluteDisplacement>") my_objective_dict.add_objective(name="age", maximize=False, tag=None) # logging only: my_objective_dict.add_objective(name="n_muscle", maximize=False, tag=None, logging_only=True, node_func=partial(count_occurrences, keys=[3]), output_node_name="material") # logging only: my_objective_dict.add_objective(name="n_vox",