Changeset 1291
- Timestamp:
- 01/15/24 05:46:02 (10 months ago)
- Location:
- framspy/evolalg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/evolalg/base/experiment_islands_model_abc.py
r1190 r1291 28 28 sorted_individuals = sorted( 29 29 pool_of_all_individuals, key=lambda x: x.rawfitness) 30 print( f"Best indiviudal for new islands:")30 print("Best individual for new islands:") 31 31 for i in range(self.number_of_populations): 32 32 shift = i*self.popsize -
framspy/evolalg/frams_base/experiment_frams.py
r1190 r1291 7 7 8 8 class ExperimentFrams(ExperimentABC): 9 def __init__(self, hof_size, popsize, frams_lib, optimization_criteria, genformat, save_only_best =True, constraints={}) -> None:9 def __init__(self, hof_size, popsize, frams_lib, optimization_criteria, genformat, save_only_best, constraints={}) -> None: 10 10 ExperimentABC.__init__(self, hof_size=hof_size, popsize=popsize, save_only_best=save_only_best) 11 11 self.optimization_criteria = optimization_criteria -
framspy/evolalg/tests/test_diferent_settings.py
r1205 r1291 1 1 import argparse 2 2 import sys 3 import numpy as np 3 4 4 5 from FramsticksLib import FramsticksLib … … 9 10 from ..numerical_example.numerical_islands_example import ExperimentNumericalIslands 10 11 11 12 12 from ..utils import ensureDir 13 13 14 15 GENERATIONS = 10 16 14 17 SETTINGS_TO_TEST_NUMERIC = { 15 18 'hof_size': [0, 10], … … 19 22 'pxov': [0.2], 20 23 'tournament': [5], 21 'initialgenotype':[ [100, 100, 100, 100], [-100,-100]]24 'initialgenotype':[np.array([100, 100, 100, 100]), [-100,-100]] 22 25 } 23 26 … … 31 34 'migration_interval': [1,5], 32 35 'number_of_populations':[1,5], 33 'initialgenotype':[ [100, 100, 100, 100], [-100,-100]]36 'initialgenotype':[np.array([100, 100, 100, 100]), [-100,-100]] 34 37 } 35 38 … … 81 84 82 85 experiment.evolve(hof_savefile=None, 83 generations= 2,86 generations=GENERATIONS, 84 87 initialgenotype=params['initialgenotype'], 85 88 pmut=params['pmut'], … … 99 102 100 103 experiment.evolve(hof_savefile=None, 101 generations= 2,104 generations=GENERATIONS, 102 105 initialgenotype=params['initialgenotype'], 103 106 pmut=params['pmut'], … … 117 120 } 118 121 119 print('Best individuals:')120 122 experiment = ExperimentFramsNiching(frams_lib=framsLib, 121 123 optimization_criteria=opt_criteria, … … 128 130 popsize=params['popsize'], 129 131 archive_size=params['archive'], 130 save_only_best=True) 131 132 experiment.evolve(hof_savefile=None, 133 generations=2, 132 save_only_best=True, 133 knn_niching=5, 134 knn_nslc=5) 135 136 experiment.evolve(hof_savefile=None, 137 generations=GENERATIONS, 134 138 initialgenotype=params['initialgenotype'], 135 139 pmut=params['pmut'], … … 149 153 } 150 154 151 print('Best individuals:')152 155 experiment = ExperimentFramsIslands(frams_lib=framsLib, 153 156 optimization_criteria=opt_criteria, … … 161 164 162 165 experiment.evolve(hof_savefile=None, 163 generations= 2,166 generations=GENERATIONS, 164 167 initialgenotype=params['initialgenotype'], 165 168 pmut=params['pmut'], … … 201 204 run_exp(params) 202 205 return [1, None] 203 except Exception as e :204 return [0, f"Experiment {run_exp.__name__} with params: {params} failied with the stack:{e}"]206 except Exception as ex: 207 return [0, f"Experiment {run_exp.__name__} with params: {params} failed with the stack: {ex}"] 205 208 206 209
Note: See TracChangeset
for help on using the changeset viewer.