123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //////////////////////////////////////////////////////////////////////
- //
- // CostFunction_ndim_2ndOrder.h: interface of a test CostFunction class.
- //
- // Written By: Matthias Wacker
- //
- // f(x) = 0.5 * x^T * A * x + b^T * x + c
- //
- //////////////////////////////////////////////////////////////////////
- #ifndef _COSTFUNCTION_NDIM_2NDORDER_H_
- #define _COSTFUNCTION_NDIM_2NDORDER_H_
- #include "core/optimization/blackbox/CostFunction.h"
- namespace OPTIMIZATION
- {
- class CostFunction_ndim_2ndOrder : public CostFunction
- {
- public:
- typedef CostFunction SuperClass;
- typedef SuperClass::matrix_type matrix_type;
-
- /*!
- default constructor
- */
- CostFunction_ndim_2ndOrder();
- /*!
- Constructor.
- \param dim of parameter space
- */
- CostFunction_ndim_2ndOrder(unsigned int dim);
-
- /*!
- Copy constructor
- \param func the function to copy
- */
- CostFunction_ndim_2ndOrder(const CostFunction_ndim_2ndOrder &func);
- /*!
- = operator
- */
- CostFunction_ndim_2ndOrder &operator=(const CostFunction_ndim_2ndOrder & func);
- /*!
- Destructor.
- */
- ~CostFunction_ndim_2ndOrder();
- /*!
- initializations
- */
- void init();
- /*!
- set A, b, and c
- \param A
- \param b
- \param c
- \return 0 in case of success.
- */
- int setAbc(const matrix_type & A,const matrix_type &b, double c);
- /*!
- evaluate the costfunction
- \param parameter to evaluate at
- */
- double evaluate(const matrix_type & parameter);
- /*!
- get the analytic Gradient
- */
- const matrix_type getAnalyticGradient(const matrix_type ¶meter);
-
- protected:
- /*!
- the matrix A of
- f(x) = 0.5 * x^T * A * x + b^T * x + c
-
- */
- matrix_type m_A;
- /*!
- the vector b^T of
- f(x) = 0.5 * x^T * A * x + b^T * x + c
- */
- matrix_type m_bt;
- /*
- the value c of
- f(x) = 0.5 * x^T * A * x + b^T * x + c
- */
- double m_c;
- }; //class
- }//namespace
- #endif
|