src.environment.problem.MOO.MOO_synthetic.moo_synthetic_dataset¶
Problem Difficulty Classification¶
Difficulty Mode |
Training Set |
Testing Set |
|---|---|---|
easy |
First 80% of problems sorted by complexity |
Last 20% of problems sorted by complexity |
difficult |
First 20% of problems sorted by complexity |
Last 80% of problems sorted by complexity |
Note: Problems are sorted by complexity (n_obj × n_var). When difficulty is ‘all’, both sets contain all 187 problems.
Module Contents¶
Classes¶
Introduction¶The |
API¶
- class src.environment.problem.MOO.MOO_synthetic.moo_synthetic_dataset.MOO_Synthetic_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
The
MOO_Synthetic_Datasetclass is designed to handle synthetic multi-objective optimization (MOO) datasets. MOO-Synthetic provides a more comprehensive problem set for multi-objective optimization by combining multiple mainstream problem sets (ZDT、UF、DTLZ、WFG).Problem Suite Composition¶
MOO-Synthetic contains 187 questions, consisting of the ZDT, UF, DTLZ, and WFG question sets.
UF (Unconstrained Functions): UF1 to UF10.
ZDT (Zitzler-Deb Thiele): ZDT1 to ZDT6.
DTLZ (Deb Thiele Laumanns Zitzler): DTLZ1 to DTLZ7.
WFG (Walking Fish Group): WFG1 to WFG9. Each problem is parameterized by the number of objectives (
n_obj) and the number of decision variables (n_var). The problems can be instantiated in either NumPy or PyTorch versions.
Args:¶
data(list): A list of problem instances to be included in the dataset.batch_size(int, optional): The size of each batch. Defaults to 1.
Attributes:¶
data(list): The list of problem instances in the dataset.batch_size(int): The size of each batch.N(int): The total number of problem instances in the dataset.ptr(list): A list of indices for batching.index(numpy.ndarray): An array of shuffled indices for accessing the dataset.maxdim(int): The maximum number of decision variables (n_var) across all problem instances.
Methods:¶
get_datasets(version='numpy', train_batch_size=1, test_batch_size=1, difficulty=None, user_train_list=None, user_test_list=None): Static method to generate training and testing datasets based on the specified difficulty or user-provided problem lists.__getitem__(item): Retrieves a batch of problem instances based on the given index.__len__(): Returns the total number of problem instances in the dataset.__add__(other): Combines the current dataset with anotherMOO_Synthetic_Datasetinstance.shuffle(): Shuffles the dataset indices for random access.
Raises:¶
ValueError: If neitherdifficultynor user lists are provided, or if difficulty is invalid.
Initialization
Introduction¶
Initializes the dataset with a list of problem instances and a batch size.
Args¶
data(list): List of problem instances.batch_size(int, optional): Batch size for data loading. Defaults to 1.
Attributes¶
Sets
N,ptr,index, and computesmaxdimfromdata.
- 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 of multi-objective optimization problems based on difficulty or user-defined lists.
Args¶
version(str, optional): Specifies the implementation (‘numpy’ or ‘torch’). Defaults to ‘numpy’.train_batch_size(int, optional): Batch size for training dataset. Defaults to 1.test_batch_size(int, optional): Batch size for testing dataset. Defaults to 1.difficulty(str, optional): Difficulty level (‘easy’, ‘difficult’, ‘all’). Defaults to None.user_train_list(list, optional): User-specified training problem names. Defaults to None.user_test_list(list, optional): User-specified testing problem names. Defaults to None.
Returns¶
Tuple of two
MOO_Synthetic_Datasetinstances: (train_dataset, test_dataset).
Raises¶
ValueError: If neitherdifficultynor user lists are provided, or if difficulty is invalid.
- __getitem__(item)[source]¶
Introduction¶
Retrieves a batch of problem instances based on batch index.
Args¶
item(int): Batch index.
Returns¶
List of problem instances for the batch.
- __len__()[source]¶
Introduction¶
Returns the total number of problem instances in the dataset.
Returns¶
int: Total dataset size.
- __add__(other: src.environment.problem.MOO.MOO_synthetic.moo_synthetic_dataset.MOO_Synthetic_Dataset)[source]¶
Introduction¶
Combines this dataset with another to form a larger dataset.
Args¶
other(MOO_Synthetic_Dataset): Another dataset instance.
Returns¶
A new
MOO_Synthetic_Datasetinstance containing combined data.