piglot.objectives.synthetic.SyntheticObjective

class SyntheticObjective(parameters: ParameterSet, name: str, output_dir: str, transform: str | None = None, composition: Reduction | None = None, **kwargs)[source]

Bases: GenericObjective

Objective function derived from a synthetic test function.

Methods

get_history

Get the objective history.

get_test_functions

Return available test functions.

plot_best

Plot the current best case.

plot_case

Plot a given function call given the parameter hash

plot_current

Plot the currently running function call

prepare

Prepare output directories for the optimsation.

read

Read the objective from a configuration dictionary.

__call__(params: ndarray, concurrent: bool = False) ObjectiveResult

Objective computation for the outside world. Also handles output file writing.

Parameters

paramsnp.ndarray

Set of parameters to evaluate the objective for.

concurrentbool, optional

Whether this call may be concurrent to others, by default False.

Returns

ObjectiveResult

Objective result.

get_history() Dict[str, Dict[str, Any]]

Get the objective history.

Returns

Dict[str, Dict[str, Any]]

Dictionary of objective history.

static get_test_functions() Dict[str, Type[SyntheticTestFunction]][source]

Return available test functions.

Returns

Dict[str, Type[SyntheticTestFunction]]

Available test functions.

plot_best() List[Figure]

Plot the current best case.

Returns

List[Figure]

List of figures with the plot.

plot_case(case_hash: str, options: Dict[str, Any] | None = None) List[Figure]

Plot a given function call given the parameter hash

Parameters

case_hashstr, optional

Parameter hash for the case to plot

optionsDict[str, Any], optional

Options to pass to the plotting function, by default None

Returns

List[Figure]

List of figures with the plot

plot_current() List[DynamicPlotter]

Plot the currently running function call

Returns

List[DynamicPlotter]

List of instances of a updatable plots

prepare() None

Prepare output directories for the optimsation.

static read(config: Dict[str, Any], parameters: ParameterSet, output_dir: str) SyntheticObjective[source]

Read the objective from a configuration dictionary.

Parameters

configDict[str, Any]

Terms from the configuration dictionary.

parametersParameterSet

Set of parameters for this problem.

output_dirstr

Path to the output directory.

Returns

SyntheticObjective

Objective function to optimise.