Multi-Objective Optimization#
Base MOO#
- class udao.optimization.moo.mo_solver.MOSolver#
Bases:
ABC
- abstract solve(problem: MOProblem, seed: int | None = None) Any #
_summary_
- Parameters:
problem (MOProblem) – Multi-objective optimization problem to solve
seed (Optional[int], optional) – Random seed, by default None
- Returns:
A tuple of the objectives values and the variables that optimize the objective
- Return type:
Any
Weighted Sum#
- class udao.optimization.moo.weighted_sum.WeightedSum(params: Params)#
Bases:
MOSolver
Weighted Sum (WS) algorithm for MOO
- Parameters:
ws_pairs (np.ndarray,) – weight settings for all objectives, of shape (n_weights, n_objs)
inner_solver (BaseSolver,) – the solver used in Weighted Sum
objectives (List[Objective],) – objective functions
constraints (List[Constraint],) – constraint functions
- class Params(ws_pairs: numpy.ndarray, so_solver: udao.optimization.soo.so_solver.SOSolver, normalize: bool = True, allow_cache: bool = False, device: Optional[torch.device] = <factory>)#
Bases:
object
- allow_cache: bool = False#
whether to cache the objective values
- device: device | None#
device on which to perform torch operations, by default available device.
- normalize: bool = True#
whether to normalize objective values to [0, 1] before applying WS
- ws_pairs: ndarray#
weight sets for all objectives, of shape (n_weights, n_objs)
- solve(problem: MOProblem, seed: int | None = None) Tuple[ndarray, ndarray] #
solve MOO problem by Weighted Sum (WS)
- Parameters:
variables (List[Variable]) – List of the variables to be optimized.
input_parameters (Optional[Dict[str, Any]]) – Fixed input parameters expected by the objective functions.
- Returns:
Pareto solutions and corresponding variables.
- Return type:
Tuple[Optional[np.ndarray],Optional[np.ndarray]]
- class udao.optimization.moo.weighted_sum.WeightedSumObjective(problem: MOProblem, ws: List[float], allow_cache: bool = False, normalize: bool = True, device: device | None = None)#
Bases:
Objective
Weighted Sum Objective
- function(*args: Any, **kwargs: Any) Tensor #
Sum of weighted normalized objectives
- to(device: device | None = None) WeightedSumObjective #
Move objective to device
Base Progressive Frontier#
- class udao.optimization.moo.progressive_frontier.base_progressive_frontier.BaseProgressiveFrontier(solver: SOSolver, params: Params)#
Bases:
MOSolver
,ABC
Base class for Progressive Frontier. Includes the common methods for Progressive Frontier.
- class Params#
Bases:
object
Parameters for Progressive Frontier
- get_anchor_point(problem: MOProblem, obj_ind: int, seed: int | None = None) Point #
Find the anchor point for the given objective, by unbounded single objective optimization
- Parameters:
problem (MOProblem) – MOO problem in which the objective is to be optimized
obj_ind (int) – index of the objective to be optimized
- Returns:
anchor point for the given objective
- Return type:
Point
- static get_utopia_and_nadir(points: list[Point]) Tuple[Point, Point] #
get the utopia and nadir points from a list of points :param points: each element is a Point (defined class). :type points: list[Point],
- Returns:
utopia and nadir point
- Return type:
Tuple[Point, Point]
Sequential Progressive Frontier#
- class udao.optimization.moo.progressive_frontier.sequential_progressive_frontier.SequentialProgressiveFrontier(solver: SOSolver, params: Params)#
Bases:
BaseProgressiveFrontier
Sequential Progressive Frontier - a progressive frontier algorithm that explores the uncertainty space sequentially, by dividing the space into subrectangles and exploring the subrectangles one by one.
- generate_sub_rectangles(utopia: Point, nadir: Point, middle: Point, successful: bool = True) List[Rectangle] #
Generate uncertainty space to be explored: - if starting from successful optimum as middle, excludes the dominated space (middle as utopia and nadir as nadir) - if starting from unsuccessful optimum as middle, excludes the space where all constraining objectives are lower than the middle point.
- Parameters:
utopia (Point) – the utopia point
nadir (Point) – the nadir point
middle (Point) – the middle point generated by the constrained single objective optimization
successful (bool) – whether the middle point is from a successful optimization
- Returns:
sub rectangles to be explored
- Return type:
List[Rectangle]
- solve(problem: MOProblem, seed: int | None = None) Tuple[ndarray, ndarray] #
Solve MOO by Progressive Frontier
- Parameters:
problem (MOProblem) – MOO problem to be solved
- Returns:
optimal objectives and variables None, None if no solution is found
- Return type:
Tuple[np.ndarray | None, np.ndarray | None]
Parallel Progressive Frontier#
- class udao.optimization.moo.progressive_frontier.parallel_progressive_frontier.ParallelProgressiveFrontier(solver: SOSolver, params: Params)#
Bases:
BaseProgressiveFrontier
- class Params(processes: int = 1, n_grids: int = 2, max_iters: int = 10)#
Bases:
Params
- max_iters: int = 10#
Number of iterations to explore the space
- n_grids: int = 2#
Number of splits per objective
- processes: int = 1#
Processes to use for parallel processing
- parallel_soo(problem: MOProblem, objective: Objective, cell_list: List[Dict[str, Any]], seed: int | None = None) List[Tuple[float, Dict[str, Any]]] #
Parallel calls to SOO Solver for each cell in cell_list, returns a candidate tuple (objective_value, variables) for each cell.
- Parameters:
objective (Objective) – Objective to be optimized
cell_list (List[Dict[str, Any]]) – List of cells to be optimized (a cell is a dict of bounds for each objective)
input_parameters (Optional[Dict[str, Any]], optional) – Fixed parameters to be passed , by default None
- Returns:
List of candidate tuples (objective_value, variables)
- Return type:
List[Tuple[float, Dict[str, Any]]]
- solve(problem: MOProblem, seed: int | None = None) Tuple[ndarray, ndarray] #
solve MOO by PF-AP (Progressive Frontier - Approximation Parallel)
- Parameters:
problem (MOProblem) – MOO problem to be solved
- Returns:
po_objs (ndarray) – Pareto optimal objective values, of shape (n_solutions, n_objs)
po_vars (ndarray) – corresponding variables of Pareto solutions, of shape (n_solutions, n_vars)