iwopy.core.opt_results

Classes

MultiObjOptResults

Container for optimization results for multi objective

SingleObjOptResults

Container for optimization results for single objective

Module Contents

class iwopy.core.opt_results.MultiObjOptResults(problem: iwopy.core.problem.Problem, success: numpy.ndarray, vars_int: numpy.ndarray, vars_float: numpy.ndarray, objs: numpy.ndarray, cons: numpy.ndarray, problem_results: object | None)[source]

Container for optimization results for multi objective problems.

Parameters:
problem: iwopy.core.problem.Problem

The problem

success: numpy.ndarray

Optimization success

vars_int: numpy.ndarray

Pareto-optimal variables, shape: (n_pop, n_vars_int)

vars_float: numpy.ndarray

Pareto-optimal variables, shape: (n_pop, n_vars_float)

objs: numpy.ndarray

Pareto front objective function values, shape: (n_pop, n_objectives)

cons: numpy.ndarray

Parteo front Constraint values, shape: (n_pop, n_constraints)

problem_results: object | None

The results of the variable application to the problem

find_pareto_objmix(obj_weights: collections.abc.Sequence[float], max: bool = False) → int[source]

Find the point on the pareto front that approximates best the given weights of objectives

Parameters:
obj_weights: collections.abc.Sequence[float]

The weights of the objectives

max: bool = False

Find the maximal value of the weighted result (otherwise find the minimal value)

Returns:

index – The index in the pareto front results

plot_pareto(obj_0: int = 0, obj_1: int = 1, ax: matplotlib.axes.Axes | None = None, figsize: tuple[float, float] = (5, 5), s: float = 50, color_val: str = 'orange', color_ival: str = 'red', title: str | None = None) → matplotlib.axes.Axes[source]

Get figure that shows the pareto front

Parameters:
obj_0: int = 0

The objective on the x axis

obj_1: int = 1

The objective on the y axis

ax: matplotlib.axes.Axes | None = None

The axis to plot on

figsize: tuple[float, float] = (5, 5)

The figure size, if ax is not given

s: float = 50

Scatter point size

color_val: str = 'orange'

Color choice for valid points

color_ival: str = 'red'

Color choice for invalid points

title: str | None = None

The plot title

Returns:

ax – The plot axis

cnames
cons
objs
onames
pname
problem_results
success
vars_float
vars_int
vnames_float
vnames_int
class iwopy.core.opt_results.SingleObjOptResults(problem: iwopy.core.problem.Problem, success: bool, vars_int: numpy.ndarray | None, vars_float: numpy.ndarray | None, objs: numpy.ndarray | None, cons: numpy.ndarray | None, problem_results: object | None)[source]

Container for optimization results for single objective problems.

Parameters:
problem: iwopy.core.problem.Problem

The problem

success: bool

Optimization success

vars_int: numpy.ndarray | None

Optimal variables, shape: (n_vars_int,)

vars_float: numpy.ndarray | None

Optimal variables, shape: (n_vars_float,)

objs: numpy.ndarray | None

Optimal objective function value

cons: numpy.ndarray | None

Constraint values, shape: (n_constraints,)

problem_results: object | None

The results of the variable application to the problem

cnames
cons
objs
onames
pname
problem_results
success
vars_float
vars_int
vnames_float
vnames_int