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¶
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
- class src.environment.problem.MTO.WCCI2020.wcci2020_dataset.WCCI2020_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
WCCI2020 proposes 10 multi-task benchmark problems to represent a wider range of multi-task optimization problems.
Original Paper¶
None
Official Implementation¶
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 anotherWCCI2020_Datasetinstance.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 theget_datasetsmethod if:Neither
difficultynoruser_train_listanduser_test_listare provided.An invalid
difficultyvalue 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.
- 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_listanduser_test_listmust be provided.user_train_list(list of int, optional): List of function IDs to include in the training set. Used ifdifficultyis None.user_test_list(list of int, optional): List of function IDs to include in the testing set. Used ifdifficultyis None.
Returns:¶
tuple: A tuple containing two
WCCI2020_Datasetobjects:The first is the training dataset.
The second is the testing dataset.
Raises:¶
ValueError: If neitherdifficultynor bothuser_train_listanduser_test_listare provided.ValueError: If an invaliddifficultyvalue is specified.