############################################# ## ## ## Welcome to Genotype Manipulation Demo! ## ## ## ############################################# Found converter accepting f1: "Recursive encoding" Found 6 converter(s) producing f0 Source genotype: 'X[|G:1.23]' ( format 1 ) Converted to f0: p:vr=0.5, 0.5, 0.5 p:1.0, vr=0.5, 0.5, 0.5 j:0, 1, dx=1.0, 0.0, 0.0, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 Model contains: 2 part(s) 1 joint(s) 3 neuron(s) Investigating details... ############################################# ## ## ## P A R T O B J E C T ## ## ## ############################################# (part # 1) Here is the full listing of properties as they are printed in f0 (please compare with f0 genotype). Some properties have special meaning (eg. geometry and connections groups) and should be handled with care, because they influence other elements of the model. [this data is provided by Part::properties() ] # id type name group (22 properties) 0. x = 1.0 f position.x Geometry 1. y = 0.0 f position.y Geometry 2. z = 0.0 f position.z Geometry 3. sh = 0 d 0 3 0 shape Geometry 4. s = 1.0 f 0.1 10.0 1.0 size Geometry 5. sx = 1.0 f 0.05 5.0 1.0 scale.x Geometry 6. sy = 1.0 f 0.05 5.0 1.0 scale.y Geometry 7. sz = 1.0 f 0.05 5.0 1.0 scale.z Geometry 8. h = 0.0 f 0 1 0 hollow Other properties 9. dn = 1.0 f 0.2 5.0 1.0 density Other properties 10. fr = 0.4 f 0.0 4.0 0.4 friction Other properties 11. ing = 0.25 f 0.0 1.0 0.25 ingestion Other properties 12. as = 0.25 f 0.0 1.0 0.25 assimilation Other properties 13. rx = 0.0 f rot.x Geometry 14. ry = 0.0 f rot.y Geometry 15. rz = 0.0 f rot.z Geometry 16. i = s info Other properties 17. Vstyle = part s 0 0 part vis_style Visual 18. vs = 0.2 f 0.05 0.7 0.2 visual thickness Visual 19. vr = 0.5 f 0.0 1.0 1.0 red component Visual 20. vg = 0.5 f 0.0 1.0 1.0 green component Visual 21. vb = 0.5 f 0.0 1.0 1.0 blue component Visual However, there is a subset of properties which may be modified more freely. Properties on this list are related only to this part and can be changed without much consideration. They are guaranteed to be always valid; any inconsistencies will be silently repaired. [this data is provided by Part::extraProperties() ] # id type name group (9 properties) 0. h = 0.0 f 0 1 0 hollow Extra properties 1. dn = 1.0 f 0.2 5.0 1.0 density Extra properties 2. fr = 0.4 f 0.0 4.0 0.4 friction Extra properties 3. ing = 0.25 f 0.0 1.0 0.25 ingestion Extra properties 4. as = 0.25 f 0.0 1.0 0.25 assimilation Extra properties 5. vs = 0.2 f 0.05 0.7 0.2 visual thickness Extra properties 6. vr = 0.5 f 0.0 1.0 1.0 red component Extra properties 7. vg = 0.5 f 0.0 1.0 1.0 green component Extra properties 8. vb = 0.5 f 0.0 1.0 1.0 blue component Extra properties This set of properties can vary from release to release, but can be safely accessed by using extraProperties() call. This method accesses the full set of properies (even those which appear in future releases). Now we will try to change some of properties: Change property #5 to random value from range [0.05..0.7] Current value of 'vs' (visual thickness) is '0.2' Setting new value... [ using ParamInterface::set() ] The value is now '0.514873' Let's see f0... (check out part #1 !) p:vr=0.5, 0.5, 0.5 p:1.0, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, dx=1.0, 0.0, 0.0, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 ############################################# ## ## ## J O I N T O B J E C T ## ## ## ############################################# (joint # 0) Similarly as with Part, the full list of properties comes first: # id type name group (27 properties) 0. p1 = 0 d -1 999999 -1 part1 ref# Connections 1. p2 = 1 d -1 999999 -1 part2 ref# Connections 2. rx = 0.0 f rotation.x Geometry 3. ry = 0.0 f rotation.y Geometry 4. rz = 0.0 f rotation.z Geometry 5. dx = 1.0 f -2 2 0 delta.x Geometry 6. dy = 0.0 f -2 2 0 delta.y Geometry 7. dz = 0.0 f -2 2 0 delta.z Geometry 8. sh = 0 d 0 3 0 shape Geometry 9. hx = 0.0 f hinge position.x Geometry 10. hy = 0.0 f hinge position.y Geometry 11. hz = 0.0 f hinge position.z Geometry 12. hrx = 0.0 f hinge rotation.x Geometry 13. hry = 0.0 f hinge rotation.y Geometry 14. hrz = 0.0 f hinge rotation.z Geometry 15. hxn = -1.5708 f -6.2832 0 -1.5708 hinge x negative limit Geometry 16. hxp = 1.5708 f 0 6.2832 1.5708 hinge x positive limit Geometry 17. hyn = -1.5708 f -6.2832 0 -1.5708 hinge y negative limit Geometry 18. hyp = 1.5708 f 0 6.2832 1.5708 hinge y positive limit Geometry 19. stif = 1.0 f 0.0 1.0 1.0 stiffness Other properties 20. rotstif = 1.0 f 0.0 1.0 1.0 rotation stiffness Other properties 21. stam = 0.25 f 0.0 1.0 0.25 stamina Other properties 22. i = s info Other properties 23. Vstyle = joint s 0 0 joint vis_style Visual 24. vr = 0.5 f 0.0 1.0 1.0 red component Visual 25. vg = 0.5 f 0.0 1.0 1.0 green component Visual 26. vb = 0.5 f 0.0 1.0 1.0 blue component Visual Actually, there are two kinds of Joints: delta and absolute. For this object, Joint::isDelta() returns 1, so this is the delta Joint. Delta fields (dx,dy,dz) describe relative location of the second part. This joint will change the second Part's positions to preserve delta distance. Let's move the first Part (#0) along y axis (+0.1) and change delta.z (dz) by 0.1. Position of the second Part referenced by this joint (part #1) is now changed: p:y=0.1, vr=0.5, 0.5, 0.5 p:1.0, 0.1, 0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, dx=1.0, 0.0, 0.1, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 If no delta fields are defined, they will be computed automatically. You can always delete existing delta values by using Joint::resetDelta(). Now we will change the second Part's z position by -0.2 and call resetDelta()... As you can see, Joint's delta fields have altered: p:y=0.1, vr=0.5, 0.5, 0.5 p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, dx=1.0, 0.0, -0.1, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 How would this joint look like with delta option disabled? [ by calling Joint::useDelta(0) ] f0 is now: p:y=0.1, vr=0.5, 0.5, 0.5 p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 ...so this is an absolute joint. Absolute Joints adapt to its Parts' positions. We can move a Part, and it does not influence the second part, nor the Joint. Let's move the first Part along y axis by -0.1... The Part's position is changed, but everything else stays intact: p:vr=0.5, 0.5, 0.5 p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, vr=0.5, 0.5, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 Part references and delta fields are the 'core' properties of the Joint. The other properties are available from Joint::extraProperties() and at the moment are defined as follows: # id type name group (5 properties) 0. stif = 1.0 f 0.0 1.0 1.0 stiffness Extra properties 1. rotstif = 1.0 f 0.0 1.0 1.0 rotation stiffness Extra properties 2. vr = 0.5 f 0.0 1.0 1.0 red component Extra properties 3. vg = 0.5 f 0.0 1.0 1.0 green component Extra properties 4. vb = 0.5 f 0.0 1.0 1.0 blue component Extra properties They can be changed just like Part's extra properties: Change property #3 to random value from range [0..1] Current value of 'vg' (green component) is '0.5' Setting new value... [ using ParamInterface::set() ] The value is now '0.857946' And after that we have this genotype: p:vr=0.5, 0.5, 0.5 p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, vr=0.5, 0.857946, 0.5 n:p=1 n:j=0, d="|:p=0.25,r=1" n:j=0, d=G c:0, 2, 1.23 c:1, 0 ############################################# ## ## ## N E U R O O B J E C T ## ## ## ############################################# (neuro # 1) Basic features of Neuro object are similar to those of Part and Joint. We can request a property list: # id type name group (10 properties) 0. p = -1 d -1 999999 -1 part ref# Connections 1. j = 0 d -1 999999 -1 joint ref# Connections 2. d = |:p=0.25,r=1 s details Other 3. i = s info Other 4. Vstyle = neuro s 0 0 neuro vis_style Visual 5. getInputCount = 1 d input count Connections 9. classObject = null oNeuroClass neuron class Connections ...and extra properties (which are designed to be always valid and easy to change): # id type name group (0 properties) As usual, we will change something: Each neuron can have any number of inputs = weighted connections with other neurons. According to Neuro::getInputCount(), this one has 1 inputs. Standard API is provided for accessing those inputs (getInput(int)), adding inputs (addInput(Neuro*)) and removing them (removeInput(int)). The most unusual thing is 'details' field (d). It is something like separate object with its own set of properties. Currently the value of 'd' is '|:p=0.25,r=1'. '|' is the class name (Neuro::getClassName() == '|') and means 'Bend muscle'. Neuro::getClass() gives you information about basic characteristic of the class, that can be analyzed automatically. For the current object we can learn that it supports 1 inputs (getPreferredInputs()) and doesn't provide useful output signal (getPreferredOutput()==0). Instances of '|' can be used in models having shape types: 'ball-and-stick'. Instances of '|' can be attached to Joints having any shapes. The class defines its own properties: [ data provided by Neuro::classProperties() ] # id type name group (2 properties) 0. p = 0.25 f 0.01 1.0 0.25 power Bend muscle 1. r = 1.0 f 0.0 1.0 1.0 bending range Bend muscle and they can be changed: Change property #1 to random value from range [0..1] Current value of 'r' (bending range) is '1.0' Setting new value... [ using ParamInterface::set() ] The value is now '0.423655' After that, 'details' contains the new object: '|:r=0.423655'. The class of this object can be changed using Neuro::setClassName() The following classes are available: [ data provided by Neuro::getClassInfo()->getProperties() ] # class description properties 0. N Neuron 4 1. Nu Unipolar neuron [EXPERIMENTAL!] 4 2. G Gyroscope 0 3. Gpart Part Gyroscope 2 4. T Touch 3 5.Tcontact Touch contact 0 6.Tproximity Touch proximity 3 7. S Smell 0 8. * Constant 0 9. | Bend muscle 2 10. @ Rotation muscle 1 11. M Muscle for solids 2 12. D Differentiate 0 13. Fuzzy Fuzzy system [EXPERIMENTAL!] 4 14. Sti Sticky [EXPERIMENTAL!] 0 15. LMu Linear muscle [EXPERIMENTAL!] 1 16. Water Water detector 0 17.Energy Energy level 0 18. Ch Channelize 0 19. ChMux Channel multiplexer 0 20. ChSel Channel selector 1 21. Rnd Random noise 0 22. Sin Sinus generator 2 Let's change the Neuro's class to 'Sti'... [WARN] Param.loadSingleLine: Unknown property 'Sti.r' (ignored) Info for input #0 = "" Info for input #0, field "abc" = "" The final object description will be then: 'Sti' And the full f0 genotype: p:vr=0.5, 0.5, 0.5 p:1.0, 0.1, -0.1, vs=0.514873, vr=0.5, 0.5, 0.5 j:0, 1, vr=0.5, 0.857946, 0.5 n:p=1 n:j=0, d=Sti n:j=0, d=G c:0, 2, 1.23 c:1, 0, i="test=44,abc=yeah" ######### THE END ########### Hints: 1. You can redirect output: genomanipulation >filename.txt 2. Each run can yield different results and new behaviors, but you need to uncomment rndRandomizeSeed() in genomanipulation.cpp. 3. This application will use custom genotype passed as a commandline parameter: genomanipulation "/*9*/FULU"