Ignore:
Timestamp:
06/06/18 01:45:18 (6 years ago)
Author:
Maciej Komosinski
Message:

A more complete implementation of fB, fH, fL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fH/fH_general.cpp

    r780 r797  
     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
    15#include <string>
    26#include <limits>
     
    1317// Methods for loading handles
    1418
    15 const char *fH_part_names[PART_PROPS_COUNT] = { "dn", "fr", "ing", "as" };
    16 
    17 const char *fH_joint_names[JOINT_PROPS_COUNT] = { "stif", "rotstif", "stam" };
     19const char *fH_part_names[FH_PART_PROPS_COUNT] = { "dn", "fr", "ing", "as" };
     20
     21const char *fH_joint_names[FH_JOINT_PROPS_COUNT] = { "stif", "rotstif", "stam" };
    1822
    1923void fH_Handle::loadProperties(Param par)
     
    106110
    107111        Part p;
    108         for (int i = 0; i < PART_PROPS_COUNT; i++)
     112        for (int i = 0; i < FH_PART_PROPS_COUNT; i++)
    109113        {
    110114                stickmut.addProperty(&p.properties().getParamTab()[p.properties().findId(fH_part_names[i]) + p.properties().getGroupCount()], -1);
     
    112116
    113117        Joint j;
    114         for (int i = 0; i < JOINT_PROPS_COUNT; i++)
     118        for (int i = 0; i < FH_JOINT_PROPS_COUNT; i++)
    115119        {
    116120                stickmut.addProperty(&j.properties().getParamTab()[j.properties().findId(fH_joint_names[i]) + j.properties().getGroupCount()], -1);
     
    119123
    120124        Neuro n;
    121         neuronmut.addProperty(&n.properties().getParamTab()[n.properties().findId(PE_NEURO_DET) + n.properties().getGroupCount()], -1);
     125        neuronmut.addProperty(&n.properties().getParamTab()[n.properties().findId(FH_PE_NEURO_DET) + n.properties().getGroupCount()], -1);
    122126
    123127        Param tmp(f0_neuroconn_paramtab, NULL);
    124         connectionmut.addProperty(&tmp.getParamTab()[tmp.findId(PE_CONN_WEIGHT) + tmp.getGroupCount()], -1);
     128        connectionmut.addProperty(&tmp.getParamTab()[tmp.findId(FH_PE_CONN_WEIGHT) + tmp.getGroupCount()], -1);
    125129
    126130        stickparamtab = ParamObject::makeParamTab((ParamInterface *)&stickmut, 0, 0, stickmut.firstMutableIndex());
     
    343347{
    344348        Param par(tab, obj);
    345         double partprops[PART_PROPS_COUNT];
    346         for (int i = 0; i < PART_PROPS_COUNT; i++)
     349        double partprops[FH_PART_PROPS_COUNT];
     350        for (int i = 0; i < FH_PART_PROPS_COUNT; i++)
    347351        {
    348352                partprops[i] = par.getDouble(2 * getDimensions() + i);
     
    357361        {
    358362                par.select(child->obj);
    359                 for (int i = 0; i < PART_PROPS_COUNT; i++)
     363                for (int i = 0; i < FH_PART_PROPS_COUNT; i++)
    360364                {
    361365                        partprops[i] += par.getDouble(2 * getDimensions() + i);
     
    364368        }
    365369
    366         for (int i = 0; i < PART_PROPS_COUNT; i++)
     370        for (int i = 0; i < FH_PART_PROPS_COUNT; i++)
    367371        {
    368372                partprops[i] /= stickscount;
     
    522526                        msg += det + "\" does not exist";
    523527                        logMessage("fH_Builder", "developBrain", LOG_ERROR, msg.c_str());
     528                        delete currneu->neuron;
    524529                        return -1;
    525530                }
     
    601606                if (!beginneu)
    602607                {
    603                         logMessage("fH_Builder", "developBrain", LOG_WARN, "There are no available neurons with outputs, connection could not be established");
     608                        // due to often appearance of connection genes in fB encoding, this
     609                        // log message is commented
     610                        // logMessage("fH_Builder", "developBrain", LOG_DEBUG, "There are no available neurons with outputs, connection could not be established");
    604611                        continue;
    605612                }
     
    628635                if (!endneu)
    629636                {
    630                         logMessage("fH_Builder", "developBrain", LOG_WARN, "There are no available neurons with free inputs, connection could not be established");
     637                        // due to often appearance of connection genes in fB encoding, this
     638                        // log message is commented
     639                        // logMessage("fH_Builder", "developBrain", LOG_DEBUG, "There are no available neurons with free inputs, connection could not be established");
    631640                        continue;
    632641                }
Note: See TracChangeset for help on using the changeset viewer.