src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy

Module Contents

Classes

CEC2017MTO_Numpy_Problem

CEC2017MTO_Numpy_Problem

A Numpy-based implementation of base class for defining basic functions in CEC2017 Multitask Optimization(MTO) benchmark problems.

Sphere

Ackley

Griewank

Rastrigin

Rosenbrock

Weierstrass

Schwefel

API

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem(dim, shift, rotate, bias)[source]

Bases: src.environment.problem.basic_problem.Basic_Problem

CEC2017MTO_Numpy_Problem

A Numpy-based implementation of base class for defining basic functions in CEC2017 Multitask Optimization(MTO) benchmark problems.

Introduction

CEC2017MTO proposes 9 multi-task benchmark problems to represent a wider range of multi-task optimization problems.

Original Paper

Evolutionary Multitasking for Single-objective Continuous Optimization: Benchmark Problems, Performance Metric, and Bseline Results.”

Official Implementation

CEC2017MTO

License

None

Problem Suite Composition

The CEC2017MTO problem suite contains a total of 9 benchmark problems, each consisting of two basic functions. These nine benchmark problems are classified according to the degree of intersection and the inter-task similarity between the two constitutive functions: P1. Complete intersection and high similarity(CI+HS) P2. Complete intersection and medium similarity(CI+MS)
P3. Complete intersection and low similarity(CI+LS) P4. Partial intersection and high similarity(PI+HS) P5. Partial intersection and medium similarity(PI+MS)
P6. Partial intersection and low similarity(PI+LS) P7. No intersection and high similarity(NI+HS) P8. No intersection and medium similarity(NI+MS) P9. No intersection and low similarity(NI+LS)

Methods:

  • get_optimal() -> np.ndarray: Returns the optimal solution for the problem.

  • func(x: np.ndarray) -> float: Abstract method to compute the objective function value for a given solution. Must be implemented in subclasses.

  • decode(x: np.ndarray) -> np.ndarray: Decodes a solution from the normalized space [0, 1] to the problem’s search space.

  • sr_func(x: np.ndarray, shift: np.ndarray, rotate: np.ndarray) -> np.ndarray: Applies shift and rotation transformations to a solution.

  • eval(x: np.ndarray) -> float or np.ndarray: Evaluates the objective function for a single solution or a population of solutions. Supports both individual and population-based evaluations.

Raises:

  • NotImplementedError: Raised if the func method is not implemented in a subclass.

Initialization

Introduction

Initializes the class CEC2017MTO_Numpy_Problem.

Args:

  • dim (int): Dimensionality of the problem.

  • shift (np.ndarray or None): Shift vector for the problem. If None, a zero vector is used.

  • rotate (np.ndarray or None): Rotation matrix for the problem. If None, no rotation is applied.

  • bias (float): Bias value added to the objective function.

Attributes:

  • T1 (float): Accumulated time (in milliseconds) for evaluating solutions.

  • dim (int): Dimensionality of the problem.

  • shift (np.ndarray): Shift vector for the problem.

  • rotate (np.ndarray): Rotation matrix for the problem.

  • bias (float): Bias value added to the objective function.

  • lb (float): Lower bound of the search space.

  • ub (float): Upper bound of the search space.

  • FES (int): Function evaluation count.

  • opt (np.ndarray): Optimal solution for the problem.

  • optimum (float): Objective function value at the optimal solution.

get_optimal()[source]

Introduction

Returns the optimal solution for the problem.

Returns:

  • numpy.ndarray: The optimal solution of the problem.

abstractmethod func(x)[source]

Introduction

Abstract method to define the problem’s objective function. Must be implemented in subclasses.

Args:

  • x (numpy.ndarray): The solution of the problem.

decode(x)[source]

Introduction

Decodes a solution from the normalized space [0, 1] to the problem’s actual search space.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The decoded solution of the problem.

sr_func(x, shift, rotate)[source]

Introduction

Applies shift and rotation transformations to the input solution.

Args:

  • x (numpy.ndarray): The solution of the problem.

  • shift (numpy.ndarray): The shift vector applied to the problem.

  • rotate (numpy.ndarray): The rotation matrix applied to the problem.

Returns:

  • numpy.ndarray: The solution being transformed by shift and rotatation.

eval(x)[source]

Introduction

A specific version of func() with adaptation to evaluate both individual and population in MTO.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Sphere(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Sphere’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Sphere” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Ackley(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Ackley’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Ackley” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Griewank(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Griewank’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Griewank” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Rastrigin(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Rastrigin’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Rastrigin” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Rosenbrock(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Rosenbrock’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Rosenbrock” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Weierstrass(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Weierstrass’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Weierstrass” representing the object.

class src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.Schwefel(dim, shift=None, rotate=None, bias=0)[source]

Bases: src.environment.problem.MTO.CEC2017MTO.cec2017mto_numpy.CEC2017MTO_Numpy_Problem

func(x)[source]

Introduction

The specific implementation of the Schwefel’s objective function.

Args:

  • x (numpy.ndarray): The solution of the problem.

Returns:

  • numpy.ndarray: The fitness value of the solution.

__str__()[source]

Returns a string representation of the object.

Returns:

  • str: The string “Schwefel” representing the object.