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