paref.interfaces.moo_algorithms.paref_moo#

Classes

CompositionWithParetoReflection(**kwargs)

Wrapper for composing a Pareto reflection with a blackbox function in order to obtain a new blackbox function

ParefMOO()

Generic interface for MOO algorithms in Paref

class paref.interfaces.moo_algorithms.paref_moo.CompositionWithParetoReflection(**kwargs)[source]#

Bases: BlackboxFunction

Wrapper for composing a Pareto reflection with a blackbox function in order to obtain a new blackbox function

This class constructs a new blackbox function \(p\circ f\) out of a blackbox function \(f\) and a Pareto reflection \(p\). In particular, its design space is given by the design space of the underlying blackbox function and its target space dimension is given by the dimension of the codomain dimension of the Pareto reflection.

Note

Calling this blackbox function will call the underlying blackbox function. In particular, this means that the result is stored in the underlying blackbox function.

Initialize storage for evaluations of the blackbox function

__call__(**kwargs)#

Store evaluation of the blackbox function

abstract property design_space: Bounds#

Design space of composition

I.e. design space of the blackbox function.

Returns:

pythonic representation of design space

Return type:

Union[Bounds]

property dimension_design_space: int#

Dimension of design space

I.e. dimension of design space of underlying blackbox function.

Returns:

dimension of design space of composition

Return type:

int

abstract property dimension_target_space: int#

Dimension of target space

I.e. dimension of codomain of Pareto reflection.

Returns:

dimension of target space of composition

Return type:

int

class paref.interfaces.moo_algorithms.paref_moo.ParefMOO[source]#

Bases: object

Generic interface for MOO algorithms in Paref

Mathematically, an MOO algorithm is expressed as a sequence

\[(\mathcal{A}_i)_{i\in \mathbb{N}}\]

where each

\[\mathcal{A}_i\]

can be applied to a blackbox function and returns (approximately) a subset of its pareto front.

A Pareto reflection based MOO algorithm is the of the form

\[(\mathcal{A}_i)_{i\in \mathbb{N}}\]

where each

\[\mathcal{A}_i\]

is applied to a composition

\[p_i \circ f\]

where \(p_i\) is a Pareto reflection and \(f\) is the blackbox function.

This class provides the functionality needed. In particular, it allows you to

construct new algorithm from a sequence of Pareto reflections simply by implementing its sequence of Pareto reflections property

apply an MOO algorithm to a blackbox function and a sequence of Pareto reflections simply by calling its :apply to sequence method.

__call__(blackbox_function: BlackboxFunction, stopping_criteria: StoppingCriteria) None[source]#

Apply the algorithm to a blackbox function

Note

If the given stopping criteria is met, then, the algorithm terminates as well as if the end of a sequence of Pareto reflections is reached.

Parameters:
  • blackbox_function (BlackboxFunction) – blackbox function to which the algorithm is applied

  • stopping_criteria (StoppingCriteria) – stopping criteria at which the algorithm must terminate

abstract apply_moo_operation(blackbox_function: BlackboxFunction) None[source]#

Apply the MOO operation to the blackbox function

This is the core of any MOO algorithm. In the language from above, this is the assignment \(\mathcal{A}_i\).

Warning

Applying the MOO operation to the blackbox function must include:

  1. determining a (potential) Pareto point

  2. evaluating the blackbox function at that point

Parameters:

blackbox_function (BlackboxFunction) – blackbox function to which the MOO operation is applied

apply_to_sequence(blackbox_function: BlackboxFunction, sequence_pareto_reflections: SequenceParetoReflections | ParetoReflection, stopping_criteria: StoppingCriteria, with_underlying_sequence: bool = True)[source]#

Apply the algorithm to the composition of a blackbox function with a (sequence of) Pareto reflection(s)

Calling this method, applies to algorithm to the composition of the blackbox function with the pareto reflection (if a single Pareto reflection is provided) and with the next Pareto reflection obtained by the sequence (if a sequence of Pareto reflection is provided).

Parameters:
  • blackbox_function (BlackboxFunction) – underlying blackbox function

  • sequence_pareto_reflections (SequenceParetoReflections) – sequence or single Pareto reflection to compose with blackbox function

  • stopping_criteria (StoppingCriteria) – indicator when the algorthm terminates

  • with_underlying_sequence (bool default False) – decide whether sequence should be composed with implemented sequence of algorithm

property best_fits: ndarray#

The Pareto points fitting the algorithms choice of Pareto points best

Returns:

Pareto points fitting the algorithms choice of Pareto points best

Return type:

np.ndarray

property evaluated_sequence: SequenceParetoReflections | ParetoReflection | None#

Return the previous sequence of Pareto reflections

Returns:

previous sequence of Pareto reflections

Return type:

Union[SequenceParetoReflections, ParetoReflection, None]

property sequence_of_pareto_reflections: SequenceParetoReflections | ParetoReflection | None#

Underlying sequence of MOO algorithm

We can extend every MOO algorithm by applying it to a composition of the blackbox function and a Pareto reflection in each iteration. Implementing this property (i.e. a sequence of or a single Pareto reflection) will extent the underlying MOO algorithm in this fashion.

Note

This is an optional parameter. If a single Pareto reflection is implemented, then, the underlying MOO algorithm applied to some blackbox function will be applied to the composition of blackbox function with this Pareto reflection when called. This does not change the underlying moo operation method! Similarly, if a sequence of reflections is implemented, then, the algorithm is applied to the composition with the next reflection obtained from the sequence. The sequence will be initialized once when the algorithm is called.

Returns:

underlying sequence of Pareto reflection

Return type:

SequenceParetoReflections

Type:

Optional

abstract property supported_codomain_dimensions: List[int] | None#

Supported codomain dimensions

This includes all the dimensions of the target space this MOO supports, i.e. to which this MOO can be applied. For example, if the MOO algorithm is a minimization algorithm, then, the only supported dimension is one, i.e. this property must return [2].

Warning

If all dimensions are supported, then, this property must return None!

Returns:

list of supported dimensions or None if all dimensions are supported

Return type:

Optional[List[int]]