Skip to content

Problem

Class for defining problem.

Problem

Problem(
    model,
    weather_input,
    /,
    model_inputs=(),
    outputs=(),
    *,
    evaluation_dir=None,
    has_templates=False,
    noise_sample_kwargs=None,
    clean_patterns=_OutputManager._DEFAULT_CLEAN_PATTERNS,
    removes_subdirs=False,
)

Define a parametrics/optimisation problem.

PARAMETER DESCRIPTION
model

Model file path.

TYPE: str or path-like object

weather_input

Weather input variable.

TYPE: WeatherModifier

model_inputs

Model input variables.

TYPE: iterable of ModelModifier DEFAULT: ()

outputs

Output variables.

TYPE: iterable of Collector DEFAULT: ()

evaluation_dir

Evaluation directory path, default is a directory named 'evaluation' in the same folder as the model file.

TYPE: str or path-like object DEFAULT: None

has_templates

Whether the model has HVAC templates.

TYPE: bool DEFAULT: `False`

noise_sample_kwargs

Settings for sampling uncertain variables, including

Key Description Value type
'mode' Sampling mode {'elementwise', 'cartesian', 'auto'}
'size' Sample size int
'method' Sampling method {'random', 'latin hypercube'}
'seed' Random seed int
  • If 'mode'='elementwise', 'size' and 'method' are mandatory.
  • If 'mode'='cartesian', all model inputs must be non-continuous variables,
  • If 'mode'='auto', the sampling mode is set to 'cartesian' if all variables are non-continuous, otherwise 'elementwise'.

TYPE: dict DEFAULT: None

clean_patterns

Patterns to clean simulation files. This is ignored if removes_subdirs is set to True.

TYPE: str or iterable of str DEFAULT: `{'*.audit', '*.end', 'sqlite.err'}`

removes_subdirs

Whether to remove the subdirectories in the evaluation directory.

TYPE: bool DEFAULT: `False`

run_random

run_random(size, /, *, mode='auto', seed=None)

Run parametrics via a random sample.

PARAMETER DESCRIPTION
size

Sample size.

TYPE: int

mode

Sampling mode.

TYPE: ('elementwise', 'cartesian', 'auto') DEFAULT: 'elementwise'

seed

Random seed.

TYPE: int DEFAULT: None

run_latin_hypercube

run_latin_hypercube(size, /, *, seed=None)

Run parametrics via a latin hypercube sample.

PARAMETER DESCRIPTION
size

Sample size.

TYPE: int

seed

Random seed.

TYPE: int DEFAULT: None

run_exhaustive

run_exhaustive()

Run parametrics via the exhaustive sample.

run_nsga2

run_nsga2(
    population_size,
    termination,
    /,
    *,
    p_crossover=1.0,
    p_mutation=0.2,
    init_population_size=0,
    saves_history=True,
    checkpoint_interval=0,
    seed=None,
)

Run optimisation via the NSGA2 algorithm.

PARAMETER DESCRIPTION
population_size

Population size.

TYPE: int

termination

Termination criterion, see https://pymoo.org/interface/termination.html.

TYPE: Termination

p_crossover

Crossover probability.

TYPE: float DEFAULT: `1.0`

p_mutation

Mutation probability.

TYPE: float DEFAULT: `0.2`

init_population_size

Initial population size. This allows setting a different (usually larger) population size for the first generation. Any non-positive value falls back to the value of population_size.

TYPE: int DEFAULT: `0`

saves_history

Whether to save the iteration history, see https://pymoo.org/interface/minimize.html.

TYPE: bool DEFAULT: `True`

checkpoint_interval

Frequency of saving a checkpoint. Any non-positive value disables the checkpoint function.

TYPE: int DEFAULT: `0`

seed

Random seed.

TYPE: int DEFAULT: None

RETURNS DESCRIPTION
Result

Pymoo result object, see https://pymoo.org/interface/result.html.

run_nsga3

run_nsga3(
    population_size,
    termination,
    /,
    reference_directions=None,
    *,
    p_crossover=1.0,
    p_mutation=0.2,
    init_population_size=0,
    saves_history=True,
    checkpoint_interval=0,
    seed=None,
)

Run optimisation via the NSGA3 algorithm.

PARAMETER DESCRIPTION
population_size

Population size.

TYPE: int

termination

Termination criterion, see https://pymoo.org/interface/termination.html.

TYPE: Termination

reference_directions

Reference directions, see https://pymoo.org/misc/reference_directions.html. The Riesz s-Energy method is used to generate reference directions as per the input count and the population size.

TYPE: ndarray DEFAULT: None

p_crossover

Crossover probability.

TYPE: float DEFAULT: `1.0`

p_mutation

Mutation probability.

TYPE: float DEFAULT: `0.2`

init_population_size

Initial population size. This allows setting a different (usually larger) population size for the first generation. Any non-positive value falls back to the value of population_size.

TYPE: int DEFAULT: `0`

saves_history

Whether to save the iteration history, see https://pymoo.org/interface/minimize.html.

TYPE: bool DEFAULT: `True`

checkpoint_interval

Frequency of saving a checkpoint. Any non-positive value disables the checkpoint function.

TYPE: int DEFAULT: `0`

seed

Random seed.

TYPE: int DEFAULT: None

RETURNS DESCRIPTION
Result

Pymoo result object, see https://pymoo.org/interface/result.html.

resume staticmethod

resume(checkpoint_file, /, *, termination=None, checkpoint_interval=0)

Resume optimisation using a checkpoint.

PARAMETER DESCRIPTION
checkpoint_file

Checkpoint file path.

TYPE: str or path-like object

termination

Termination criterion. The one in the checkpoint will be reused if not specified.

TYPE: Termination DEFAULT: None

checkpoint_interval

Frequency of saving a checkpoint. Any non-positive value disables the checkpoint function.

TYPE: int DEFAULT: `0`

RETURNS DESCRIPTION
Result

Pymoo result object, see https://pymoo.org/interface/result.html.