source: cpp/frams/_demos/genotypemini.h @ 732

Last change on this file since 732 was 732, checked in by Maciej Komosinski, 6 years ago

Added support for "checkpoints" (intermediate phases of development of the Model when converting between genetic encodings). See Model.checkpoint() and conv_f1.cpp for an example.

File size: 1.6 KB
Line 
1#ifndef _GENOTYPEMINI_H_
2#define _GENOTYPEMINI_H_
3
4#include <frams/param/param.h>
5#include <frams/util/extvalue.h>
6#include <frams/genetics/geno.h>
7#include <functional>
8
9/** Defines the association between "org:" object (found in genotype files)
10        and the GenotypeMini fields. GenotypeMiniLoader uses this definition
11        but you can also use it to make MultiParamLoader load genotype
12        */
13extern ParamEntry genotypemini_paramtab[];
14
15/** Helper class, mostly useful with MultiParamLoader
16        or its specialized version: MiniGenotypeLoader.
17        GenotypeMini stores the subset of Genotype fields (the ones normally saved in .gen files)
18        */
19class GenotypeMini
20{
21public:
22        SString name, genotype, info, uid;
23        double info_timestamp;
24        SString info_author, info_email;
25        paInt info_author_ispublic, info_email_ispublic, info_origin;
26        SString info_how_created, info_performance;
27        double energy0, lifespan, velocity, distance, vertvel, vertpos;
28        paInt numparts, numjoints, numneurons, numconnections, ordnumber, generation, instances, is_valid;
29        ExtValue user1, user2, user3;
30        ExtObject data;
31        void clear();
32
33        GenotypeMini();
34        GenotypeMini(const GenotypeMini &src);
35        void initData();
36
37#define GENOTYPEMINI_USE_GENMAN(gm) GenotypeMini::useGenManMutate(std::bind(&GenMan::mutate,&(gm),std::placeholders::_1))
38        static void useGenManMutate(std::function<Geno(const Geno&)> gmm);
39        /** GenMan object must be provided before using the 'mutate()' operation, like this:
40                GENOTYPEMINI_USE_GENMAN(genetics.genman);
41                */
42
43#define STATRICKCLASS GenotypeMini
44        PARAMPROCDEF(p_mutate);
45#undef STATRICKCLASS
46};
47
48#endif
Note: See TracBrowser for help on using the repository browser.