src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy¶
Module Contents¶
Classes¶
CEC2013_MMO_Numpy_Problem¶A base class for CEC2013 Multi-Modal Optimization (MMO) problems implemented in NumPy. |
|
Introduction:¶The abstract class for problems with composition functions. |
|
Introduction:¶The first test function: Five-Uneven-Peak Trap. |
|
Introduction:¶The second test function: equal_maxima. |
|
Introduction:¶The third test function: uneven_decreasing_maxima |
|
Introduction:¶The 4th test function: himmelblau |
|
Introduction:¶The 5th test function: six_hump_camel_back |
|
Introduction:¶The 6th test function: shubert |
|
Introduction:¶The 7th test function: vincent |
|
Introduction:¶The 8th test function: modified_rastrigin_all |
|
Introduction:¶The 9th test function: Composition function 1. |
|
Introduction:¶The 10th test function: Composition function 2. |
|
Introduction:¶The 11th test function: Composition function 3. |
|
Introduction:¶The 12th test function: Composition function 4. |
Functions¶
Introduction:¶Sphere function, one of basic functions for the composition function. |
|
Introduction:¶Rastrigin’s function, one of basic functions for the composition function. |
|
Introduction:¶Grienwank’s function, one of basic functions for the composition function. |
|
Introduction:¶Weierstrass function, one of basic functions for the composition function. |
|
Introduction:¶Auxiliary function for FEF8F2. |
|
Introduction:¶Expanded Griewank’s plus Rosenbrock’s function (EF8F2), one of basic functions for the composition function. |
Data¶
API¶
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_Problem(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.basic_problem.Basic_ProblemCEC2013_MMO_Numpy_Problem¶
A base class for CEC2013 Multi-Modal Optimization (MMO) problems implemented in NumPy.
Introduction¶
CEC2013 MMO benchmark puts together 20 multimodal problems (including several identical functions with different dimension sizes), with different characteristics, for evaluating niching algorithms.
Original Paper¶
Official Implementation¶
License¶
Simplified BSD License
Problem Suite Composition¶
The CEC2013 MMO problem suite contains 20 optimization problems, each with specific characteristics such as dimensionality, bounds, and multimodal properties. These problems are categorized into different difficulty levels (
easy,difficult, andall) and can be used for benchmarking optimization algorithms.Initialization
Introduction:¶
Initialize the cec2013 mmo problem with the settings.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
Attributes:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.FES(int): Current number of function evaluations performed.optimum(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- abstractmethod func(x)[source]¶
Introduction:¶
Abstract method to evaluate the fitness of a solution
x. Must be implemented in a subclass.Args:¶
x(np.ndarray) : A solution for evaluation.
Raises:¶
NotImplementedError: Raised when thefuncmethod is called without being implemented in a subclass.
- how_many_goptima(pop, accuracy)[source]¶
Introduction:¶
Determines the number of global optima found in a given population within a specified accuracy.
Args:¶
pop(np.ndarray) : A group of solutions for the calculation of found global optima.accuracy(float) : The accuracy used to determin if a solution can be regarded as a satisfied global optimum.
Returns:¶
count(int): The number of global optima found within the specified accuracy.seeds(np.ndarray): The representive solutions for found global optima.
- __find_seeds_indices(sorted_pop, radius)[source]¶
Introduction:¶
Identifies seed points in a sorted population based on a given radius.
Args:¶
sorted_pop(np.ndarray): A group of solutions for indentifition.radius(float) : Radius used to determine whether two solutions belong to different peaks.
Returns:¶
seeds_idx(list of int) : The index of the solutions regarded as the seed of peaks.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CFunction(dim, lb, ub, fopt, rho, nopt, maxfes, nofunc)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The abstract class for problems with composition functions.
Attributes:¶
__nofunc_(int) : The number of basic functions.__C_(float) : A predefined constant.__lambda_(np.ndarray) : A parameter used to stretch or compress each basic function.__sigma_(np.ndarray) : A parameter to control the coverage range of each basic function, with small values to produce a narrow coverage range.__bias_(np.ndarray) : Defines a function value bias for each basic function and denotes which optimum is the global optimum__O_(np.ndarray) : The new shifted optimum of each basic function.__M_(list) : The linear transformation (rotation) matrix of each basic problem.__weight_(np.ndarray) : the corresponding weight of each basic function.__fi_(np.ndarray) : The results of evaluation of basic functions.__z_(np.ndarray) : The result after shifting, ratation and stretch/compress.__f_bias_(int) : A function value bias for the constructed composition function.__fmaxi_(np.ndarray) : The maximal value of basic functions.__function_(dict) : The list of basic functions.
Initialization
Introduction:¶
Initialize a problem with a composition function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.nofunc(int): the number of basic functions
Attributes:¶
__nofunc_(int): The number of basic functions
- abstractmethod func(x)[source]¶
Introduction:¶
Abstract method to evaluate the fitness of a solution
x. Must be implemented in a subclass.Args:¶
x(np.ndarray) : A solution for evaluation.
Raises:¶
NotImplementedError: Raised when thefuncmethod is called without being implemented in a subclass.
- __evaluate_inner_(x)[source]¶
Introduction:¶
Evaluate the given solutions with the composition function.
Args:¶
x(np.ndarray) : A group of solutions for evaluation.
Return:¶
np.array: The result of evaluation.
- __calculate_weights(x)[source]¶
Introduction:¶
Calculate the weights of basic functions.
Args:¶
x(np.ndarray) : A group of solutions for evaluation.
- __calculate_fmaxi()[source]¶
Introduction:¶
Calculate the maximal values of each basic function.
Args:¶
x(np.ndarray) : A group of solutions for evaluation.
- __transform_to_z_noshift(x, index)[source]¶
Introduction:¶
Transform the global optima without shfit.
Args:¶
x(np.ndarray) : A solution for evaluation.index(int): the index of the corresponding basic function.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.FSphere(x)[source]¶
Introduction:¶
Sphere function, one of basic functions for the composition function.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.FRastrigin(x)[source]¶
Introduction:¶
Rastrigin’s function, one of basic functions for the composition function.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.FGrienwank(x)[source]¶
Introduction:¶
Grienwank’s function, one of basic functions for the composition function.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.FWeierstrass(x)[source]¶
Introduction:¶
Weierstrass function, one of basic functions for the composition function.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F8F2(x)[source]¶
Introduction:¶
Auxiliary function for FEF8F2.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.FEF8F2(x)[source]¶
Introduction:¶
Expanded Griewank’s plus Rosenbrock’s function (EF8F2), one of basic functions for the composition function.
Args:¶
x(np.ndarray) : A batch of solutions for evaluation.
Returns:¶
np.ndarray: The evaluation results.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F1(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The first test function: Five-Uneven-Peak Trap.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F2(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The second test function: equal_maxima.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F3(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The third test function: uneven_decreasing_maxima
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F4(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The 4th test function: himmelblau
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F5(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The 5th test function: six_hump_camel_back
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F6(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The 6th test function: shubert
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F7(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The 7th test function: vincent
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F8(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CEC2013MMO_Numpy_ProblemIntroduction:¶
The 8th test function: modified_rastrigin_all
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F9(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CFunctionIntroduction:¶
The 9th test function: Composition function 1.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
Attibutes:¶
_CFunction__sigma_(np.ndarray): The _sigma attribute in the father class ‘CFunction’._CFunction__bias_(np.ndarray): The _bias attribute in the father class ‘CFunction’._CFunction__weight_(np.ndarray): The _weight attribute in the father class ‘CFunction’._CFunction__lambda_(np.ndarray): The _lambda attribute in the father class ‘CFunction’._CFunction__O_(np.ndarray): The _O attribute in the father class ‘CFunction’._CFunction__M_(list): The _M attribute in the father class ‘CFunction’._CFunction__function_(dict): The _function attribute in the father class ‘CFunction’.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F10(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CFunctionIntroduction:¶
The 10th test function: Composition function 2.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
Attibutes:¶
_CFunction__sigma_(np.ndarray): The _sigma attribute in the father class ‘CFunction’._CFunction__bias_(np.ndarray): The _bias attribute in the father class ‘CFunction’._CFunction__weight_(np.ndarray): The _weight attribute in the father class ‘CFunction’._CFunction__lambda_(np.ndarray): The _lambda attribute in the father class ‘CFunction’._CFunction__O_(np.ndarray): The _O attribute in the father class ‘CFunction’._CFunction__M_(list): The _M attribute in the father class ‘CFunction’._CFunction__function_(dict): The _function attribute in the father class ‘CFunction’.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F11(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CFunctionIntroduction:¶
The 11th test function: Composition function 3.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
Attibutes:¶
_CFunction__sigma_(np.ndarray): The _sigma attribute in the father class ‘CFunction’._CFunction__bias_(np.ndarray): The _bias attribute in the father class ‘CFunction’._CFunction__weight_(np.ndarray): The _weight attribute in the father class ‘CFunction’._CFunction__lambda_(np.ndarray): The _lambda attribute in the father class ‘CFunction’._CFunction__O_(np.ndarray): The _O attribute in the father class ‘CFunction’._CFunction__M_(list): The _M attribute in the father class ‘CFunction’._CFunction__function_(dict): The _function attribute in the father class ‘CFunction’.
- class src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.F12(dim, lb, ub, fopt, rho, nopt, maxfes)[source]¶
Bases:
src.environment.problem.MMO.CEC2013MMO.cec2013mmo_numpy.CFunctionIntroduction:¶
The 12th test function: Composition function 4.
Initialization
Introduction:¶
Initialization the test function.
Args:¶
dim(int): Dimensionality of the problem.lb(float): Lower bound of the search space.ub(float): Upper bound of the search space.fopt(float): The optimal fitness value for the problem.rho(float): Radius used to determine proximity for seed identification.nopt(int): Number of global optima in the problem.maxfes(int): Maximum number of function evaluations allowed.
Attibutes:¶
_CFunction__sigma_(np.ndarray): The _sigma attribute in the father class ‘CFunction’._CFunction__bias_(np.ndarray): The _bias attribute in the father class ‘CFunction’._CFunction__weight_(np.ndarray): The _weight attribute in the father class ‘CFunction’._CFunction__lambda_(np.ndarray): The _lambda attribute in the father class ‘CFunction’._CFunction__O_(np.ndarray): The _O attribute in the father class ‘CFunction’._CFunction__M_(list): The _M attribute in the father class ‘CFunction’._CFunction__function_(dict): The _function attribute in the father class ‘CFunction’.