src.environment.problem.SOO.NE.ne_dataset¶
Problem Difficulty Classification¶
Difficulty Mode |
Training Set |
Testing Set |
|---|---|---|
easy |
Deep networks (depth > 2) |
Shallow networks (depth ≤ 2) |
difficult |
Shallow networks (depth ≤ 2) |
Deep networks (depth > 2) |
Note: Total 66 networks available. When difficulty is ‘all’, both sets contain all networks.
Module Contents¶
Classes¶
Introduction¶This problem set is based on the neuroevolution interfaces in EvoX. The goal is to optimize the parameters of neural network-based RL agents for a series of Robotic Control tasks. We pre-define 11 control tasks (e.g., swimmer, ant, walker2D etc.), and 6 MLP structures with 0~5 hidden layers. The combinations of task & network structure result in 66 problem instances, which feature extremely high-dimensional problems (>=1000D). |
API¶
- class src.environment.problem.SOO.NE.ne_dataset.NE_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
This problem set is based on the neuroevolution interfaces in EvoX. The goal is to optimize the parameters of neural network-based RL agents for a series of Robotic Control tasks. We pre-define 11 control tasks (e.g., swimmer, ant, walker2D etc.), and 6 MLP structures with 0~5 hidden layers. The combinations of task & network structure result in 66 problem instances, which feature extremely high-dimensional problems (>=1000D).
Original paper¶
“EvoX: A distributed GPU-accelerated framework for scalable evolutionary computation.” IEEE Transactions on Evolutionary Computation (2024).
Official Implementation¶
License¶
None
Initialization
Initializes the dataset object for single-objective optimization (SOO) problems.
Args:¶
data (list): A list of data items, where each item is expected to have a
dimattribute.batch_size (int, optional): The number of samples per batch. Defaults to 1.
Built-in Attributes:¶
data (list): Stores the input data.
batch_size (int): Stores the batch size.Defaults to 1.
N (int): The total number of data items.
ptr (list): List of starting indices for each batch.
index (np.ndarray): Array of indices for the data items.
maxdim (int): The maximum dimension found among all data items.Defaults to 0.
Notes:¶
Iterates through the data to determine the maximum dimension (
maxdim) among all items.- static get_datasets(train_batch_size=1, test_batch_size=1, difficulty='easy', user_train_list=None, user_test_list=None, instance_seed=3849)[source]¶
Introduction¶
Generates training and testing datasets for the NE_Problem environment based on specified difficulty or user-provided lists.
Args:¶
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 of the datasets to generate. Must be one of [‘all’, ‘easy’, ‘difficult’]. Defaults to ‘easy’.
user_train_list (list of str, optional): List of environment-depth identifiers to include in the training set. If provided, overrides
difficultyfor training set selection.user_test_list (list of str, optional): List of environment-depth identifiers to include in the testing set. If provided, overrides
difficultyfor testing set selection.instance_seed (int, optional): Random seed for instance generation. Defaults to 3849.
Returns:¶
NE_Dataset: The training dataset.
NE_Dataset: The testing dataset.
Raises:¶
AssertionError: If
difficultyis not one of [‘all’, ‘easy’, ‘difficult’].
- __getitem__(item)[source]¶
Introduction¶
Retrieves a batch of data samples corresponding to the given index.
Args:¶
item (int): The index of the batch to retrieve.
Built-in Attribute:¶
self.ptr (list or array-like): Maps batch indices to starting positions in the dataset.
self.index (list or array-like): Contains indices of the data samples.
self.batch_size (int): The number of samples in each batch.
self.N (int): The total number of data samples.
self.data (list or array-like): The dataset from which samples are retrieved.
Returns:¶
list: A list containing the data samples for the specified batch.
Raises:¶
IndexError: If
itemis out of range of available batches.
- __len__()[source]¶
Introduction¶
Returns the number of elements in the dataset.
Returns:¶
int: The total number of elements in the dataset.
- __add__(other: src.environment.problem.SOO.NE.ne_dataset.NE_Dataset)[source]¶
Introduction¶
Combines two
NE_Datasetinstances by adding their data attributes and returns a newNE_Datasetwith the same batch size.Args:¶
other (NE_Dataset): Another
NE_Datasetinstance to be added.
Returns:¶
NE_Dataset: A new dataset containing the combined data of both instances.
Raises:¶
AttributeError: If
otherdoes not have adataattribute.
- shuffle()[source]¶
Introduction¶
Randomly shuffles the indices of the dataset, updating the internal index array.
Built-in Attribute:¶
self.N (int): The number of elements in the dataset.
self.index (np.ndarray): The array storing the current order of indices.
Returns:¶
None
Notes:¶
This method uses
np.random.permutationto generate a new random ordering of indices for the dataset.