Changeset 821 for cpp/frams/genetics/fL


Ignore:
Timestamp:
10/10/18 01:13:05 (6 years ago)
Author:
Maciej Komosinski
Message:

Performance and stability improvements in fB, fH, and fL; improved parsing and math evaluations in fL

Location:
cpp/frams/genetics/fL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fL/fL_general.cpp

    r803 r821  
    488488                std::string message = "Error in parsing parameters at line:  " + std::to_string(linenumber);
    489489                logMessage("fL_Builder", "processLine", LOG_ERROR, message.c_str());
    490                 delete obj;
     490                if (obj != this) delete obj;
    491491                return begin + 1;
    492492        }
     
    13391339}
    13401340
    1341 int fL_Builder::countSticksInSequence(std::list<fL_Word *> sequence)
     1341int fL_Builder::countSticksInSequence(std::list<fL_Word *> *sequence)
    13421342{
    13431343        int count = 0;
    1344         for (std::list<fL_Word *>::iterator it = sequence.begin(); it != sequence.end(); it++)
     1344        for (std::list<fL_Word *>::iterator it = sequence->begin(); it != sequence->end(); it++)
    13451345        {
    13461346                if ((*it)->builtin && (*it)->name == "S")
  • cpp/frams/genetics/fL/fL_general.h

    r803 r821  
    482482         * @return number of sticks in sequence
    483483         */
    484         int countSticksInSequence(std::list<fL_Word *> sequence);
     484        int countSticksInSequence(std::list<fL_Word *> *sequence);
    485485
    486486        /**
  • cpp/frams/genetics/fL/fL_matheval.cpp

    r797 r821  
    116116        registerOperator(meqless, 1, Associativity::LEFT, "<=");
    117117        registerOperator(mequal, 1, Associativity::RIGHT, "=");
    118         registerOperator(mnotequal, 1, Associativity::RIGHT, "~");
     118        registerOperator(mnotequal, 1, Associativity::RIGHT, "<>");
    119119        registerOperator(mand, 0, Associativity::LEFT, "&");
    120120        registerOperator(mor, 0, Associativity::LEFT, "|");
  • cpp/frams/genetics/fL/fL_oper.cpp

    r803 r821  
    6464        }
    6565
    66         if (builder.countSticksInSequence(builder.genotype) == 0)
     66        if (builder.countSticksInSequence(&builder.genotype) == 0)
    6767        {
    6868                return GENOPER_OPFAIL;
     
    142142                        SString det;
    143143                        NeuroClass *cls = getRandomNeuroClass();
    144                         //we do not check if this class
    145144                        det = cls->getName();
    146145                        Geno_fH::mutateNeuronProperties(det);
     
    418417                        int ruleid = 0;
    419418                        std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, ruleid);
    420                         if (ruleid == -1 && creature->countSticksInSequence((*list)) == 1)
     419                        if (ruleid == -1 && creature->countSticksInSequence(list) == 1)
    421420                        {
    422421                                if (list->size() > 1)
     
    540539                        }
    541540                        int chgtype = roulette(chgoperations, FL_CHG_COUNT);
    542                         if (creature->countSticksInSequence((*list)) == 1 && tmp == -1) // if sequence is axiom
     541                        if (creature->countSticksInSequence(list) == 1 && tmp == -1) // if sequence is axiom
    543542                        {
    544543                                fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
Note: See TracChangeset for help on using the changeset viewer.