src.environment.problem.MTO.WCCI2020.wcci2020_dataset

Problem Difficulty Classification

Difficulty Mode

Training Set

Testing Set

easy

0, 1, 2, 3, 4, 5

6, 7, 8, 9

difficult

6, 7, 8, 9

0, 1, 2, 3, 4, 5

Note: When difficulty is ‘all’, both training and testing sets contain all problems (0-9).

Module Contents

Classes

WCCI2020MTO_Tasks

WCCI2020_Dataset

Introduction

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

API

class src.environment.problem.MTO.WCCI2020.wcci2020_dataset.WCCI2020MTO_Tasks(tasks)[source]

Initialization

reset()[source]
__str__()[source]
update_T1()[source]
class src.environment.problem.MTO.WCCI2020.wcci2020_dataset.WCCI2020_Dataset(data, batch_size=1)[source]

Bases: torch.utils.data.Dataset

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:

  • __getitem__(item): Retrieves a batch of tasks based on the given index.

  • __len__(): Returns the total number of task datasets.

  • __add__(other): Combines the current dataset with another WCCI2020_Dataset instance.

  • shuffle(): Shuffles the dataset indices to randomize the order of tasks.

  • get_datasets(version, train_batch_size, test_batch_size, difficulty, user_train_list, user_test_list): A static method to generate training and testing datasets based on the specified difficulty or user-defined task lists.

Raises:

  • ValueError: Raised in the get_datasets method if:

    • Neither difficulty nor user_train_list and user_test_list are provided.

    • An invalid difficulty value is specified.

Initialization

Introduction

Initializes the WCCI2020 Dataset with datas.

Args:

  • data (list): A list of task datasets, where each dataset contains multiple tasks.

  • batch_size (int, optional): The size of each batch when retrieving data. Defaults to 1.

Attributes:

  • data (list): The dataset containing tasks.

  • batch_size (int): The size of each batch. Defaults to 1.

  • maxdim (int): The maximum dimensionality across all tasks in the dataset.

  • N (int): The total number of task datasets.

  • ptr (list): A list of indices for batching.

  • index (numpy.ndarray): An array of indices for shuffling and accessing data.

__getitem__(item)[source]

Introduction

Retrieves a batch of tasks of the the WCCI2020 benchmark suite based on the given index.

Args:

  • item (int, optional): Specifies which batch of tasks of the WCCI2020 benchmark is selected.

Returns:

  • list: A list containing a batch of tasks of the WCCI2020 benchmark.

__len__()[source]

Introduction

Returns the total number of tasks in the WCCI2020 benchmark suite.

Returns:

  • int: The size of the WCCI2020 benchmark suite.

__add__(other: src.environment.problem.MTO.WCCI2020.wcci2020_dataset.WCCI2020_Dataset)[source]

Introduction

Combines two datasets into a single dataset.

Returns:

  • Object: The combined new dataset of the WCCI2020 benchmark suite.

shuffle()[source]

Introduction

Randomly shuffles the order of tasks in the dataset.

static get_datasets(version='numpy', train_batch_size=1, test_batch_size=1, difficulty=None, user_train_list=None, user_test_list=None)[source]

Introduction

Generates training and testing datasets for the WCCI2020 benchmark suite based on specified difficulty or user-defined function lists.

Args:

  • version (str, optional): Specifies the implementation version to use for function instances. Accepts ‘numpy’ or any other string for alternative (e.g., ‘torch’). Defaults to ‘numpy’.

  • train_batch_size (int, optional): Batch size for the training dataset. Defaults to 1.

  • test_batch_size (int, optional): Batch size for the testing dataset. Defaults to 1.

  • difficulty (str, optional): Difficulty level for dataset split. Accepts ‘easy’, ‘difficult’, ‘all’, or None. If None, user_train_list and user_test_list must be provided.

  • user_train_list (list of int, optional): List of function IDs to include in the training set. Used if difficulty is None.

  • user_test_list (list of int, optional): List of function IDs to include in the testing set. Used if difficulty is None.

Returns:

  • tuple: A tuple containing two WCCI2020_Dataset objects:

    • The first is the training dataset.

    • The second is the testing dataset.

Raises:

  • ValueError: If neither difficulty nor both user_train_list and user_test_list are provided.

  • ValueError: If an invalid difficulty value is specified.