- Timestamp:
- 09/25/21 01:02:06 (3 years ago)
- Location:
- framspy
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksLib.py
r1119 r1149 24 24 25 25 GENOTYPE_INVALID = "/*invalid*/" # this is how genotype invalidity is represented in Framsticks 26 EVALUATION_SETTINGS_FILE = "eval-allcriteria.sim" # MUST be compatible with the standard-eval expdef 26 EVALUATION_SETTINGS_FILE = [ # all files MUST be compatible with the standard-eval expdef. The order they are loaded in is important! 27 "eval-allcriteria.sim", # a good trade-off in performance sampling period ("perfperiod") for vertpos and velocity 28 # "deterministic.sim", # turns off random noise (added for robustness) so that each evaluation yields identical performance values (causes "overfitting") 29 # "sample-period-2.sim", # short performance sampling period so performance (e.g. vertical position) is sampled more often 30 # "sample-period-longest.sim", # increased performance sampling period so distance and velocity are measured rectilinearly 31 ] 27 32 28 33 … … 35 40 # return frams 36 41 37 def __init__(self, frams_path, frams_lib_name, sim settings):42 def __init__(self, frams_path, frams_lib_name, sim_settings_files): 38 43 if frams_lib_name is None: 39 44 frams.init(frams_path) # could add support for setting alternative directories using -D and -d … … 54 59 frams.Math.randomize(); 55 60 frams.Simulator.expdef = "standard-eval" # this expdef (or fully compatible) must be used by EVALUATION_SETTINGS_FILE 56 if simsettings is not None: 57 self.EVALUATION_SETTINGS_FILE = simsettings 58 frams.Simulator.ximport(self.EVALUATION_SETTINGS_FILE, 4 + 8 + 16) 61 if sim_settings_files is not None: 62 self.EVALUATION_SETTINGS_FILE = sim_settings_files 63 print('Using settings:', self.EVALUATION_SETTINGS_FILE) 64 assert isinstance(self.EVALUATION_SETTINGS_FILE, list) # ensure settings file(s) are provided as a list 65 for simfile in self.EVALUATION_SETTINGS_FILE: 66 frams.Simulator.ximport(simfile, 4 + 8 + 16) 59 67 60 68 -
framspy/eval-allcriteria.sim
r1114 r1149 3 3 # Other important parameters are "Energy0" and "perfperiod". 4 4 # Put this file in the "data" subdirectory within the Framsticks distribution. 5 5 6 sim_params: 6 7 stop_on:2 … … 361 362 name:Genotypes 362 363 fitness:return 0.0+this.velocity*1.0; 364 fitness_step_limit:0 365 fitness_time_limit:0.0 366 fitness_allowed_objs: 363 367 fitfun:0 364 368 fitm:2.0 -
framspy/evolalg/examples/multicriteria.py
r1148 r1149 66 66 help='Genetic format for the demo run, for example 4, 9, or B. If not given, f1 is assumed.') 67 67 parser.add_argument('-sim', required=False, default="eval-allcriteria.sim", 68 help="Name of the .sim file with all parameter values ")68 help="Name of the .sim file with all parameter values. If you want to provide more files, separate them with a semicolon ';'.") 69 69 parser.add_argument('-dissim', required=False, type=Dissim, default=Dissim.frams, 70 70 help='Dissimilarity measure, default: frams', choices=list(Dissim)) … … 168 168 def create_experiment(): 169 169 parsed_args = parseArguments() 170 frams_lib = FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.sim )170 frams_lib = FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.sim.split(";")) 171 171 172 172 opt_dissim = [] … … 311 311 if parsed_args.checkpoint_path is not None and os.path.exists(parsed_args.checkpoint_path): 312 312 experiment = load_experiment(parsed_args.checkpoint_path) 313 FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.sim)314 313 else: 315 314 experiment = create_experiment() -
framspy/evolalg/examples/niching_novelty.py
r1146 r1149 63 63 parser.add_argument('-genformat', required=False, default="1", 64 64 help='Genetic format for the demo run, for example 4, 9, or B. If not given, f1 is assumed.') 65 parser.add_argument('-sim', required=False, default="eval-allcriteria.sim", help="Name of the .sim file with all parameter values ")65 parser.add_argument('-sim', required=False, default="eval-allcriteria.sim", help="Name of the .sim file with all parameter values. If you want to provide more files, separate them with a semicolon ';'.") 66 66 parser.add_argument('-fit', required=False, default=Fitness.raw, type=Fitness, 67 67 help=' Fitness criteria, default: raw', choices=list(Fitness)) … … 166 166 parsed_args = parseArguments() 167 167 frams_lib = FramsticksLib(parsed_args.path, parsed_args.lib, 168 parsed_args.sim )168 parsed_args.sim.split(";")) 169 169 # Steps for generating first population 170 170 init_stages = [ … … 332 332 if parsed_args.checkpoint_path is not None and os.path.exists(parsed_args.checkpoint_path): 333 333 experiment = load_experiment(parsed_args.checkpoint_path) 334 FramsticksLib(parsed_args.path, parsed_args.lib,335 parsed_args.sim)336 334 else: 337 335 experiment = create_experiment() 338 336 experiment.init() # init is mandatory 339 340 337 341 338 experiment.run(parsed_args.generations) -
framspy/evolalg/examples/standard.py
r1146 r1149 46 46 parser.add_argument('-genformat', required=False, default="1", 47 47 help='Genetic format for the demo run, for example 4, 9, or B. If not given, f1 is assumed.') 48 parser.add_argument('-sim', required=False, default="eval-allcriteria.sim", help="Name of the .sim file with all parameter values ")48 parser.add_argument('-sim', required=False, default="eval-allcriteria.sim", help="Name of the .sim file with all parameter values. If you want to provide more files, separate them with a semicolon ';'.") 49 49 parser.add_argument("-popsize", type=int, default=50, help="Population size, default 50.") 50 50 parser.add_argument('-generations', type=int, default=5, help="Number of generations, default 5.") … … 66 66 def main(): 67 67 parsed_args = parseArguments() 68 frams_lib = FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.sim )68 frams_lib = FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.sim.split(";")) 69 69 70 70 hall_of_fame = HallOfFameStatistics(parsed_args.hof_size, "fitness") -
framspy/run-evolalg-examples.cmd
r1147 r1149 1 rem To learn about all available options of each .py algorithm , add "-h" to its parameters.1 rem To learn about all available options of each .py algorithm below, add "-h" to its parameters. 2 2 rem Use the source code of the examples as a starting point for your customizations. 3 3 rem Example usage: … … 6 6 7 7 8 9 rem simple one-criterion evolution 8 10 python -m evolalg.examples.standard -path %DIR_WITH_FRAMS_LIBRARY% -opt numneurons 9 11 12 13 rem "chaining" .sim files, subsequent files overwrite selected parameters 14 python -m evolalg.examples.standard -path %DIR_WITH_FRAMS_LIBRARY% -sim eval-allcriteria.sim;deterministic.sim;sample-period-longest.sim -opt velocity 15 16 17 rem hard limit on the number of parts 10 18 python -m evolalg.examples.niching_novelty -path %DIR_WITH_FRAMS_LIBRARY% -opt velocity -max_numparts 6 -debug 11 19 20 21 rem "local" niching 12 22 python -m evolalg.examples.niching_novelty -path %DIR_WITH_FRAMS_LIBRARY% -opt vertpos -fit knn_niching -knn 3 -max_numjoints 8 -popsize 10 -generations 30 13 23 14 rem '-dissim ...' can be used to include dissimilarity as one of the criteria 24 25 rem two criteria, '-dissim ...' can also be used to include dissimilarity as one of the criteria 15 26 python -m evolalg.examples.multicriteria -path %DIR_WITH_FRAMS_LIBRARY% -popsize 40 -generations 10 -opt velocity,vertpos
Note: See TracChangeset
for help on using the changeset viewer.