Skip to content

Reference

ropt_pymoo.pymoo.PyMooOptimizer

Bases: Optimizer

Pymoo optimization backend for ropt.

This class provides an interface to several optimization algorithms from pymoo, enabling their use within ropt.

To select an optimizer, set the method field within the optimizer section of the EnOptConfig configuration object to the desired algorithm's name. The name should be a fully qualified class name within the pymoo.algorithms module (e.g., soo.nonconvex.ga.GA).

For algorithm-specific options, use the options dictionary within the optimizer section, which will be parsed into a ParametersConfig object.

ropt_pymoo.config.ParametersConfig

Configuration of a pymoo algorithm.

The general structure of the configuration is as follows:

  • Algorithm Parameters: Arguments passed directly to the main algorithm's constructor are nested under a top-level parameters key.

  • Object Parameters: When a parameter's value is itself a pymoo object, specify it using a nested dictionary, which will be parsed into a ObjectConfig object, containing:

    • An object key: The fully qualified name of the pymoo class (e.g., "operators.sampling.rnd.IntegerRandomSampling").
    • An optional parameters key: A dictionary of arguments to pass to that object's constructor. This can be nested further if those arguments are also objects.
  • Termination, Constraints, Seed: These are typically defined using their own top-level keys (termination, constraints, seed) within the options dictionary, following the same object/parameters pattern if they require configuration:

Note

constraints, termination, and seed are optional:

  • If constraints is None, the default constraint handling of pymoo will apply.
  • If termination is None, the default termination criterion soo is used.
  • The default value of seed is 1.

Attributes:

Name Type Description
parameters dict[str, ParameterValues | ObjectConfig]

The parameters passed to the algorithm constructor

constraints ConstraintsConfig | None

Specification of the constraint handling object to use

termination TerminationConfig | tuple[Any, ...]

Specification of the termination object to use

seed int

The seed value for the random number generator

ropt_pymoo.config.ObjectConfig

Configuration for a pymoo object used as a parameter.

This class defines the configuration for pymoo objects (like operators, sampling methods, etc.) that are passed as parameters to other pymoo components (e.g., an algorithm).

The object itself is identified by its fully qualified class name within the pymoo package structure. For instance, the FloatRandomSampling operator is specified as 'operators.sampling.rnd.FloatRandomSampling'.

Parameters for the object's constructor are provided in a dictionary. Values can be basic types (booleans, integers, floats, strings) or another nested ObjectConfig instance for complex parameter types.

Attributes:

Name Type Description
object

The fully qualified class name of the pymoo object.

parameters dict[str, ParameterValues | ObjectConfig]

A dictionary of keyword arguments.

ropt_pymoo.config.TerminationConfig

Configuration for pymoo termination classes.

This class defines how the termination object for a pymoo optimization algorithm is specified.

The name attribute identifies the termination criterion by providing the full path to the termination class within the pymoo.termination module (e.g., max_gen.MaximumGenerationTermination).

The parameters attribute holds a dictionary of keyword arguments that will be passed to the constructor of the chosen termination criterion.

For details about termination objects, consult the pymoo manual: Termination Criterion.

Note

Instead of using a termination object, it is also possible to use a tuple of termination conditions. See the ParametersConfig class for details.

Attributes:

Name Type Description
name str

The fully qualified termination class name.

parameters dict[str, int | float]

Keyword arguments for the termination criterion's constructor.

ropt_pymoo.config.ConstraintsConfig

Configuration for pymoo constraint handling methods.

This class defines how constraint handling is configured for a pymoo optimization.

The name attribute specifies the constraint handling class using its fully qualified name within the pymoo.constraints module (e.g., as_penalty.ConstraintsAsPenalty).

The parameters attribute holds a dictionary of keyword arguments passed to the constructor of the chosen constraint handling class.

For more details on constraint handling, consult the pymoo manual: Constraint Handling.

Attributes:

Name Type Description
name str

The fully qualified name of the constraint handling class.

parameters dict[str, bool | int | float | str]

Keyword arguments for the constraint handling class constructor.

ParameterValues module-attribute

ParameterValues = bool | int | float | str

Types of values that can be passed as parameters to pymoo objects.