Class HierarchicalOptimizationReporter

Inheritance Relationships

Base Type

Class Documentation

class HierarchicalOptimizationReporter : public parpe::OptimizationReporter

The HierarchicalOptimizationReporter class saves optimization parameters of the inner optimization problem on each function evaluation which would be hidden from the (outer) optimizer otherwise.

Public Functions

HierarchicalOptimizationReporter(HierarchicalOptimizationWrapper *gradFun, std::unique_ptr<OptimizationResultWriter> rw, std::unique_ptr<Logger> logger)
virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, double &fval, gsl::span<double> gradient, Logger *logger = nullptr, double *cpuTime = nullptr) const override
virtual bool iterationFinished(gsl::span<const double> parameters, double objectiveFunctionValue, gsl::span<const double> objectiveFunctionGradient) const override

Is called after each iteration except for the last one.

Parameters:
  • parameters

  • objectiveFunctionValue

  • objectiveFunctionGradient

Returns:

Quit optimization?

virtual bool afterCostFunctionCall(gsl::span<const double> parameters, double objectiveFunctionValue, gsl::span<double const> objectiveFunctionGradient) const override
virtual void finished(double optimalCost, gsl::span<const double> parameters, int exitStatus) const override

Is called after optimization finished.

virtual std::vector<double> const &getFinalParameters() const override
FunctionEvaluationStatus evaluate(gsl::span<double const> parameters, double &fval, gsl::span<double> gradient) const

Evaluate the function f(x)

Parameters:
  • parameters – Point x at which to evaluate f(x). Must be of length numParameters().

  • fval – (output) Will be set to the function value f(x)

  • gradient – (output) If not gsl::span<double>(), will contain the gradient of f(x) at x. Must be of length numParameters().

Returns:

functionEvaluationSuccess on success, functionEvaluationFailure otherwise

FunctionEvaluationStatus evaluate(gsl::span<double const> parameters, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const = 0

Public Members

HierarchicalOptimizationWrapper *hierarchical_wrapper_ = nullptr
mutable std::vector<double> cached_full_parameters_
mutable std::vector<double> cached_full_gradient_