src.environment.problem.SOO.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¶UAV provides 56 terrain-based landscapes as realistic Unmanned Aerial Vehicle(UAV) path planning problems, each of which is 30D. The objective is to select given number of path nodes (x,y,z coordinates) from the 3D space, so the the UAV could fly as shortly as possible in a collision-free way. |
API¶
- class src.environment.problem.SOO.UAV.uav_dataset.UAV_Dataset(data, batch_size=1)[source]¶
Bases:
torch.utils.data.DatasetIntroduction¶
UAV provides 56 terrain-based landscapes as realistic Unmanned Aerial Vehicle(UAV) path planning problems, each of which is 30D. The objective is to select given number of path nodes (x,y,z coordinates) from the 3D space, so the the UAV could fly as shortly as possible in a collision-free way.
Original paper¶
“Benchmarking global optimization techniques for unmanned aerial vehicle path planning.” arXiv preprint arXiv:2501.14503 (2025).
Official Implementation¶
License¶
None
Initialization
Introduction¶
Initializes the dataset object for UAV problems, setting up batching and dimension tracking.
Args:¶
data (list): A list of data items, each expected to have a
dimattribute.batch_size (int, optional): The number of samples per batch. Defaults to 1.
Built-in Attribute:¶
data (list): Stores the input data.
batch_size (int): Stores the batch size.
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.
maxdim (int): The maximum dimension found among all data items.
Returns:¶
None
Raises:¶
AttributeError: If any item in
datadoes not have adimattribute.
- 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¶
Generates and returns training and testing datasets for UAV (Unmanned Aerial Vehicle) terrain navigation problems, supporting both standard (from file) and custom (generated) modes. Allows flexible selection of dataset difficulty, batch sizes, and custom train/test splits.
Args:¶
version (str, optional): Dataset version, either ‘numpy’ or ‘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 of the dataset. One of [‘easy’, ‘difficult’, ‘all’, None]. If None, user_train_list and user_test_list must be provided.
user_train_list (list of int, optional): Custom list of instance indices for the training set. Defaults to None.
user_test_list (list of int, optional): Custom list of instance indices for the testing set. Defaults to None.
dv (float, optional): Parameter for terrain data (e.g., number of divisions). Defaults to 5.0.
j_pen (float, optional): Penalty parameter for the terrain data. Defaults to 1e4.
seed (int, optional): Random seed for reproducibility. Defaults to 3849.
num (int, optional): Total number of terrain instances to generate or load. Defaults to 56.
mode (str, optional): Dataset mode, either ‘standard’ (load from file) or ‘custom’ (generate on the fly). Defaults to “standard”.
path (str, optional): Path to the dataset file (required if mode is “standard”). Defaults to None.
Returns:¶
UAV_Dataset: Training dataset object.
UAV_Dataset: Testing dataset object.
Raises:¶
ValueError: If neither
difficultynor bothuser_train_listanduser_test_listare provided.ValueError: If
difficultyis not one of [‘easy’, ‘difficult’, ‘all’, None].
- __getitem__(item)[source]¶
Introduction¶
Retrieves a batch of data samples corresponding to the specified index.
Args:¶
item (int): The index of the batch to retrieve.
Returns:¶
list: A list containing the data samples for the specified batch.
Raises:¶
IndexError: If
itemis out of range of the 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.UAV.uav_dataset.UAV_Dataset)[source]¶
Introduction¶
Combines two UAV_Dataset instances by concatenating their data attributes.
Args:¶
other (UAV_Dataset): Another UAV_Dataset instance to be added.
Returns:¶
UAV_Dataset: A new UAV_Dataset instance containing the combined data from both datasets, with the same batch size as the original.
Raises:¶
AttributeError: If
otherdoes not have adataattribute.TypeError: If
otheris not an instance of UAV_Dataset.