Ignore:
Timestamp:
12/10/20 22:33:22 (4 years ago)
Author:
oriona
Message:

Similarity measures code refactored. Distribution-based similarity measure added.

Location:
cpp/frams/model/similarity
Files:
13 added
2 moved

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/similarity/simil-match.cpp

    r1043 r1044  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include <assert.h>
    66#include <stdio.h>
    7 #include "simil_match.h"
     7#include "simil-match.h"
    88
    99/** Creates an empty matching for two objects of specified size.
     
    6363                @return Size of the object (in elements).
    6464 */
    65 int SimilMatching::GetObjectSize(int Obj)
     65int SimilMatching::getObjectSize(int Obj)
    6666{
    6767        // check parameter
     
    8181
    8282 */
    83 void SimilMatching::Match(int Obj0, int Index0, int Obj1, int Index1)
     83void SimilMatching::match(int Obj0, int Index0, int Obj1, int Index1)
    8484{
    8585        // check parameters of object 0
     
    103103                @return true if the given element is matched, false otherwise.
    104104 */
    105 bool SimilMatching::IsMatched(int Obj, int Index)
     105bool SimilMatching::isMatched(int Obj, int Index)
    106106{
    107107        // check parameters
     
    128128                (check IsMatched() before using GetMatchedIndex()).
    129129 */
    130 int SimilMatching::GetMatchedIndex(int Obj, int Index)
     130int SimilMatching::getMatchedIndex(int Obj, int Index)
    131131{
    132132        // check parameters
     
    142142                @return true if matching is full, false otherwise.
    143143 */
    144 bool SimilMatching::IsFull()
     144bool SimilMatching::isFull()
    145145{
    146146        // assume that the matching is full
     
    177177        @return true if matching is empty, otherwise - false.
    178178 */
    179 bool SimilMatching::IsEmpty()
     179bool SimilMatching::isEmpty()
    180180{
    181181        // result - assume that matching is empty
     
    201201/** Makes the matching completely empty. After a call to this method IsEmpty() should return true.
    202202 */
    203 void SimilMatching::Empty()
     203void SimilMatching::empty()
    204204{
    205205        for (int iObj = 0; iObj < 2; iObj++) // a counter of objects
     
    215215
    216216        // the exit condition
    217         assert(IsEmpty() == true);
     217        assert(isEmpty() == true);
    218218}
    219219
    220220/** Prints the current state of the matching
    221221 */
    222 void SimilMatching::PrintMatching()
     222void SimilMatching::printMatching()
    223223{
    224224        int nBigger;
     
    249249                for (unsigned int i = 0; i < m_apvMatched[nObj]->size(); i++)
    250250                {
    251                         if (IsMatched(nObj, i))
     251                        if (isMatched(nObj, i))
    252252                        {
    253253                                // if the element is matched - print the index
    254                                 printf("%2d ", GetMatchedIndex(nObj, i));
     254                                printf("%2d ", getMatchedIndex(nObj, i));
    255255                        }
    256256                        else
  • cpp/frams/model/similarity/simil-match.h

    r1043 r1044  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    2626        SimilMatching(const SimilMatching &Source);
    2727        ~SimilMatching();
    28         int GetObjectSize(int Obj);
    29         void Match(int Obj0, int Index0, int Obj1, int Index1);
    30         bool IsMatched(int Obj, int Index);
    31         int GetMatchedIndex(int Obj, int index);
    32         bool IsFull();
    33         bool IsEmpty();
    34         void Empty();
    35         void PrintMatching();
     28        int getObjectSize(int Obj);
     29        void match(int Obj0, int Index0, int Obj1, int Index1);
     30        bool isMatched(int Obj, int Index);
     31        int getMatchedIndex(int Obj, int index);
     32        bool isFull();
     33        bool isEmpty();
     34        void empty();
     35        void printMatching();
    3636};
    3737
Note: See TracChangeset for help on using the changeset viewer.