Ignore:
Timestamp:
02/15/18 00:42:07 (6 years ago)
Author:
Maciej Komosinski
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/genotypeloader.h

    r635 r732  
    88#include <frams/util/sstring.h>
    99#include <frams/param/multiparamload.h>
    10 
    11 /** Defines the association between "org:" object (found in genotype files)
    12         and the MiniGenotype fields. MiniGenotypeLoader uses this definition
    13         but you can also use it to make MultiParamLoader load genotype
    14         */
    15 extern ParamEntry minigenotype_paramtab[];
    16 
    17 /** Helper class, mostly useful with MultiParamLoader
    18         or its specialized version: MiniGenotypeLoader.
    19         MiniGenotype stores the subset of Genotype fields (the ones normally saved in .gen files)
    20         */
    21 class MiniGenotype
    22 {
    23 public:
    24         SString name, genotype, info, uid;
    25         double info_timestamp;
    26         SString info_author, info_email;
    27         paInt info_author_ispublic, info_email_ispublic, info_origin;
    28         SString info_how_created, info_performance;
    29         double energy0, lifespan, velocity, distance, vertvel, vertpos;
    30         paInt numparts, numjoints, numneurons, numconnections, ordnumber, generation, instances, is_valid;
    31         ExtValue user1, user2, user3;
    32         void clear() { Param p(minigenotype_paramtab, this); p.setDefault(); }
    33 };
     10#include "genotypemini.h"
    3411
    3512/** In most simple cases this is the class you would use to load a series of genotypes from
     
    4825        methods, or you can use it as a guide for creating your own specialized class.
    4926        */
    50 class MiniGenotypeLoader : public MultiParamLoader
     27class GenotypeMiniLoader : public MultiParamLoader
    5128{
    52         MiniGenotype genotype_object;
     29        GenotypeMini genotype_object;
    5330        Param genotype_param;
    5431        bool initialized;
    5532        void init();
    5633public:
    57         MiniGenotypeLoader();
    58         MiniGenotypeLoader(VirtFILE *f);
    59         MiniGenotypeLoader(const char* filename);
     34        GenotypeMiniLoader();
     35        GenotypeMiniLoader(VirtFILE *f);
     36        GenotypeMiniLoader(const char* filename);
    6037
    6138        /** @returns genotype object if one was loaded or NULL otherwise.
    6239
    63                 Returned MiniGenotype pointer always references the the same object (MiniGenotypeLoader::genotype_object)
     40                Returned GenotypeMini pointer always references the the same object (GenotypeMiniLoader::genotype_object)
    6441                which means you may need to copy the data from it before calling loadNextGenotype() again.
    65                 In the default configuration (simple MiniGenotypeLoader) NULL is always final and should be used
     42                In the default configuration (simple GenotypeMiniLoader) NULL is always final and should be used
    6643                to finish processing.
    6744
     
    7047                MultiParamLoader::finished() and other methods to determine the real cause of NULL.
    7148                */
    72         MiniGenotype* loadNextGenotype();
     49        GenotypeMini* loadNextGenotype();
    7350};
    7451
Note: See TracChangeset for help on using the changeset viewer.