Changeset 1257


Ignore:
Timestamp:
06/22/23 03:47:26 (11 months ago)
Author:
Maciej Komosinski
Message:
  • fH: don't mutate non-standard properties: assimilation, ingestion, stamina, density
  • fH: allow relative mutation probabilities in the range 0..100, like in other genetic formats
Location:
cpp/frams/genetics/fH
Files:
3 edited

Legend:

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

    r973 r1257  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2023  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1616// Methods for loading handles
    1717
    18 const char *fH_part_names[FH_PART_PROPS_COUNT] = { "dn", "fr", "ing", "as" };
    19 
    20 const char *fH_joint_names[FH_JOINT_PROPS_COUNT] = { "stif", "rotstif", "stam" };
     18const char *fH_part_names[FH_PART_PROPS_COUNT] = { "fr" }; // , "dn", "ing", "as" };
     19
     20const char *fH_joint_names[FH_JOINT_PROPS_COUNT] = { "stif", "rotstif" }; //, "stam" };
    2121
    2222void fH_Handle::loadProperties(Param par)
     
    376376        model->addPart(newpart);
    377377
    378         newpart->density = partprops[0];
    379         newpart->friction = partprops[1];
    380         newpart->ingest = partprops[2];
    381         newpart->assim = partprops[3];
     378        newpart->friction = partprops[0]; //Macko 2023-06: TODO partprops[0] is different from par.getDoubleById("fr"); (and par.getDoubleById() is used in createJoint() below, investigate why this difference and whether hardcoded references to fields like here could be avoided? Only use fH_part_names if possible.)
     379        //newpart->density = partprops[1];
     380        //newpart->ingest = partprops[2];
     381        //newpart->assim = partprops[3];
    382382
    383383        if (createmapping) newpart->addMapping(ranges);
     
    399399        newjoint->stif = par.getDoubleById("stif");
    400400        newjoint->rotstif = par.getDoubleById("rotstif");
    401         newjoint->stamina = par.getDoubleById("stam");
     401        //newjoint->stamina = par.getDoubleById("stam");
    402402        newjoint->attachToParts(firstpart, secondpart);
    403403        if (createmapping) newjoint->addMapping(IRange(begin, end));
  • cpp/frams/genetics/fH/fH_general.h

    r1167 r1257  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2023  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1818#define HANDLE_VECTOR_TYPE "f -1.0 1.0 0.0" ///<Vector values type definition
    1919#define STICKH_LENGTH_TYPE "f 0.001 1.999 1.0" ///<Length of stick handle. Minimum should not be equal to 0, because calculating direction of next part from current stick with length 0 would be impossible
    20 #define FH_PART_PROPS_COUNT   4 ///<Count of part properties
    21 #define FH_JOINT_PROPS_COUNT  3 ///<Count of joint properties
     20#define FH_PART_PROPS_COUNT   1 ///<Count of part properties
     21#define FH_JOINT_PROPS_COUNT  2 ///<Count of joint properties
    2222#define FH_PE_NEURO_DET       "d" ///<Id of details type definition in f0_neuro_paramtab
    2323#define FH_PE_CONN_WEIGHT     "w" ///<Id of weight type definition in f0_neuroconn_paramtab
     
    118118 *  - double stif -  joint property of a stick representing stiffness
    119119 *  - double rotstif -  joint property of a stick representing rotation stiffness
    120  *  - double stamina -  joint property of a stick representing stamina
    121  *  - double density -  parts property of a stick representing density
     120 *  //- double stamina -  joint property of a stick representing stamina
    122121 *  - double friction -  parts property of a stick representing friction
    123  *  - double ingest -  parts property of a stick representing ingestion
    124  *  - double assimilation -  parts property of a stick representing assimilation
     122 *  //- double density -  parts property of a stick representing density
     123 *  //- double ingest -  parts property of a stick representing ingestion
     124 *  //- double assimilation -  parts property of a stick representing assimilation
    125125 *  - double length -  length of a stick
    126126 */
  • cpp/frams/genetics/fH/fH_oper.cpp

    r1215 r1257  
    1414{
    1515        { "Genetics: fH", 1, FH_OPCOUNT + FH_ADD_OPCOUNT, },
    16         { "fH_mut_addition", 0, 0, "Add element", "f 0 1 0.3", FIELD(operations[FH_ADD]), "Probability of adding new element to genotype", },
    17         { "fH_mut_add_joint", 0, 0, " - add joint", "f 0 1 0.33", FIELD(addoperations[FH_ADD_STICK]), "Probability of adding new stick handle", },
    18         { "fH_mut_add_neuron", 0, 0, " - add neuron", "f 0 1 0.33", FIELD(addoperations[FH_ADD_NEURO]), "Probability of adding new neuron handle", },
    19         { "fH_mut_add_connection", 0, 0, " - add neural connection", "f 0 1 0.33", FIELD(addoperations[FH_ADD_CONN]), "Probability of adding new neuron connection handle", },
    20         { "fH_mut_deletion", 0, 0, "Delete element", "f 0 1 0.1", FIELD(operations[FH_DEL]), "Probability of removing element from genotype", },
    21         { "fH_mut_handle", 0, 0, "Modify vectors of handles", "f 0 1 0.3", FIELD(operations[FH_HANDLE]), "Probability of changing values in vectors of handle", },
    22         { "fH_mut_property", 0, 0, "Modify properties of handles", "f 0 1 0.3", FIELD(operations[FH_PROP]), "Probability of changing properties of handles", },
     16        { "fH_mut_addition", 0, 0, "Add element", "f 0 100 30", FIELD(operations[FH_ADD]), "Probability of adding new element to genotype", },
     17        { "fH_mut_add_joint", 0, 0, " - add joint", "f 0 100 33", FIELD(addoperations[FH_ADD_STICK]), "Probability of adding new stick handle", },
     18        { "fH_mut_add_neuron", 0, 0, " - add neuron", "f 0 100 33", FIELD(addoperations[FH_ADD_NEURO]), "Probability of adding new neuron handle", },
     19        { "fH_mut_add_connection", 0, 0, " - add neural connection", "f 0 100 33", FIELD(addoperations[FH_ADD_CONN]), "Probability of adding new neuron connection handle", },
     20        { "fH_mut_deletion", 0, 0, "Delete element", "f 0 100 10", FIELD(operations[FH_DEL]), "Probability of removing element from genotype", },
     21        { "fH_mut_handle", 0, 0, "Modify vectors of handles", "f 0 100 30", FIELD(operations[FH_HANDLE]), "Probability of changing values in vectors of handle", },
     22        { "fH_mut_property", 0, 0, "Modify properties of handles", "f 0 100 30", FIELD(operations[FH_PROP]), "Probability of changing properties of handles", },
    2323        { 0, },
    2424};
Note: See TracChangeset for help on using the changeset viewer.