MeritFunction (base class)

class kona.algorithms.util.merit.MeritFunction(primal_factory, state_factory, optns={}, out_file=<open file '<stdout>', mode 'w'>)[source]

Bases: object

Base class for all merit functions.

Variables:
  • primal_factory (VectorFactory) – Generator for new primal vectors.
  • state_factory (VectorFactory) – Generator for new state vectors.
  • out_file (file) – File stream for writing data.
  • _allocated (boolean) – Flag to track whether merit function memory has been allocated.
Parameters:
eval_func(alpha)[source]

Evaluate merit function value at alpha

Parameters:alpha (float) –
Returns:float
Return type:Value of merit function alpha.
eval_grad(alpha)[source]

Evaluate merit function gradient \(\langle p, \nabla f \rangle\) at the given alpha

Note

This method can either pass or return 0 for gradient-free merit functions.

Parameters:alpha (float) –
Returns:float
Return type:Value of \(\langle p, \nabla f \rangle\) at alpha.
reset(search_dir, x_start, u_start, p_dot_grad=None)[source]

Reset the merit function at a new design and state point.

If merit memory is not yet allocated, this function should also do that.

Parameters:
  • search_dir (DesignVector or CompositePrimalVector) – Search direction vector in the primal space.
  • x_start (DesignVector) – Initial primal vector.
  • u_start (StateVector) – State vector corresponding to x_start.
  • p_dot_grad (float, optional) – Value of \(\langle p, \nabla f \rangle\) at x_start.