- Timestamp:
- 10/01/21 23:40:49 (3 years ago)
- Location:
- framspy
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/deterministic.sim
r1149 r1158 10 10 11 11 sim_params: 12 # no need to evaluate a creature many times: 13 evalcount:1 12 14 # always central location in the world: 13 15 placement:1 14 # no need to evaluate many times:15 evalcount:116 16 # no random initialization of state in neurons: 17 17 randinit:0.0 -
framspy/frams-test-props.py
r1151 r1158 1 """An example of iterating through the properties of an ExtValue object and printing their characteristics.""" 2 1 3 import frams 2 4 import sys … … 4 6 frams.init(*(sys.argv[1:])) 5 7 6 def printSingleProperty(v,p): 7 print(' %s "%s" type="%s" flags=%d group=%d help="%s"' % (v._propId(p),v._propName(p),v._propType(p),v._propFlags(p),v._propGroup(p),v._propHelp(p))) 8 9 def printSingleProperty(v, p): 10 print(' * %s "%s" type="%s" flags=%d group=%d help="%s"' % (v._propId(p), v._propName(p), v._propType(p), v._propFlags(p), v._propGroup(p), v._propHelp(p))) 8 11 9 12 10 13 def printFramsProperties(v): 11 N=v._propCount() 12 G=v._groupCount() 13 if G<2: 14 15 #no groups, simply iterate all props 16 17 print("'%s' has %d properties" % (v._class(),v._propCount())) 14 N = v._propCount() 15 G = v._groupCount() 16 print("======================= '%s' has %d properties in %d group(s). =======================" % (v._class(), N, G)) 17 if G < 2: 18 # No groups, simply iterate all properties 18 19 for p in range(v._propCount()): 19 printSingleProperty(v,p) 20 20 printSingleProperty(v, p) 21 21 else: 22 23 #iterate through groups and iterate all props in a group. 24 #why the distinction? 25 #first, just to show there are two ways. there is always at least one 26 #group so you can always get all props by iterating the group. 27 #second, groups actually do not exist as collections. iterating in 28 #groups works by checking all properties on each iteration and 29 #testing which one is the m-th property of the group. 30 #these inefficient _memberCount() and _groupMember() are provided 31 #for the sake of completeness but don't use them without good reason ;-) 32 33 print("'%s' has %d properties in %d group(s)" % (v._class(),v._propCount(),v._groupCount())) 22 # Iterate through groups and iterate all props in a group. 23 # Why the distinction? 24 # First, just to show there are two ways. There is always at least one 25 # group so you can always get all properties by iterating the group. 26 # Second, groups actually do not exist as collections. Iterating in 27 # groups works by checking all properties on each iteration and 28 # testing which one is the m-th property of the group! 29 # So these inefficient _memberCount() and _groupMember() are provided 30 # for the sake of completeness, but don't use them without a good reason ;-) 34 31 for g in range(G): 35 print('\n =========== Group #%d: %s ==========' % (g,v._groupName(g)))32 print('\n------------------- Group #%d: %s -------------------' % (g, v._groupName(g))) 36 33 for m in range(v._memberCount(g)): 37 p=v._groupMember(g,m) 38 printSingleProperty(v,p) 39 print('========================\n') 40 41 34 p = v._groupMember(g, m) 35 printSingleProperty(v, p) 36 print('\n\n') 42 37 43 38 44 39 printFramsProperties(frams.World) 45 46 printFramsProperties(frams.GenePools[0].add('X')) 40 41 printFramsProperties(frams.GenePools[0].add('X')) # add('X') returns a Genotype object -
framspy/run-evolalg-examples.cmd
r1149 r1158 7 7 8 8 9 rem simple one-criterion evolution 9 10 rem simple one-criterion evolution from minimalistic example source (examples.standard) 10 11 python -m evolalg.examples.standard -path %DIR_WITH_FRAMS_LIBRARY% -opt numneurons 11 12 12 13 13 rem "chaining" .sim files, subsequent files overwrite selected parameters14 rem as above but "chaining" .sim files, subsequent files overwrite selected parameters 14 15 python -m evolalg.examples.standard -path %DIR_WITH_FRAMS_LIBRARY% -sim eval-allcriteria.sim;deterministic.sim;sample-period-longest.sim -opt velocity 15 16 16 17 17 rem hard limit on the number of parts18 rem simple one-criterion evolution but more options available in examples.niching_novelty, here: hard limit on the number of parts and debugging messages 18 19 python -m evolalg.examples.niching_novelty -path %DIR_WITH_FRAMS_LIBRARY% -opt velocity -max_numparts 6 -debug 19 20 -
framspy/sample-period-longest.sim
r1149 r1158 1 # Extremely high "performance sampling period" (likely longer than lifespan) in the first population2 # to measure distance and velocity rectilinearly. Such a long periodresults in two sampling events: at birth and at death.1 # Extremely high "performance sampling period" in the first population to measure distance and velocity rectilinearly. 2 # Such a long period (likely longer than lifespan) results in two sampling events: at birth and at death. 3 3 # 4 4 # Before loading this file, load base settings, e.g. "eval-allcriteria.sim".
Note: See TracChangeset
for help on using the changeset viewer.