1 | // This file is a part of the Framsticks GDK library.
|
---|
2 | // Copyright (C) 2002-2011 Szymon Ulatowski. See LICENSE.txt for details.
|
---|
3 | // Refer to http://www.framsticks.com/ for further information.
|
---|
4 |
|
---|
5 | #ifndef _CONV_F1_H
|
---|
6 | #define _CONV_F1_H
|
---|
7 |
|
---|
8 | #include "genoconv.h"
|
---|
9 | #include "model.h"
|
---|
10 |
|
---|
11 | struct F1Props
|
---|
12 | {
|
---|
13 | double dlug,skr,masa,tarcie,ruch,asym,odpor,wchl,rot,energ;
|
---|
14 | double bendrange;
|
---|
15 | int resetrange;
|
---|
16 | void wykluczanie();
|
---|
17 | };
|
---|
18 |
|
---|
19 | /**
|
---|
20 | Official framsticks f1 -> f0 converter.
|
---|
21 | Source code is published as educational example, but currently not
|
---|
22 | well documented.
|
---|
23 | This converter features building creature using Model class
|
---|
24 | and some advanced tricks (changing model data during construction).
|
---|
25 | Final f0 genotype is generated by model class.
|
---|
26 |
|
---|
27 | <b>GDK 1.0.5 NN extension: (for Framsticks 2.0)</B>
|
---|
28 |
|
---|
29 | Until now, only the "standard" Framsticks v1 neuron classes could be used.
|
---|
30 | Starting with GDK 1.0.5 you can use all neuron types.
|
---|
31 |
|
---|
32 | \b Syntax: [classname , input_or_parameter:weight , input_or_parameter:weight , ...]
|
---|
33 |
|
---|
34 | The classname is optional, the default class will be used if it is omitted.
|
---|
35 | Note the comma after \b classname. It must be present if you provide the classname.
|
---|
36 | This is to distinguish between old muscle syntax and new classname specification:
|
---|
37 | - "[|,0:1]" is the neuron of class "|" (bend muscle) with one self connection.
|
---|
38 | \image html nn-ex1.gif
|
---|
39 | - "[|0:1]" describes the default neuron class (N) connected with the bend muscle (|).
|
---|
40 | \image html nn-ex2.gif
|
---|
41 |
|
---|
42 |
|
---|
43 | Neuron parameters can be specified along with inputs, eg: "[myclass,param1:34,param2:56]"
|
---|
44 | The names beginning with UPPER case character are assumed to be neuron classes.
|
---|
45 | "[myclass,g:1.23,G:2.34]" - the first 'g' is the parameter, the second one is the receptor
|
---|
46 | G ("gyroscope").
|
---|
47 |
|
---|
48 | Another example:
|
---|
49 |
|
---|
50 | "X[G][-1:2.3][-2:3.4]" - The first neuron is the standalone G receptor. Other neuron can use its output
|
---|
51 | signal by specifying it as regular input ("-1:2.3" and "-2:3.4"). This NN contains 3 neurons.
|
---|
52 | \image html nn-ex3.gif
|
---|
53 |
|
---|
54 | "X[G:2.3][G:3.4]" - with the old syntax it is impossible to connect 2 neurons with the same gyroscope,
|
---|
55 | because everything inside brackets is private to the neuron, others can't refer to it.
|
---|
56 | Adding another neuron with "G" input will add another gyroscope object. This NN contains 4 neurons
|
---|
57 | (or 2 neurons if you try it in Framsticks v1).
|
---|
58 | \image html nn-ex4.gif
|
---|
59 |
|
---|
60 | */
|
---|
61 | class GenoConv_F1: public GenoConverter
|
---|
62 | {
|
---|
63 | public:
|
---|
64 | GenoConv_F1()
|
---|
65 | {
|
---|
66 | name="Recursive encoding";
|
---|
67 | in_format='1';
|
---|
68 | mapsupport=1;
|
---|
69 | }
|
---|
70 | SString convert(SString &i,MultiMap *map);
|
---|
71 | ~GenoConv_F1() {}
|
---|
72 | };
|
---|
73 |
|
---|
74 |
|
---|
75 | #endif
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 |
|
---|
80 |
|
---|