Ignore:
Timestamp:
05/02/19 23:50:27 (6 years ago)
Author:
Maciej Komosinski
Message:

Added another, improved way of calculating dissimilarity of two creatures/models. Details and comparisons in https://doi.org/10.1007/978-3-030-16692-2_8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/similarity/simil_model.h

    r817 r869  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    99#include "frams/genetics/geno.h"
    1010#include "frams/model/model.h"
    11 #include "frams/util/3d.h"
    1211#include "simil_match.h"
    1312
     
    2726 * Marek Kubiak (concept, implementation)
    2827 * Maciej Komosinski (concept, Framsticks interface)
    29  * Agnieszka Mensfelt (refactoring)
     28 * Agnieszka Mensfelt (refactoring, improvements)
    3029 */
    3130class ModelSimil
     
    3433        ModelSimil();
    3534        virtual ~ModelSimil();
    36         double EvaluateDistance(const Geno *G0, const Geno *G1);
     35        double EvaluateDistance(const Geno *G0, const Geno *G1); //chooses greedy or hungarian
     36        double EvaluateDistanceGreedy(const Geno *G0, const Geno *G1);
     37        double EvaluateDistanceHungarian(const Geno *G0, const Geno *G1);
    3738
    3839        static int CompareDegrees(const void *pElem1, const void *pElem2);
     40        static int CompareFuzzyDegrees(const void *pElem1, const void *pElem2);
    3941        static int CompareConnsNo(const void *pElem1, const void *pElem2);
    4042        static int GetNOFactors();
     
    4850        int MatchPartsGeometry();
    4951        void ComputeMatching();
     52        void FillPartsDistances(double *&dist, int bigger, int smaller, bool geo);
    5053        void _PrintPartsMatching();
    5154        void SaveIntermediateFiles();
    5255
    53         static int CheckPartsIdentity(Part *P1, Part *P2);
     56        static int CheckPartsIdentity(Part *P1, Part *P2); //TODO exists?
    5457        int SortPartInfoTables();
    5558        int CountPartNeurons();
     
    5861        int CountPartDegrees();
    5962
    60         int SortPartInfoFuzzy();
    6163        void CountFuzzyNeighb();
    6264        void SortFuzzyNeighb();
    6365        void GetNeighbIndexes(int mod, int partInd, std::vector<int> &indexes);
    64         void CheckFuzzyIdentity();
     66        void FuzzyOrder();
    6567
    6668        int CreatePartInfoTables();
     
    6870        void _PrintArray(int *array, int base, int size);
    6971        void _PrintNeighbourhood(int i);
     72        void _PrintFuzzyNeighbourhood(int i);
    7073        void _PrintArrayDouble(double *array, int base, int size);
    7174        int CountPartsDistance();
     
    7376
    7477public:
     78        /// Currently selected matching algorithm. Allowed values: 0 (more exact, slower), 1 (more greedy, faster). Details in https://doi.org/10.1007/978-3-030-16692-2_8
     79        /// @sa EvaluateDistance
     80        int matching_method;
     81
    7582        /// Table of weights for weighted distance function.
    7683        /// Weights are for factors in the following order:
     
    8895        int fuzzyDepth;
    8996        int isFuzzy;
    90        
     97
    9198        //For wMDS = 1 weighted MDS with vertex degrees as weights is used for the alignment.
    9299        int wMDS;
     100
     101        //For saveMatching = 1 the best matching found will be saved.
     102        int saveMatching;
    93103
    94104        /// Interface to local parameters
     
    181191};
    182192
    183 
    184193#endif
Note: See TracChangeset for help on using the changeset viewer.