src.environment.problem.MTO.WCCI2020.wcci2020_numpy

Module Contents

Classes

WCCI2020_Numpy_Problem

WCCI2020_Numpy_Problem

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

Sphere

Ackley

Griewank

Rastrigin

Rosenbrock

Weierstrass

Schwefel

API

class src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_Numpy_Problem(dim, shift, rotate, bias)[source]

Bases: src.environment.problem.basic_problem.Basic_Problem

WCCI2020_Numpy_Problem

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

Introduction

WCCI2020 proposes 10 multi-task benchmark problems to represent a wider range of multi-task optimization problems.

Original Paper

None

Official Implementation

WCCI2020

License

None

Problem Suite Composition

The WCCI2020 problem suite contains a total of 10 benchmark problems, each consisting of 50 different basic functions with unique transformations(shifts and rotations). For each benchmark problem, fifty basic functions are added sequentially and cyclically to constitute the problem. These ten benchmark problems are classified according to the specific combination of different types of basic functions: P1: Shpere P2: Rosenbrock P3: Rastrigin P4: Shpere, Rosenbrock, Ackley P5: Rastrigin, Griewank, Weierstrass P6: Rosenbrock, Griewank, Schwefel P7: Rastrigin, Ackley, Weierstrass P8: Rosenbrock, Rastrigin, Ackley, Griewank, Weierstrass P9: Rosenbrock, Rastrigin, Ackley, Griewank, Weierstrass, Schwefel P10:Rastrigin, Ackley, Griewank, Weierstrass, Schwefel

Methods:

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

  • func(x: numpy.ndarray) -> numpy.ndarray: Abstract method to define the objective function. Must be implemented in subclasses.

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

  • sr_func(x: numpy.ndarray, shift: numpy.ndarray, rotate: numpy.ndarray) -> numpy.ndarray: Applies shift and rotation transformations to the input.

  • eval(x: numpy.ndarray) -> numpy.ndarray: Evaluates the objective function for both individuals and populations in the MTO framework.

Raises:

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

Initialization

Introduction

Initializes the class WCCI2020_Numpy_Problem.

Args:

  • dim (int): Dimensionality of the problem.

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

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

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

Attributes:

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

  • dim (int): Dimensionality of the problem.

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

  • rotate (numpy.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 (numpy.ndarray): Optimal solution for the problem.

  • optimum (float): Objective value of 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.WCCI2020.wcci2020_numpy.Sphere(dim, shift, rotate, bias=0)[source]

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “S” representing the object.

class src.environment.problem.MTO.WCCI2020.wcci2020_numpy.Ackley(dim, shift, rotate, bias=0)[source]

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “A” representing the object.

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

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “G” representing the object.

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

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “R” representing the object.

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

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “Ro” representing the object.

class src.environment.problem.MTO.WCCI2020.wcci2020_numpy.Weierstrass(dim, shift, rotate, bias=0)[source]

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “W” representing the object.

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

Bases: src.environment.problem.MTO.WCCI2020.wcci2020_numpy.WCCI2020_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 “Sc” representing the object.