123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- //////////////////////////////////////////////////////////////////////
- //
- // DimWrapperCostFunction.h:
- // Defines a wrapper around a cost function. Given a parameter matrix (parameter initalizations) and a selection matrix a flexible optimization of different, individual parameters becomes possible.
- // Written By: Matthias Wacker, Esther Platzer
- //
- //////////////////////////////////////////////////////////////////////
- #ifndef _DIMWRAP_COST_FUNCTION_H_
- #define _DIMWRAP_COST_FUNCTION_H_
- //#include "Optimizable.h"
- #include "optimization/CostFunction.h"
- #include "optimization/Opt_Namespace.h"
- namespace opt=optimization;
- class DimWrapperCostFunction : public CostFunction
- {
- public:
- typedef CostFunction SuperClass;
-
- /*!
- DefaultConstructor
- */
- DimWrapperCostFunction();
- /*!
- * Useful constructor
- *
- * @param orig pointer to the original cost function with paramDim dim_orig
- * @param selectionVecotor (dim_orig x 1) selection vector with nonzero values
- * for the ones that should be used in new costfunction
- * @param fixedValues vector to be able to specify fixed values for the unused paramters
- *
- * the parameters of this costfunction will be mapped to the original ones. Offset will be
- * added to the paramter vector. evaluate() will return the result of the original function
- *
- * x_orig = m_selMatTransposed * x_this + fixedValues
- * */
- DimWrapperCostFunction(CostFunction *orig, const opt::matrix_type &selectionVector, const opt::matrix_type &fixedValues);
- /*!
- * copy constructor
- *
- * */
- DimWrapperCostFunction(const DimWrapperCostFunction & costFunc);
-
- /*!
- Destructor.
- */
- virtual ~DimWrapperCostFunction();
- /*!
- =operator
- */
- DimWrapperCostFunction &operator=(const DimWrapperCostFunction &costFunc);
- /*!
- *
- * @param selectionVecotor (dim_orig x 1) selection vector with nonzero values
- * for the ones that should be used in new costfunction
- * @param fixedValues vector to be able to specify fixed values for the unused paramters
- * */
- void changeSelection(const opt::matrix_type & selectionVector, const opt::matrix_type &fixedValues);
- /*!
- Initialization for the cost function
- */
- virtual void init();
-
- /*!
- *
- * */
- virtual double evaluate(const opt::matrix_type ¶meter);
-
- /**
- * Returns the current full parameter vector (no dimension reduction for inactive params)
- * @param x the current parameter vector containing just active parameters
- * @return the full parameter vector with current active params
- */
- virtual opt::matrix_type getFullParamsFromSubParams(const opt::matrix_type &x);
-
- /*!
- set an x0 for 1dim line search
- */
- //virtual bool setX0(const opt::matrix_type &x0);
-
- /*!
- set an h0 for 1dim line search
- */
- //virtual bool setH0(const opt::matrix_type &H0);
-
- /*!
- evaluate 1dimension sub function fsub(lambda) = f(x0 + lambda * h0)
- */
- //virtual double evaluateSub(double lambda);
- private:
-
- /*!
- * the original costfunciton
- *
- *
- * */
- CostFunction *m_pOrigCostFunc;
- /*!
- * this is the mapping matrix
- *
- * x_orig = m_selMatTransposed * x + offset
- *
- * */
- opt::matrix_type m_selMatTransposed;
- /*!
- * fixed values
- *
- * */
- opt::matrix_type m_fixedValues;
-
- // //! x_0
- //opt::matrix_type m_x_0;
- // //! direction h_0
- //opt::matrix_type m_h_0;
- };
- #endif
|