relentless.optimize.ObjectiveFunctionResult#

class relentless.optimize.ObjectiveFunctionResult(variables=None, value=None, gradient=None, directory=None)#

Class storing the value and gradient of a ObjectiveFunction.

Parameters:
  • variables (Variable or tuple) – Variables to stash values (defaults to None).

  • value (float) – The value of the objective function (defaults to None).

  • gradient (dict) – The gradient of the objective function. Each partial derivative is keyed on the IndependentVariable with respect to which it is taken (defaults to None).

  • directory (Directory) – Directory holding written output associated with result. Setting a value of None indicates no written output (defaults to None).

Raises:

KeyError – If both variables and gradient are defined but their keys don’t match.

Methods

save(filename)

Save the result as a JSON file.

Attributes

directory

Directory Directory holding written output.

gradient

The gradient of the objective function, keyed on its design variables.

value

The value of the evaluated objective function.

variables

Recorded variables of the ObjectiveFunction.

property directory#

Directory Directory holding written output.

property gradient#

The gradient of the objective function, keyed on its design variables.

Type:

KeyedArray

save(filename)#

Save the result as a JSON file.

Parameters:

filename (str) – The name of the file to save data in.

property value#

The value of the evaluated objective function.

Type:

float

property variables#

Recorded variables of the ObjectiveFunction.

Type:

KeyedArray