class BRKGA::BrkgaParams

Overview

Represents the BRKGA and IPR hyper-parameters. More…

#include <brkga_mp_ipr.hpp>

class BrkgaParams {
public:
    // fields

    unsigned population_size {0};
    double elite_percentage {0.0};
    double mutants_percentage {0.0};
    unsigned num_elite_parents {0};
    unsigned total_parents {0};
    BiasFunctionType bias_type {BiasFunctionType::CONSTANT};
    unsigned num_independent_populations {0};
    unsigned pr_number_pairs {0};
    double pr_minimum_distance {0.0};
    PathRelinking::Type pr_type {PathRelinking::Type::DIRECT};
    PathRelinking::Selection pr_selection {PathRelinking::Selection::BESTSOLUTION};
    PathRelinking::DistanceFunctionType pr_distance_function_type {PathRelinking::DistanceFunctionType::CUSTOM};
    std::shared_ptr<DistanceFunctionBase> pr_distance_function {};
    double alpha_block_size {0.0};
    double pr_percentage {0.0};
    unsigned num_exchange_individuals {0};
    ShakingType shaking_type {ShakingType::CHANGE};
    double shaking_intensity_lower_bound {0.0};
    double shaking_intensity_upper_bound {0.0};
    std::function<void(double lower_bound, double upper_bound, std::vector<std::shared_ptr<Population>>&populations, std::vector<std::pair<unsigned, unsigned>>&shaken)> custom_shaking {};
};

Detailed Documentation

Represents the BRKGA and IPR hyper-parameters.

Fields

unsigned population_size {0}

Number of elements in the population (> 0).

double elite_percentage {0.0}

Percentage of individuals to become the elite set (0.0, 1.0].

double mutants_percentage {0.0}

Percentage of mutants to be inserted in the population (0.0, 1.0].

unsigned num_elite_parents {0}

Number of elite parents for mating (> 0).

unsigned total_parents {0}

Number of total parents for mating (> 0).

BiasFunctionType bias_type {BiasFunctionType::CONSTANT}

Type of bias that will be used.

unsigned num_independent_populations {0}

Number of independent parallel populations (> 0).

unsigned pr_number_pairs {0}

Number of pairs of chromosomes to be tested to path relinking (> 0).

double pr_minimum_distance {0.0}

Mininum distance between chromosomes selected to path-relinking. Value range depends on the used distance function.

PathRelinking::Type pr_type {PathRelinking::Type::DIRECT}

Path relinking type.

PathRelinking::Selection pr_selection {PathRelinking::Selection::BESTSOLUTION}

Individual selection to path-relinking.

PathRelinking::DistanceFunctionType pr_distance_function_type {PathRelinking::DistanceFunctionType::CUSTOM}

Type of the distance function used on path-relinking.

std::shared_ptr<DistanceFunctionBase> pr_distance_function {}

The distance functor used on path-relinking.

double alpha_block_size {0.0}

Defines the block size based on the size of the population (> 0).

double pr_percentage {0.0}

Percentage / path size to be computed (0.0, 1.0].

unsigned num_exchange_individuals {0}

Number of elite chromosomes exchanged from each population (> 0).

ShakingType shaking_type {ShakingType::CHANGE}

Type of the shaking procedure.

double shaking_intensity_lower_bound {0.0}

Shaking intensity lower bound (0.0, 1.0].

For default CHANGE and SWAP procedures, this value is a percentage of the chromosome size. If shaking_intensity_lower_bound < shaking_intensity_upper_bound, we uniformly draw a random intensity between these bounds on each shaking call. If shaking_intensity_lower_bound = shaking_intensity_upper_bound, then a fixed intensity is always used. See BrkgaParams::shaking_intensity_upper_bound.

double shaking_intensity_upper_bound {0.0}

Shaking intensity upper bound (0.0, 1.0].

For default CHANGE and SWAP procedures, this value is a percentage of the chromosome size. If shaking_intensity_lower_bound < shaking_intensity_upper_bound, we uniformly draw a random intensity between these bounds on each shaking call. If shaking_intensity_lower_bound = shaking_intensity_upper_bound, then a fixed intensity is always used. See BrkgaParams::shaking_intensity_lower_bound.

std::function<void(double lower_bound, double upper_bound, std::vector<std::shared_ptr<Population>>&populations, std::vector<std::pair<unsigned, unsigned>>&shaken)> custom_shaking {}

This is the custom shaking procedure given by the user.

  • Parameters lower_bound and upper_bound is the shaking intensity bounds to be applied. Usually, the define a range where the intensity is sampled.

  • Parameter populations are the current BRKGA populations.

  • Parameter shaken is a list of <population index, chromosome index> pairs indicating which chromosomes were shaken on which population, so that they got re-decoded.

See BRKGA_MP_IPR::setShakingMethod() for details and examples.

Note

If shaken is empty, all chromosomes of all populations are re-decoded. This may be slow. Even if you intention is to do so, it is faster to populate shaken.

Warning

This procedure can be very intrusive since it must manipulate the population. So, the user must make sure that BRKGA invariants are kept, such as chromosome size and population size. Otherwise, the overall functionaly may be compromised.