source: cpp/tests/genomanipulation-complex-linux.goal @ 1015

Last change on this file since 1015 was 1015, checked in by sz, 4 years ago

test updates:

  • geno_test(.no_exe)
  • linux variants added because of floating point differences
File size: 15.5 KB
Line 
1    #############################################
2   ##                                           ##
3  ##    Welcome to Genotype Manipulation Demo!    ##
4   ##                                           ##
5    #############################################
6Found converter accepting f1: "Recursive encoding"
7Found 6 converter(s) producing f0
8
9Source genotype: 'FIX[@,p:0.6543,1:-1.23456]X[G]'
10                  ( format 1 )
11Converted to f0:
12p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
13p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
14p:2.0, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
15j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
16j:1, 2, dx=1.0, 0.0, 0.0, stam=0.175, vr=0.5, 0.5, 0.5
17n:j=0, d=@:p=0.6543
18n:j=1, d=G
19c:0, 1, -1.23456
20
21Model contains: 3 part(s)
22                2 joint(s)
23                2 neuron(s)
24
25Investigating details...
26    #############################################
27   ##                                           ##
28  ##    P A R T    O B J E C T                   ##
29   ##                                           ##
30    #############################################
31            (part # 1)
32Here is the full listing of properties as they are printed in f0
33 (please compare with f0 genotype).
34Some properties have special meaning (eg. geometry and connections groups)
35and should be handled with care, because they influence other elements of the model.
36
37 [this data is provided by Part::properties() ]
38 #        id                      type  name        group (22 properties)
39 0.        x = 1.0                  f   position.x  Geometry 
40 1.        y = 0.0                  f   position.y  Geometry 
41 2.        z = 0.0                  f   position.z  Geometry 
42 3.       sh = 0                    d 0 3 0 shape       Geometry 
43 4.        s = 1.0                  f 0.1 10.0 1.0 size        Geometry 
44 5.       sx = 1.0                  f 0.05 5.0 1.0 scale.x     Geometry 
45 6.       sy = 1.0                  f 0.05 5.0 1.0 scale.y     Geometry 
46 7.       sz = 1.0                  f 0.05 5.0 1.0 scale.z     Geometry 
47 8.        h = 0.0                  f 0 1 0 hollow      Other properties
48 9.       dn = 1.0                  f 0.2 5.0 1.0 density     Other properties
4910.       fr = 1.12                 f 0.0 4.0 0.4 friction    Other properties
5011.      ing = 0.53125              f 0.0 1.0 0.25 ingestion   Other properties
5112.       as = 0.15625              f 0.0 1.0 0.25 assimilation  Other properties
5213.       rx = 0.0                  f   rot.x       Geometry 
5314.       ry = 0.0                  f   rot.y       Geometry 
5415.       rz = 0.0                  f   rot.z       Geometry 
5516.        i =                      s   info        Other properties
5617.   Vstyle = part                 s 0 0 part vis_style   Visual   
5718.       vs = 0.2                  f 0.05 0.7 0.2 visual thickness  Visual   
5819.       vr = 0.5                  f 0.0 1.0 1.0 red component  Visual   
5920.       vg = 0.5                  f 0.0 1.0 1.0 green component  Visual   
6021.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Visual   
61
62However, there is a subset of properties which may be modified more freely.
63Properties on this list are related only to this part and can be changed
64without much consideration. They are guaranteed to be always valid; any inconsistencies
65will be silently repaired.
66
67 [this data is provided by Part::extraProperties() ]
68 #        id                      type  name        group (9 properties)
69 0.        h = 0.0                  f 0 1 0 hollow      Extra properties
70 1.       dn = 1.0                  f 0.2 5.0 1.0 density     Extra properties
71 2.       fr = 1.12                 f 0.0 4.0 0.4 friction    Extra properties
72 3.      ing = 0.53125              f 0.0 1.0 0.25 ingestion   Extra properties
73 4.       as = 0.15625              f 0.0 1.0 0.25 assimilation  Extra properties
74 5.       vs = 0.2                  f 0.05 0.7 0.2 visual thickness  Extra properties
75 6.       vr = 0.5                  f 0.0 1.0 1.0 red component  Extra properties
76 7.       vg = 0.5                  f 0.0 1.0 1.0 green component  Extra properties
77 8.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Extra properties
78
79This set of properties can vary from release to release,
80but can be safely accessed by using extraProperties() call.
81This method accesses the full set of properies (even those
82which appear in future releases).
83Now we will try to change some of properties:
84
85      Change property #7 to random value from range [0..1]
86      Current value of 'vg' (green component) is '0.5'
87      Setting new value... [ using ParamInterface::set() ]
88      The value is now '0.548814'
89
90Let's see f0... (check out part #1 !)
91
92p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
93p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
94p:2.0, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
95j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
96j:1, 2, dx=1.0, 0.0, 0.0, stam=0.175, vr=0.5, 0.5, 0.5
97n:j=0, d=@:p=0.6543
98n:j=1, d=G
99c:0, 1, -1.23456
100
101    #############################################
102   ##                                           ##
103  ##    J O I N T    O B J E C T                 ##
104   ##                                           ##
105    #############################################
106            (joint # 1)
107Similarly as with Part, the full list of properties comes first:
108
109 #        id                      type  name        group (27 properties)
110 0.       p1 = 1                    d -1 999999 -1 part1 ref#  Connections
111 1.       p2 = 2                    d -1 999999 -1 part2 ref#  Connections
112 2.       rx = 0.0                  f   rotation.x  Geometry 
113 3.       ry = 0.0                  f   rotation.y  Geometry 
114 4.       rz = 0.0                  f   rotation.z  Geometry 
115 5.       dx = 1.0                  f -2 2 0 delta.x     Geometry 
116 6.       dy = 0.0                  f -2 2 0 delta.y     Geometry 
117 7.       dz = 0.0                  f -2 2 0 delta.z     Geometry 
118 8.       sh = 0                    d 0 3 0 shape       Geometry 
119 9.       hx = 0.0                  f   hinge position.x  Geometry 
12010.       hy = 0.0                  f   hinge position.y  Geometry 
12111.       hz = 0.0                  f   hinge position.z  Geometry 
12212.      hrx = 0.0                  f   hinge rotation.x  Geometry 
12313.      hry = 0.0                  f   hinge rotation.y  Geometry 
12414.      hrz = 0.0                  f   hinge rotation.z  Geometry 
12515.      hxn = -1.5708              f -6.2832 0 -1.5708 hinge x negative limit  Geometry 
12616.      hxp = 1.5708               f 0 6.2832 1.5708 hinge x positive limit  Geometry 
12717.      hyn = -1.5708              f -6.2832 0 -1.5708 hinge y negative limit  Geometry 
12818.      hyp = 1.5708               f 0 6.2832 1.5708 hinge y positive limit  Geometry 
12919.     stif = 1.0                  f 0.0 1.0 1.0 stiffness   Other properties
13020.  rotstif = 1.0                  f 0.0 1.0 1.0 rotation stiffness  Other properties
13121.     stam = 0.175                f 0.0 1.0 0.25 stamina     Other properties
13222.        i =                      s   info        Other properties
13323.   Vstyle = joint                s 0 0 joint vis_style   Visual   
13424.       vr = 0.5                  f 0.0 1.0 1.0 red component  Visual   
13525.       vg = 0.5                  f 0.0 1.0 1.0 green component  Visual   
13626.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Visual   
137
138Actually, there are two kinds of Joints: delta and absolute.
139For this object, Joint::isDelta() returns 1, so this is the delta Joint.
140
141Delta fields (dx,dy,dz) describe relative location of the second part.
142This joint will change the second Part's positions to preserve delta distance.
143Let's move the first Part (#1) along y axis (+0.1) and change delta.z (dz) by 0.1.
144Position of the second Part referenced by this joint (part #2) is now changed:
145
146p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
147p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
148p:2.0, z=0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
149j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
150j:1, 2, dx=1.0, 0.0, 0.1, stam=0.175, vr=0.5, 0.5, 0.5
151n:j=0, d=@:p=0.6543
152n:j=1, d=G
153c:0, 1, -1.23456
154
155If no delta fields are defined, they will be computed automatically.
156You can always delete existing delta values by using Joint::resetDelta().
157Now we will change the second Part's z position by -0.2 and call resetDelta()...
158As you can see, Joint's delta fields have altered:
159
160p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
161p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
162p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
163j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
164j:1, 2, dx=1.0, 0.0, -0.1, stam=0.175, vr=0.5, 0.5, 0.5
165n:j=0, d=@:p=0.6543
166n:j=1, d=G
167c:0, 1, -1.23456
168
169How would this joint look like with delta option disabled?
170[ by calling Joint::useDelta(0) ]
171f0 is now:
172
173p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
174p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
175p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
176j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
177j:1, 2, stam=0.175, vr=0.5, 0.5, 0.5
178n:j=0, d=@:p=0.6543
179n:j=1, d=G
180c:0, 1, -1.23456
181
182...so this is an absolute joint.
183
184Absolute Joints adapt to its Parts' positions.
185We can move a Part, and it does not influence the second part, nor the Joint.
186Let's move the first Part along y axis by -0.1...
187The Part's position is changed, but everything else stays intact:
188
189p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
190p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
191p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
192j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
193j:1, 2, stam=0.175, vr=0.5, 0.5, 0.5
194n:j=0, d=@:p=0.6543
195n:j=1, d=G
196c:0, 1, -1.23456
197
198Part references and delta fields are the 'core' properties of the Joint.
199The other properties are available from Joint::extraProperties()
200and at the moment are defined as follows:
201
202 #        id                      type  name        group (5 properties)
203 0.     stif = 1.0                  f 0.0 1.0 1.0 stiffness   Extra properties
204 1.  rotstif = 1.0                  f 0.0 1.0 1.0 rotation stiffness  Extra properties
205 2.       vr = 0.5                  f 0.0 1.0 1.0 red component  Extra properties
206 3.       vg = 0.5                  f 0.0 1.0 1.0 green component  Extra properties
207 4.       vb = 0.5                  f 0.0 1.0 1.0 blue component  Extra properties
208
209They can be changed just like Part's extra properties:
210      Change property #0 to random value from range [0..1]
211      Current value of 'stif' (stiffness) is '1.0'
212      Setting new value... [ using ParamInterface::set() ]
213      The value is now '0.592845'
214And after that we have this genotype:
215
216p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
217p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
218p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
219j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
220j:1, 2, stif=0.592845, stam=0.175, vr=0.5, 0.5, 0.5
221n:j=0, d=@:p=0.6543
222n:j=1, d=G
223c:0, 1, -1.23456
224
225    #############################################
226   ##                                           ##
227  ##    N E U R O    O B J E C T                 ##
228   ##                                           ##
229    #############################################
230            (neuro # 1)
231Basic features of Neuro object are similar to those of Part and Joint.
232We can request a property list:
233
234 #        id                      type  name        group (10 properties)
235 0.        p = -1                   d -1 999999 -1 part ref#   Connections
236 1.        j = 1                    d -1 999999 -1 joint ref#  Connections
237 2.        d = G                    s   details     Other     
238 3.        i =                      s   info        Other     
239 4.   Vstyle = neuro                s 0 0 neuro vis_style   Visual   
240 5. getInputCount = 0                    d   input count  Connections
241 9. classObject = null                 oNeuroClass neuron class  Connections
242
243...and extra properties (which are designed to be always valid and easy to change):
244
245 #        id                      type  name        group (0 properties)
246
247As usual, we will change something:
248Each neuron can have any number of inputs = weighted connections
249 with other neurons.
250According to Neuro::getInputCount(), this one has 0 inputs.
251Standard API is provided for accessing those inputs (getInput(int)),
252adding inputs (addInput(Neuro*)) and removing them (removeInput(int)).
253
254
255The most unusual thing is 'details' field (d).
256It is something like separate object with its own set of properties.
257Currently the value of 'd' is 'G'.
258'G' is the class name (Neuro::getClassName() == 'G') and means 'Gyroscope'.
259Neuro::getClass() gives you information about basic characteristic
260of the class, that can be analyzed automatically.
261For the current object we can learn that it supports no inputs (getPreferredInputs()) and provides meaningful output signal (getPreferredOutput()==1).
262Instances of 'G' can be used in models having shape types: 'ball-and-stick'.
263Instances of 'G' can be attached to Joints having any shapes.
264(This class does not have its own properties
265 - Neuro::classProperties().getPropCount()==0)
266The class of this object can be changed using Neuro::setClassName()
267The following classes are available:
268 [ data provided by Neuro::getClassInfo()->getProperties() ]
269
270 #  class  description       properties
271 0.     N  Neuron                 4
272 1.    Nu  Unipolar neuron [EXPERIMENTAL!]   4
273 2.     G  Gyroscope              0
274 3. Gpart  Part Gyroscope         2
275 4.     T  Touch                  3
276 5.Tcontact  Touch contact          0
277 6.Tproximity  Touch proximity        3
278 7.     S  Smell                  0
279 8.     *  Constant               0
280 9.     |  Bend muscle            2
28110.     @  Rotation muscle        1
28211.     M  Muscle for solids      2
28312.     D  Differentiate          0
28413. Fuzzy  Fuzzy system [EXPERIMENTAL!]   4
28514.   Sti  Sticky [EXPERIMENTAL!]   0
28615.   LMu  Linear muscle [EXPERIMENTAL!]   1
28716. Water  Water detector         0
28817.Energy  Energy level           0
28918.    Ch  Channelize             0
29019. ChMux  Channel multiplexer    0
29120. ChSel  Channel selector       1
29221.   Rnd  Random noise           0
29322.   Sin  Sinus generator        2
294
295Let's change the Neuro's class to 'N'...
296 #        id                      type  name        group (4 properties)
297 0.       in = 0.8                  f 0.0 1.0 0.8 Inertia     (null)   
298 1.       fo = 0.04                 f 0.0 999.0 0.04 Force       (null)   
299 2.       si = 2.0                  f -99999.0 99999.0 2.0 Sigmoid     (null)   
300 3.        s = 0.0                  f -1.0 1.0 0.0 State       (null)   
301      Change property #2 to random value from range [-99999..99999]
302      Current value of 'si' (Sigmoid) is '2.0'
303      Setting new value... [ using ParamInterface::set() ]
304      The value is now '43037.4'
305The final object description will be then: 'N:si=43037.4'
306And the full f0 genotype:
307
308p:fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.5, 0.5
309p:1.0, fr=1.12, ing=0.53125, as=0.15625, vr=0.5, 0.548814, 0.5
310p:2.0, z=-0.1, fr=0.976, ing=0.475, as=0.175, vr=0.5, 0.5, 0.5
311j:0, 1, dx=1.0, 0.0, 0.0, stam=0.15625, vr=0.5, 0.5, 0.5
312j:1, 2, stif=0.592845, stam=0.175, vr=0.5, 0.5, 0.5
313n:j=0, d=@:p=0.6543
314n:j=1, d=N:si=43037.4
315c:0, 1, -1.23456
316
317
318######### THE END ###########
319
320Hints:
321  1. You can redirect output: genomanipulation >filename.txt
322  2. Each run can yield different results and new behaviors, but you
323     need to uncomment srand(time(0)) in genomanipulation.cpp.
324  3. This application will use custom genotype passed as
325     a commandline parameter: genomanipulation "/*9*/FULU"
326
327
Note: See TracBrowser for help on using the repository browser.