class BRKGA::KendallTauDistance

Overview

Kendall Tau distance between two vectors. More…

#include <brkga_mp_ipr.hpp>

class KendallTauDistance: public BRKGA::DistanceFunctionBase {
public:
    // methods

    virtual double distance(
        const Chromosome& vector1,
        const Chromosome& vector2
    );

    virtual bool affectSolution(
        const Chromosome::value_type key1,
        const Chromosome::value_type key2
    );

    virtual bool affectSolution(
        Chromosome::const_iterator v1_begin,
        Chromosome::const_iterator v2_begin,
        const std::size_t block_size
    );
};

Inherited Members

public:
    // methods

    virtual double distance(
        const Chromosome& v1,
        const Chromosome& v2
    ) = 0;

    virtual bool affectSolution(
        const Chromosome::value_type key1,
        const Chromosome::value_type key2
    ) = 0;

    virtual bool affectSolution(
        Chromosome::const_iterator v1_begin,
        Chromosome::const_iterator v2_begin,
        const std::size_t block_size
    ) = 0;

Detailed Documentation

Kendall Tau distance between two vectors.

This class is a functor that computes the Kendall Tau distance between two vectors. This version is not normalized.

Methods

virtual double distance(
    const Chromosome& vector1,
    const Chromosome& vector2
)

Computes the Kendall Tau distance between two vectors.

Parameters:

vector1

first vector

vector2

second vector

virtual bool affectSolution(
    const Chromosome::value_type key1,
    const Chromosome::value_type key2
)

Returns true if the changing of key1 by key2 affects the solution.

Parameters:

key1

the first key

key2

the second key

virtual bool affectSolution(
    Chromosome::const_iterator v1_begin,
    Chromosome::const_iterator v2_begin,
    const std::size_t block_size
)

Returns true if the changing of the blocks of keys v1 by the blocks of keys v2 affects the solution.

Todo This is the same implementation of Hamming. We need to figure out how to do it properly.

Parameters:

v1_begin

begin of the first blocks of keys

v2_begin

begin of the first blocks of keys

block_size

number of keys to be considered.