Changeset 1091
- Timestamp:
- 02/24/21 13:41:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksLib.py
r1090 r1091 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 standard-eval expdef26 EVALUATION_SETTINGS_FILE = "eval-allcriteria.sim" # MUST be compatible with the standard-eval expdef 27 27 28 28 29 def __init__(self, frams_path, frams_lib_name ):29 def __init__(self, frams_path, frams_lib_name, simsettings): 30 30 if frams_lib_name is None: 31 31 frams.init(frams_path) # could add support for setting alternative directories using -D and -d … … 46 46 frams.Math.randomize(); 47 47 frams.Simulator.expdef = "standard-eval" # this expdef must be used by EVALUATION_SETTINGS_FILE 48 if simsettings is not None: 49 self.EVALUATION_SETTINGS_FILE = simsettings 48 50 49 51 … … 66 68 frams.GenePools[0].clear() 67 69 frams.Simulator.ximport(self.EVALUATION_SETTINGS_FILE, 2 + 4 + 8 + 16) 70 68 71 for g in genotype_list: 69 72 frams.GenePools[0].add(g) … … 120 123 assert isinstance(genotype_list, list) # because in python str has similar capabilities as list and here it would pretend to work too, so to avoid any ambiguity 121 124 122 frams.SimilMeasure.type = 1 # adjust to your needs. Set here because loading EVALUATION_SETTINGS_FILE during evaluation may overwrite these parameters 123 frams.SimilMeasureHungarian.simil_weightedMDS = 1 124 frams.SimilMeasureHungarian.simil_partgeom = 1 125 # if you want to override what EVALUATION_SETTINGS_FILE sets, you can do it below: 126 # frams.SimilMeasure.type = 1 127 # frams.SimilMeasureHungarian.simil_partgeom = 1 128 # frams.SimilMeasureHungarian.simil_weightedMDS = 1 125 129 126 130 n = len(genotype_list) … … 152 156 parser.add_argument('-path', type=ensureDir, required=True, help='Path to the Framsticks library (.dll or .so) without trailing slash.') 153 157 parser.add_argument('-lib', required=False, help='Library name. If not given, "frams-objects.dll" or "frams-objects.so" is assumed depending on the platform.') 158 parser.add_argument('-simsettings', required=False, help='The name of the .sim file with settings for evaluation, mutation, crossover, and similarity estimation. If not given, "eval-allcriteria.sim" is assumed by default. Must be compatible with the "standard-eval" expdef.') 154 159 parser.add_argument('-genformat', required=False, help='Genetic format for the demo run, for example 4, 9, or S. If not given, f1 is assumed.') 155 160 return parser.parse_args() … … 171 176 172 177 parsed_args = parseArguments() 173 framsDLL = FramsticksLib(parsed_args.path, parsed_args.lib )178 framsDLL = FramsticksLib(parsed_args.path, parsed_args.lib, parsed_args.simsettings) 174 179 175 180 print("Sending a direct command to Framsticks CLI that calculates \"4\"+2 yields", frams.Simulator.eval("return \"4\"+2;"))
Note: See TracChangeset
for help on using the changeset viewer.