src.environment.problem.MOO.UAV.uav_numpy

Module Contents

Classes

UAV_Numpy_Problem

Introduction

The UAV_Numpy_Problem class is designed to model a numpy-based multi-objective optimization problem for UAV (Unmanned Aerial Vehicle) path planning.

Terrain

Introduction

Multi-objective UAV path planning problem over a 3D terrain map with obstacles and threats.Evaluates five objectives: path length, threat avoidance, altitude penalty, smoothness, and terrain clearance.

API

class src.environment.problem.MOO.UAV.uav_numpy.UAV_Numpy_Problem[source]

Bases: src.environment.problem.basic_problem.Basic_Problem

Introduction

The UAV_Numpy_Problem class is designed to model a numpy-based multi-objective optimization problem for UAV (Unmanned Aerial Vehicle) path planning.

Original Paper

Benchmarking global optimization techniques for unmanned aerial vehicle path planning.”

Official Implementation

None

License

None

Problem Suite Composition

This problem involves optimizing UAV trajectories in a 3D terrain model. The problem is defined by a set of constraints, including terrain boundaries, velocity limits, and angular constraints. The optimization process aims to find feasible and optimal paths for UAVs while considering multiple objectives.

Args:

None

Attributes:

  • terrain_model (dict): A dictionary containing the terrain model parameters, including start and end points, boundaries, and other relevant data.

  • FES (int): Function evaluation count, initialized to 0.

  • optimum (NoneType): Placeholder for the optimum solution, if applicable.

  • problem_id (NoneType): Identifier for the problem instance.

  • dim (NoneType): Dimensionality of the problem.

  • lb (numpy.ndarray): Lower bounds for the problem variables.

  • ub (numpy.ndarray): Upper bounds for the problem variables.

  • n_obj (int): Number of objectives in the optimization problem, default is 5.

Methods:

  • __str__() -> str: Returns a string representation of the problem, including the terrain identifier.

  • __boundaries__() -> None: Computes and sets the lower and upper bounds for the problem variables based on the terrain model.

  • spherical_to_cart_vec(solve: numpy.ndarray) -> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]: Converts spherical coordinates (r, phi, psi) to Cartesian coordinates (x, y, z) for UAV trajectory points.

  • DistP2S(xs: numpy.ndarray, a: numpy.ndarray, b: numpy.ndarray) -> numpy.ndarray: Computes the distance from a point to a line segment in 2D space.

Raises:

  • ValueError: Raised if the terrain model is not properly defined or if required parameters are missing.

  • TypeError: Raised if input arguments to methods are not of the expected type.

Initialization

Introduction

Initialize the UAV path planning problem.

__str__()[source]

Introduction

Return a string description of the problem.

Returns

  • str: Terrain ID string.

__boundaries__()[source]

Introduction

Set the lower and upper bounds for decision variables based on the terrain model.

Returns

  • None: Modifies self.lb and self.ub in-place.

spherical_to_cart_vec(solve)[source]

Introduction

Convert a population of solutions from spherical (r, psi, phi) to Cartesian (x, y, z) coordinates.

Args

  • solve (np.ndarray): Array of shape [NP, 3*n] representing decision variables.

Returns

  • x (np.ndarray): X-coordinates of shape [NP, n].

  • y (np.ndarray): Y-coordinates of shape [NP, n].

  • z (np.ndarray): Z-coordinates of shape [NP, n].

DistP2S(xs, a, b)[source]

Introduction

Compute the shortest distance from a 2D point to multiple 2D line segments.

Args

  • xs (np.ndarray): Array of shape [2,] representing the point.

  • a (np.ndarray): Array of shape [2, N] representing start points of line segments.

  • b (np.ndarray): Array of shape [2, N] representing end points of line segments.

Returns

  • dist (np.ndarray): Array of shape [N] representing distances to each segment.

class src.environment.problem.MOO.UAV.uav_numpy.Terrain(terrain_model, problem_id)[source]

Bases: src.environment.problem.MOO.UAV.uav_numpy.UAV_Numpy_Problem

Introduction

Multi-objective UAV path planning problem over a 3D terrain map with obstacles and threats.Evaluates five objectives: path length, threat avoidance, altitude penalty, smoothness, and terrain clearance.

Args

  • terrain_model (dict): Dictionary containing terrain data, UAV configuration, threats, and parameters.

  • problem_id (int): Unique identifier for the problem instance.

Attributes

  • terrain_model (dict): Terrain configuration and UAV parameters.

  • dim (int): Dimension of the problem, equals 3 times the number of waypoints.

  • problem_id (int): Problem ID for identification.

  • optimum (None): Placeholder for true Pareto front (if known).

Initialization

Introduction

  • Initialize a UAV path planning problem with given terrain model and problem ID.

  • Sets up internal attributes and boundary constraints for the optimization problem.

Args

  • terrain_model (dict): Contains UAV start/end points, threats, height map, parameters like ‘n’, ‘zmin’, ‘zmax’, etc.

  • problem_id (int): Integer ID used to distinguish this problem instance.

func(solve)[source]

Introduction

  • Compute five objective values for a batch of UAV paths encoded in spherical coordinates.

  • Objectives include path length, threat cost, altitude penalty, smoothness, and terrain violation penalty.

Args

  • solve (np.ndarray): 2D array of shape [NP, 3 * nv], each row is a solution representing waypoints in spherical coordinates.

Returns

  • np.ndarray: 2D array of shape [NP, 5], each row represents the five objective values of one solution.

are_paths_clear(x_all, y_all, z_abs, H, num_samples=12)[source]

Introduction

  • Check whether all UAV path segments are completely above the terrain.

Args

  • x_all (np.ndarray): (NP, N) x-coordinates for each point of each path.

  • y_all (np.ndarray): (NP, N) y-coordinates for each point of each path.

  • z_abs (np.ndarray): (NP, N) absolute altitude for each point of each path.

  • H (np.ndarray): Terrain height map (2D array).

  • num_samples (int): Number of interpolation samples per segment.

Returns

  • np.ndarray: Boolean array of shape (NP,), indicating whether each path is above terrain.