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