source: cpp/frams/genetics/f4/f4_conv.h @ 831

Last change on this file since 831 was 779, checked in by Maciej Komosinski, 7 years ago

Unified file names of all files involved in genetic conversions and operations so that they start with "f<format>_"

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
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// Copyright (C) 1999,2000  Adam Rotaru-Varga (adam_rotaru@yahoo.com), GNU LGPL
6// Copyright (C) since 2001 Maciej Komosinski
7// 2018, Grzegorz Latosinski, added support for new API for neuron types and their properties
8
9#ifndef _F4_CONV_H_
10#define _F4_CONV_H_
11
12#include <frams/model/model.h>
13#include <frams/model/modelparts.h>
14#include <frams/genetics/genoconv.h>
15#include "f4_general.h"
16
17
18/**
19 * Genotype converter from f4 to f0.
20 */
21class GenoConv_f40 : public GenoConverter
22{
23public:
24        GenoConv_f40();
25
26        /**
27         * Performs conversion from f4 to f0. Creates f4_Model from f4 genotype
28         * and converts the Model to the f0 genotype string.
29         * @param in f4 genotype
30         * @param map mapping from f4 to Model
31         * @param using_checkpoints determines if checkpoints will be available
32         * @return generated f0 genotype
33         */
34        SString convert(SString &in, MultiMap *map, bool using_checkpoints);
35};
36
37
38/**
39 * Genotype converter from f4 to f1. This is only experimental conversion and
40 * returns an approximate f1 genotype.
41 */
42class GenoConv_F41_TestOnly : public GenoConverter
43{
44public:
45        /**
46         * Initializes converter.
47         */
48        GenoConv_F41_TestOnly();
49
50        /**
51         * Performs conversion from f4 to f1. Creates f4_Model from f4 genotype
52         * and converts the Model to the f1 genotype string. The final f1 genotype is
53         * an approximation.
54         * @param in f4 genotype
55         * @param map mapping from f4 to Model
56         * @param using_checkpoints determines if checkpoints will be available
57         * @return generated approximate f1 genotype
58         */
59        SString convert(SString &in, MultiMap *map, bool using_checkpoints);
60};
61
62
63/**
64 * A Model descendant which supports building from an f4 genotype.
65 */
66class f4_Model : public Model
67{
68public:
69        f4_Model();
70        ~f4_Model();
71
72        /**
73         * Builds a Model from the f4 genotype string.
74         * @param geno genotype string
75         * @return GENOPER_OK if a Model could be created, error code otherwise
76         */
77        int      buildFromF4(SString &geno, bool using_checkpoints);
78        /**
79         * Outputs a Model in f1 format. It is an approximation of the input f4 genotype.
80         * @param out the reference that stores the conversion result
81         */
82        void     toF1Geno(SString &out);       // output to f1 format, approximation
83private:
84        f4_Cells *cells;
85        int        buildModelRec(f4_Cell *ndad);
86        /**
87         * Get a cell which is a stick, by traversing dadlinks.
88         */
89        f4_Cell* getStick(f4_Cell *C);
90        int        error;
91        int        errorpos;
92};
93
94
95#endif
Note: See TracBrowser for help on using the repository browser.