MUQ  0.4.3
ModPieceCostFunction.h
Go to the documentation of this file.
1 #ifndef MODPIECECOSTFUNCTION_H_
2 #define MODPIECECOSTFUNCTION_H_
3 
5 
6 namespace muq {
7  namespace Optimization {
9  public:
10 
11  ModPieceCostFunction(std::shared_ptr<muq::Modeling::ModPiece> cost, double scaleIn=1.0);
12 
13  virtual ~ModPieceCostFunction() = default;
14 
16  virtual double Cost() override;
17 
19  virtual Eigen::VectorXd Gradient() override;
20 
21  // Apply the Hessian to a vector
22  virtual Eigen::VectorXd ApplyHessian(Eigen::VectorXd const& vec) override;
23 
24  private:
25 
26  // The muq::Modeling::ModPiece that holds the cost
27  std::shared_ptr<muq::Modeling::ModPiece> cost;
28 
29  const double scale;
30  };
31  } // namespace Optimization
32 } // namespace muq
33 
34 #endif
The cost function for an optimization routine.
Definition: CostFunction.h:74
std::shared_ptr< muq::Modeling::ModPiece > cost
virtual double Cost() override
The value of the cost function.
virtual Eigen::VectorXd Gradient() override
Compute the gradient of the cost function.
virtual Eigen::VectorXd ApplyHessian(Eigen::VectorXd const &vec) override
ModPieceCostFunction(std::shared_ptr< muq::Modeling::ModPiece > cost, double scaleIn=1.0)