Global

Global Class #

File position: /EMOC/src/core/global.h and /EMOC/src/core/global.cpp

class Global(const char* algorithm_name, const char* problem_name, int population_num, int dec_num, int obj_num, int max_evaluation, int thread_id, int output_interval, int run_id = 0)

Global class represents an execution entity of EMOC which basically is a specified algorithm optimized a certain problem with pre-defined parameters. It holds all the relevant datas such as the pointer to algorithm, the pointer to problem, optimization settings and the population.

Parameter:
algorithm_name: const char*, default=None
    The name of the specified algorithm.

problem_name: const char*, default=None
    The name of the specified problem.

population_num: int, default=None
    The number of population size.

dec_num: int, default=None
    The number of the decision variables for problem settings.

obj_num: int, default=None
    The number of objective functions for problem settings.

max_evaluation: int, default=None
    The max evaluation times for current run.

thread_id: int, default=None
    The index of used thread. If there is no multi-thread enabled, 0 will be used.

output_interval: int, default=None
    The interval of population saving in generation.

run_id: int, default=0
    The index of current run. This is for multiple runs with same parameter settings, starting from 0.

Member variables:
(public) dec_num_: int
    The number of the decision variables. It is equal to the given dec_num.

(public) obj_num_: int
    The number of objectives. It is equal to the given obj_num.

(public) population_num_: int
    The number of population size. It is equal to the given population_num.

(public) max_evaluation_: int
    The max evaluation times. It is equal to the given max_evaluation.

(public) output_interval_: int
    The interval of population saving in generation. It is equal to the given output_interval.

(public) algorithm_name_: std::string
    The name of the specified algorithm. It is equal to the given algorithm_name.

(public) problem_name_: std::string
    The name of the specified problem. It is equal to the given problem_name.

(public) iteration_num_: int
    The iteration index. It is updated by the algorithm in it's optimization loop.

(public) current_evaluation_: int
    Current evaluation times. It is updated when the individual is evaluated.

(public) algorithm_: Algorithm*
    Pointer to the current run's algorithm object.

(public) problem_: Problem*
    Pointer to the current run's problem object.

(public) dec_lower_bound_: std::vector<double>
    Lower bound for each decision variables.

(public) dec_upper_bound_: std::vector<double>
    Upper bound for each decision variables.

(public) parent_population_: std::vector<Individual*>
    The parent population of current run.

(public) offspring_population_: std::vector<Individual*>
    The offspring population of current run.

(public) mixed_population_: std::vector<Individual*>
    The mixed population of current run. It is usually used to do some merge work.


Public Methods:

void Init()

Initialize the Global object such as setting the parameters’ value and allocating memories.

Parameter:
void
Returns:
void
void Start()

Start the optimization with current configuration.

Parameter:
void
Returns:
void
void InitializeIndividual(Individual* ind)

Initialize the given individual (i.e. set the decision variables with uniform random number in the decision bounds).

Parameter:
ind: Individual *, default=None
    The pointer to the individual which need to be initialized.
Returns:
void
void InitializePopulation(Individual** pop, int pop_num)

Initialize the given population.

Parameter:
pop: Individual**, default=None
    The population which need to be initialized. It's an array of Individual* where each Individual* is a pointer to a individual in the population.

pop_num: int, default=None
    The size of the given population.
Returns:
void