src.environment.problem.MTO.CEC2017MTO.cec2017mto_dataset¶
Problem Difficulty Classification¶
Difficulty Mode |
Training Set |
Testing Set |
|---|---|---|
easy |
0, 1, 2, 3, 4, 5 |
6, 7, 8 |
difficult |
6, 7, 8 |
0, 1, 2, 3, 4, 5 |
Note: When difficulty is ‘all’, both training and testing sets contain all problems (0-8).
Module Contents¶
Classes¶
Introduction¶CEC2017MTO proposes 9 multi-task benchmark problems to represent a wider range of multi-task optimization problems. |
Functions¶
API¶
- class src.environment.problem.MTO.CEC2017MTO.cec2017mto_dataset.CEC2017MTO_Tasks(tasks)[source]¶
Initialization
- class src.environment.problem.MTO.CEC2017MTO.cec2017mto_dataset.CEC2017MTO_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
CEC2017MTO proposes 9 multi-task benchmark problems to represent a wider range of multi-task optimization problems.
Original Paper¶
Official Implementation¶
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:¶
__getitem__(item): Retrieves a batch of data based on the specified index.__len__(): Returns the total number of datasets in the collection.__add__(other): Combines the current dataset with anotherCEC2017MTO_Datasetinstance.shuffle(): Randomly shuffles the dataset indices.get_datasets(version, train_batch_size, test_batch_size, difficulty, user_train_list, user_test_list): Static method to generate training and testing datasets based on the specified difficulty level or user-defined task lists.
Raises:¶
ValueError: Raised in the following cases:If
difficulty,user_train_list, anduser_test_listare allNone.If an invalid
difficultyvalue is provided.
Initialization
Introduction¶
Initializes the CEC2017MTO 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 for data retrieval. Defaults to 1.
Attributes:¶
data(list): The dataset containing tasks for the CEC2017MTO problem suite.batch_size(int): The size of each batch for data retrieval. Defaults to 1.maxdim(int): The maximum dimensionality across all tasks in the dataset.N(int): The total number of datasets in the collection.ptr(list): A list of indices for batching the dataset.index(numpy.ndarray): An array of shuffled indices for dataset access.
- __getitem__(item)[source]¶
Introduction¶
Retrieves a batch of tasks of the the CEC2017MTO benchmark suite based on the given index.
Args:¶
item(int, optional): Specifies which batch of tasks of the CEC2017MTO benchmark is selected.
Returns:¶
list: A list containing a batch of tasks of the CEC2017MTO benchmark.
- __len__()[source]¶
Introduction¶
Returns the total number of tasks in the CEC2017MTO benchmark suite.
Returns:¶
int: The size of the CEC2017MTO benchmark suite.
- __add__(other: src.environment.problem.MTO.CEC2017MTO.cec2017mto_dataset.CEC2017MTO_Dataset)[source]¶
Introduction¶
Combines two datasets into a single dataset.
Returns:¶
Object: The combined new dataset of the CEC2017MTO 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 CEC2017MTO Dataset 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
CEC2017MTO_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.