src.environment.problem.MOO.UAV.uav_dataset¶
Problem Difficulty Classification¶
Difficulty Mode |
Training Set |
Testing Set |
|---|---|---|
easy |
Even IDs: 0, 2, 4, …, 54 (28 problems) |
Odd IDs: 1, 3, 5, …, 55 (28 problems) |
difficult |
Odd IDs: 1, 3, 5, …, 55 (28 problems) |
Even IDs: 0, 2, 4, …, 54 (28 problems) |
Note: When difficulty is ‘all’, both training and testing sets contain all problems (0-55).
Module Contents¶
Classes¶
Introduction¶The |
API¶
- class src.environment.problem.MOO.UAV.uav_dataset.UAV_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
The
UAV_Datasetclass is designed to handle datasets for Unmanned Aerial Vehicle (UAV) optimization problems.Original Paper¶
“Benchmarking global optimization techniques for unmanned aerial vehicle path planning.”
Official Implementation¶
None
License¶
None
Problem Suite Composition¶
The UAV dataset is composed of instances that simulate UAV optimization problems. The dataset can be configured to include different levels of difficulty (
easy,difficult, orall) and supports both user-defined and random splits for training and testing. The dataset can be generated using surrogate models or custom terrain generation.Args:¶
data(list): A list of data instances representing the UAV optimization problems.batch_size(int, optional): The size of each batch for data retrieval. Defaults to 1.
Attributes:¶
data(list): The dataset containing UAV problem instances.batch_size(int): The size of each batch for data retrieval.N(int): The total number of instances in the dataset.ptr(list): A list of pointers for batching.index(numpy.ndarray): An array of indices for shuffling and batching.maxdim(int): The maximum dimensionality of the problem instances in the dataset.
Methods:¶
get_datasets(version, train_batch_size, test_batch_size, difficulty, user_train_list, user_test_list, dv, j_pen, seed, num, mode, path): Static method to generate training and testing datasets based on the specified parameters.__getitem__(item): Retrieves a batch of data instances based on the given index.__len__(): Returns the total number of instances in the dataset.__add__(other): Combines the current dataset with anotherUAV_Datasetinstance.shuffle(): Shuffles the dataset indices to randomize the order of data retrieval.
Raises:¶
ValueError: Raised inget_datasetsifdifficulty,user_train_list, oruser_test_listare not properly set or if an invalid difficulty level is provided.
Initialization
Introduction¶
Initialize the UAV dataset with problem instances and batch size.
Args¶
data(list): List of UAV problem instances.batch_size(int, optional): Batch size. Defaults to 1.
Attributes¶
Sets
N,ptr,index, and computesmaxdimbased on problem dimensionality.
- static get_datasets(version='numpy', train_batch_size=1, test_batch_size=1, difficulty=None, user_train_list=None, user_test_list=None, dv=5.0, j_pen=10000.0, seed=3849, num=56, mode='standard', path=None)[source]¶
Introduction¶
Generate training and testing UAV datasets according to difficulty, user-specified splits, and generation modes.
Args¶
version(str, optional): ‘numpy’ or ‘torch’ implementation version. Defaults to ‘numpy’.train_batch_size(int, optional): Batch size for training data. Defaults to 1.test_batch_size(int, optional): Batch size for testing data. Defaults to 1.difficulty(str, optional): Difficulty level (‘easy’, ‘difficult’, ‘all’). Defaults to None.user_train_list(list, optional): List of training instance IDs specified by user. Defaults to None.user_test_list(list, optional): List of testing instance IDs specified by user. Defaults to None.dv(float, optional): Dimensionality parameter for problem instances. Defaults to 5.0.j_pen(float, optional): Penalty parameter for objective function. Defaults to 1e4.seed(int, optional): Random seed for reproducibility. Defaults to 3849.num(int, optional): Total number of problem instances. Defaults to 56.mode(str, optional): Dataset generation mode (‘standard’ or ‘custom’). Defaults to “standard”.path(str, optional): File path to precomputed data for ‘standard’ mode.
Returns¶
Tuple of two
UAV_Datasetinstances: (train_dataset, test_dataset).
Raises¶
ValueError: If difficulty or user lists are not set correctly or invalid difficulty string provided.
- __getitem__(item)[source]¶
Introduction¶
Retrieve a batch of UAV problem instances by batch index.
Args¶
item(int): Batch index.
Returns¶
List of UAV problem instances for the batch.
- __len__()[source]¶
Introduction¶
Return the total number of UAV problem instances.
Returns¶
int: Total dataset size.