20 #ifndef MIRTK_ObjectiveFunction_H 21 #define MIRTK_ObjectiveFunction_H 23 #include "mirtk/Observable.h" 65 virtual void Put(
const double *x) = 0;
72 virtual double Get(
int i)
const = 0;
82 virtual void Get(
double *x)
const = 0;
96 virtual double Step(
double *dx) = 0;
102 virtual void Update(
bool gradient =
true);
120 virtual double Value() = 0;
154 virtual void Gradient(
double *dx,
double step = .0,
bool *sgn_chg =
nullptr) = 0;
165 virtual double GradientNorm(
const double *dx)
const = 0;
172 virtual void GradientStep(
const double *dx,
double &min,
double &max)
const;
189 virtual double Evaluate(
double *dx = NULL,
double step = .0,
bool *sgn_chg = NULL);
236 if (step <= .0) step = _StepLength;
239 return this->
Value();
245 #endif // MIRTK_ObjectiveFunction_H virtual void AddConstraintGradient(double *dx, double step=.0, bool *sgn_chg=nullptr)
virtual double Step(double *dx)=0
virtual void Put(const double *x)=0
virtual double Get(int i) const =0
virtual int NumberOfDOFs() const =0
virtual double Evaluate(double *dx=NULL, double step=.0, bool *sgn_chg=NULL)
virtual void Update(bool gradient=true)
virtual void DataFidelityGradient(double *dx, double step=.0, bool *sgn_chg=nullptr)
mirtkAttributeMacro(double, StepLength)
Default step length used for gradient approximation.
virtual ~ObjectiveFunction()=0
Destructor.
virtual double Value()=0
Evaluate objective function value.
virtual double GradientNorm(const double *dx) const =0
virtual void GradientStep(const double *dx, double &min, double &max) const
virtual void Gradient(double *dx, double step=.0, bool *sgn_chg=nullptr)=0