piglot.solver.solver.SingleCaseSolver

class SingleCaseSolver(output_fields: List[str], parameters: ParameterSet, output_dir: str, tmp_dir: str, verbosity: str)[source]

Bases: Solver, ABC

Generic class for solvers with a single case.

Methods

get_case_params

Get the parameters for a given hash.

get_case_result

Get the result for a given case.

get_current_response

Get the responses from a given output field for all cases.

get_output_fields

Get all output fields.

get_output_response

Get the responses from all output fields for a given case.

prepare

Prepare data for the optimisation.

read

Read the solver from the configuration dictionary.

solve

Solve all cases for the given set of parameter values.

get_case_params(param_hash: str) Dict[str, float][source]

Get the parameters for a given hash.

Parameters

param_hashstr

Hash of the case to load.

Returns

Dict[str, float]

Parameters for this hash.

get_case_result(param_hash: str) CaseResult[source]

Get the result for a given case.

Parameters

param_hashstr

Hash of the case to load.

Returns

CaseResult

Result for this hash.

get_current_response() Dict[str, OutputResult]

Get the responses from a given output field for all cases.

Returns

Dict[str, OutputResult]

Output responses.

get_output_fields() List[str][source]

Get all output fields.

Returns

List[str]

Output fields.

get_output_response(param_hash: str) Dict[str, OutputResult][source]

Get the responses from all output fields for a given case.

Parameters

param_hashstr

Hash of the case to load.

Returns

Dict[str, OutputResult]

Output responses.

prepare() None[source]

Prepare data for the optimisation.

abstract classmethod read(config: Dict[str, Any], parameters: ParameterSet, output_dir: str) T

Read the solver from the configuration dictionary.

Parameters

configDict[str, Any]

Configuration dictionary.

parametersParameterSet

Parameter set for this problem.

output_dirstr

Path to the output directory.

Returns

Solver

Solver to use for this problem.

solve(values: ndarray, concurrent: bool) Dict[str, OutputResult][source]

Solve all cases for the given set of parameter values.

Parameters

valuesarray

Current parameters to evaluate.

concurrentbool

Whether this run may be concurrent to another one (so use unique file names).

Returns

Dict[str, OutputResult]

Evaluated results for each output field.