浏览代码

adapted include to new structure in core optimization

Alexander Freytag 12 年之前
父节点
当前提交
68b69707b2

+ 1 - 1
AdaptiveDirectionRandomSearchOptimizer.h

@@ -7,7 +7,7 @@
 #ifndef _ADAPTIVE_DIRECTION_RANDOM_SEARCH_OPTIMIZER_
 #define _ADAPTIVE_DIRECTION_RANDOM_SEARCH_OPTIMIZER_
 
-#include "optimization/SimpleOptimizer.h"
+#include "core/optimization/blackbox/SimpleOptimizer.h"
 #include "optimization/Opt_Namespace.h"
 namespace opt=optimization;
 

+ 1 - 1
CombinatorialOptimizer.h

@@ -8,7 +8,7 @@
 #define _COMBINATORIAL_OPTIMIZER_
 
 
-#include "optimization/SimpleOptimizer.h"
+#include "core/optimization/blackbox/SimpleOptimizer.h"
 #include "optimization/Opt_Namespace.h"
 namespace opt=optimization;
 

+ 0 - 119
CostFunction.cpp

@@ -1,119 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	CostFunction.cpp: implementation of the CostFunction class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "optimization/CostFunction.h"
-
-using namespace opt;
-
-CostFunction::CostFunction() : SuperClass()
-{
-	m_hasAnalyticGradient = false;
-	m_hasAnalyticHessian = false;
-	m_numEval = 0;
-
-}
-
-CostFunction::CostFunction(unsigned int numOfParameters) : SuperClass(numOfParameters)
-{
-	m_hasAnalyticGradient = false;
-	m_hasAnalyticHessian = false;
-	m_numEval = 0;
-}
-
-
-CostFunction::CostFunction(const CostFunction &func) : SuperClass(func)
-{
-	m_hasAnalyticGradient = func.m_hasAnalyticGradient;
-	m_hasAnalyticHessian = func.m_hasAnalyticHessian;
-	m_numEval = func.m_numEval;
-}
-
-CostFunction::~CostFunction()
-{
-}
-
-CostFunction &CostFunction::operator=(const CostFunction &func)
-{
-		
-	/*
-			avoid self-copy
-	*/
-	if(this != &func)
-	{
-		
-		/*
-			=operator of SuperClass
-		*/
-		SuperClass::operator=(func);
-
-		/*
-			own values:
-		*/
-		m_hasAnalyticGradient = func.m_hasAnalyticGradient;
-		m_hasAnalyticHessian = func.m_hasAnalyticHessian;
-		m_numEval = func.m_numEval;
-	
-	}
-
-  	return *this;
-}
-
-
-const matrix_type CostFunction::getAnalyticGradient(const matrix_type &x)
-{
-	/*
-		FIXME: WACKER: Throw exception as default behaviour ?
-	*/
-	
-	
-	return x * 0;
-}
-
-void CostFunction::init()
-{
-}
-
-const matrix_type CostFunction::getAnalyticHessian(const matrix_type &x)
-{
-	/*
-		FIXME: WACKER: Throw exception as default behaviour
-	*/
-	
-	
-	return x * !x *0.0;
-}
-
-bool CostFunction::setX0(const matrix_type &x0)
-{
-	if(x0.rows() == static_cast<int>(m_numOfParameters) && x0.cols() == 1)
-	{
-		m_x_0 = x0;
-		return true;
-	}
-	else
-		return false;
-}
-
-
-bool CostFunction::setH0(const matrix_type &H0)
-{
-	if(H0.rows() == static_cast<int>(m_numOfParameters) && H0.cols() == 1)
-	{
-		m_h_0 = H0;
-		return true;
-	}
-	else
-		return false;
-}
-
-double CostFunction::evaluateSub(double lambda)
-{
-	return evaluate(m_x_0 + m_h_0 * lambda);
-}
-
-

+ 0 - 142
CostFunction.h

@@ -1,142 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	CostFunction.h: interface of the CostFunction class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#ifndef _COST_FUNCTION_H_
-#define _COST_FUNCTION_H_
-
-#include "optimization/Optimizable.h"
-#include "optimization/Opt_Namespace.h"
-
-namespace opt=optimization;
-
-/*!
-    class Abstract base class for all cost functions.
- */
-
-class CostFunction : public Optimizable
-{
-	public:
-
-		typedef		Optimizable		SuperClass;
-		typedef	opt::matrix_type	matrix_type;
-		
-		/*!
-			DefaultConstructor
-		*/
-		CostFunction();
-
-		/*!
-			Constructor.
-			\param numOfParameters
-         	*/
-		CostFunction(unsigned int numOfParamters);
-        
-		/*
-			Copy constructor
-		*/
-		CostFunction(const CostFunction &func);
-
-		
-		/*!
-			Destructor.
-		*/
-	    virtual ~CostFunction();
-
-		/*!
-			=operator
-		*/
-		CostFunction &operator=(const CostFunction &costFunc);
-
-
-		inline bool hasAnalyticGradient(){return m_hasAnalyticGradient;}
-
-		/*!
-			get the analytic gradient
-		*/
-		virtual const opt::matrix_type getAnalyticGradient(const opt::matrix_type &x);
-		
-		
-		inline bool hasAnalyticHessian(){return m_hasAnalyticHessian;}
-
-		/*!
-			get the analytic hessian
-		*/
-		virtual const opt::matrix_type getAnalyticHessian(const opt::matrix_type & x);
-
-		/*!
-			get number of Evaluations
-		*/
-		inline unsigned int getNumberOfEvaluations(){return m_numEval;};
-
-		/*!
-			reset the evaluation counter
-		*/
-		inline void resetNumberOfEvaluations(){m_numEval = 0;};
-
-		/*!
-			Initialization for the cost function
-		 */
-		virtual void init();
-
-		/*!
-			set an x0 for 1dim line search
-		*/
-		bool setX0(const opt::matrix_type &x0);
-
-		/*!
-			set an h0 for 1dim line search
-		*/
-		bool setH0(const opt::matrix_type &H0);
-
-		/*!
-			evaluate 1dimension sub function fsub(lambda) = f(x0 + lambda * h0) 
-		*/
-		double evaluateSub(double lambda);
-
-		/*!
-		 * This function returns the full parameter vector. If the costfunction performs dimension reduction
-		 * this method will return the current parameter vector with full dimension. Otherwise the costfunction works with
-		 * the full parameter vector in any case and it is returned unchanged.
-		 * @param x current parameter vector (from optimizer)
-		 * @return full parameter vector
-		 */
-		virtual opt::matrix_type getFullParamsFromSubParams(const opt::matrix_type &x)
-		{
-		  matrix_type fullparamvec(x);
-		  return x;
-		}
-
-	protected:
-
-		/*!
-			has analytic gradient ?
-		*/
-		bool m_hasAnalyticGradient;
-	
-		/*!
-			has analytic hessian ?
-		*/
-		bool m_hasAnalyticHessian;
-
-		/*!
-			x_0		
-		*/
-		opt::matrix_type m_x_0;
-
-		/*!
-			direction h_0
-		*/
-		opt::matrix_type m_h_0;
-
-		/*!
-			number of evaluations
-		*/
-		unsigned int m_numEval;
-};
-
-#endif

+ 1 - 1
CostFunction_ndim_2ndOrder.cpp

@@ -8,7 +8,7 @@
 //////////////////////////////////////////////////////////////////////
 
 
-#include "optimization/CostFunction_ndim_2ndOrder.h"
+#include "core/optimization/blackbox/CostFunction_ndim_2ndOrder.h"
 
 using namespace opt;
 

+ 1 - 1
CostFunction_ndim_2ndOrder.h

@@ -11,7 +11,7 @@
 #ifndef _COSTFUNCTION_NDIM_2NDORDER_H_
 #define _COSTFUNCTION_NDIM_2NDORDER_H_
 
-#include "optimization/CostFunction.h"
+#include "core/optimization/blackbox/CostFunction.h"
 
 class CostFunction_ndim_2ndOrder : public CostFunction
 {

+ 1 - 1
DerivativeBasedOptimizer.h

@@ -10,7 +10,7 @@
 #define _DERIVATIVE_BASED_OPTIMIZER_H_
 
 
-#include "optimization/SimpleOptimizer.h"
+#include "core/optimization/blackbox/SimpleOptimizer.h"
 
 /*!
 	class Abstract base class of all derivative based optimizers.

+ 0 - 155
DimWrapperCostFunction.cpp

@@ -1,155 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	DimWrapperCostFunction.cpp: implementation of the DimWrapperCostFunction class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <iostream>
-#include "DimWrapperCostFunction.h"
-
-DimWrapperCostFunction::DimWrapperCostFunction() : SuperClass()
-{
-	m_pOrigCostFunc=NULL;
-	m_numOfParameters=0;
-}
-
-
-DimWrapperCostFunction::DimWrapperCostFunction(const DimWrapperCostFunction &func) : SuperClass(func)
-{
-	m_pOrigCostFunc= func.m_pOrigCostFunc;
-	m_selMatTransposed = func.m_selMatTransposed;
-	m_fixedValues = func.m_fixedValues;
-}
-
-DimWrapperCostFunction::~DimWrapperCostFunction()
-{
-	// nothing dynamically allocated..
-}
-
-DimWrapperCostFunction::DimWrapperCostFunction(CostFunction *orig, const matrix_type &selectionVector,
-						const matrix_type &fixedValues)
-{
-	if(orig == NULL)
-	{
-		std::cerr << "DimWrapperCostFunction::DimWrapperCostFunction NULL pointer error" << std::endl;
-		exit(1);
-	}
-	m_pOrigCostFunc = orig;
-
-	changeSelection(selectionVector,fixedValues);
-
-}
-
-
-void DimWrapperCostFunction::changeSelection(const matrix_type & selectionVector, const matrix_type &fixedValues)
-{
-	// BUILD MATRIX
-	//count nonzero values:
-	m_fixedValues=fixedValues;
-	int count=0;
-	int dim = selectionVector.rows();
-	std::vector<int> indices;
-	for(int i=0; i < dim ; ++i)
-	{
-		if (selectionVector[i][0] != 0.0 )
-		{
-			count++;
-			indices.push_back(i);
-			m_fixedValues[i][0]= 0.0; // resets fixed values to zero for active params
-		}
-	}
-	m_numOfParameters = count;	
-	m_selMatTransposed = matrix_type(dim,count);
-	for(int i =0; i < m_selMatTransposed.rows(); ++i)
-	{
-		for(int j =0; j < m_selMatTransposed.cols(); ++j)
-		{
-			if( indices[j]==i )
-			{
-				m_selMatTransposed[i][j]=1.0;
-			}
-			else
-			{
-				m_selMatTransposed[i][j]=0.0;
-			}
-		}
-	}
-}
-
-DimWrapperCostFunction &DimWrapperCostFunction::operator=(const DimWrapperCostFunction &func)
-{
-		
-	/*
-			avoid self-copy
-	*/
-	if(this != &func)
-	{
-		
-		/*
-			=operator of SuperClass
-		*/
-		SuperClass::operator=(func);
-
-		/*
-			own values:
-		*/
-		m_pOrigCostFunc= func.m_pOrigCostFunc;
-		m_selMatTransposed = func.m_selMatTransposed;
-		m_fixedValues = func.m_fixedValues;
-	
-	}
-
-  	return *this;
-}
-
-
-void DimWrapperCostFunction::init()
-{
-	m_pOrigCostFunc->init();
-}
-
-double DimWrapperCostFunction::evaluate(const matrix_type &x)
-{
-	return m_pOrigCostFunc->evaluate(m_selMatTransposed * x + m_fixedValues);
-}
-
-opt::matrix_type DimWrapperCostFunction::getFullParamsFromSubParams(const opt::matrix_type &x)
-{
-    return m_selMatTransposed * x + m_fixedValues;
-}
-
-/*bool DimWrapperCostFunction::setX0(const opt::matrix_type &x0)
-{
-	cout<<"dimWrapperCF - setX0"<<endl;
-	if(x0.rows() == static_cast<int>(m_numOfParameters) && x0.cols() == 1)
-	{
-		cout<<"set m_x_0"<<endl;
-		m_x_0 = x0;
-		return true;
-	}
-	else
-		return false;
-}
-		
-
-bool DimWrapperCostFunction::setH0(const opt::matrix_type &H0)
-{
-	cout<<"dimWrapperCF - setH0"<<endl;
-	if(H0.rows() == static_cast<int>(m_numOfParameters) && H0.cols() == 1)
-	{
-		m_h_0= H0;
-		return true;
-	}
-	else
-		return false;
-}
-		
-
-double DimWrapperCostFunction::evaluateSub(double lambda)
-{
-	cout<<"dimWrapperCF - evalSub"<<endl;
-	double eval= evaluate(m_x_0 + m_h_0 * lambda);
-	return eval;
-}*/

+ 0 - 132
DimWrapperCostFunction.h

@@ -1,132 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	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 &parameter);
-		
-		/**
-		 * 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

+ 0 - 640
DownhillSimplexOptimizer.cpp

@@ -1,640 +0,0 @@
-/**
-*
-*	@file: DownhillSimplexOptimizer.cpp: implementation of the downhill Simplex Optimier
-*
-*	@author: Matthias Wacker, Esther Platzer, Alexander Freytag
-*
-*/
-
-#include <iostream>
-
-#include "mateigen.h" // for SVD
-
-#include "optimization/DownhillSimplexOptimizer.h"
-#include "optimization/Opt_Namespace.h"
-
-
-
-
-using namespace optimization;
-
-DownhillSimplexOptimizer::DownhillSimplexOptimizer(OptLogBase *loger): SuperClass(loger)
-{
-  m_abort = false;
-  m_simplexInitialized = false;
-  //note that we use the negative value of alpha in amoeba
-  m_alpha = 1.0;
-  m_beta = 0.5;
-  // m_gamma was previously 1.0, but this actually deactivates extrapolation. We use 2.0 as suggested in Num. Recipes
-  m_gamma = 2.0;
-  m_rankdeficiencythresh = 0.01;
-  m_rankcheckenabled = false;
-}
-
-DownhillSimplexOptimizer::DownhillSimplexOptimizer(const DownhillSimplexOptimizer &opt) : SuperClass(opt)
-{
-  m_abort = opt.m_abort;
-  m_simplexInitialized = opt.m_simplexInitialized;
-  m_vertices = opt.m_vertices;
-  m_y = opt.m_y;
-  m_alpha = opt.m_alpha;
-  m_beta = opt.m_beta;
-  m_gamma = opt.m_gamma;
-  m_rankdeficiencythresh= 0.01;
-  m_rankcheckenabled= false;
-}
-
-DownhillSimplexOptimizer::~DownhillSimplexOptimizer()
-{
-}
-
-bool DownhillSimplexOptimizer::setWholeSimplex(const matrix_type &simplex)
-{
-  if(simplex.rows() == static_cast<int>(m_numberOfParameters) && simplex.cols() == static_cast<int>(m_numberOfParameters + 1))
-  {
-    //Check if simplex has rank(simplex)=numberOfParameters
-    //otherwise return false because of bad posed simplex 
-    if(m_rankcheckenabled)
-    {
-        int rank = getRank(simplex, m_rankdeficiencythresh);
-        
-        if(rank < static_cast<int>(m_numberOfParameters))
-        {
-            m_simplexInitialized = false;
-            return false;
-        }
-    }
-
-    m_vertices = simplex;
-    m_simplexInitialized = true;
-    
-    for (int k = 0; k < static_cast<int>(m_numberOfParameters +1); k++)
-    {
-        m_y[k][0] = evaluateCostFunction(m_vertices(0,k,m_numberOfParameters-1,k));
-    }
-        
-    return true;
-  }
-  else
-  {
-    m_simplexInitialized = false;
-    return false;
-  }
-}
-
-void DownhillSimplexOptimizer::init()
-{
-  SuperClass::init();
-  
-  // allocate matrices
-  m_vertices = matrix_type(m_numberOfParameters, m_numberOfParameters + 1);
-  m_y = matrix_type(m_numberOfParameters + 1,1);
-
-  m_abort = false;
-  
-  //this forces a re-initialization in all cases
-  //it is even more advisable, if we would perform a random initialization
-  m_simplexInitialized == false;
-
-  // previously, we did a random initialization
-  // right now, we rely on our first guess and move it in one dimension by m_scales[i]
-  // as suggested in Numerical Recipes
-  if (m_simplexInitialized == false)
-  {
-    //this aborting stuff was formerly needed to ensure a valid simplex for random initializations
-    bool abort = false;
-    while(abort == false)
-    {
-      matrix_type simplex(m_numberOfParameters,m_numberOfParameters+1);      
-
-      //move every point in a single dimension by m_scales[i]
-      //we first iterate over dimensions
-      for(int i = 0; i < static_cast<int>(m_numberOfParameters); i++)
-      {
-        //and internally over the different points
-        for(int j = 0; j < static_cast<int>(m_numberOfParameters+1); j++)
-        {
-          simplex[i][j] = m_parameters[i][0];
-          
-          if( j == i+1 )
-          {
-            double tmpRand = m_scales[i][0];// * ((double)rand()) / RAND_MAX;
-            simplex[i][j] += tmpRand;
-          }
-        }
-      }
-      
-      //evaluate function values in simplex corners and 
-      //check if simplex is degenerated (less than d dimensions)
-      if(this->setWholeSimplex(simplex) == true)
-      {
-        // simplexInitializen is only to indicate manual initialization ..
-        //actually, this is not needed anymore.
-        m_simplexInitialized = false;
-        //we computed a valid solution, so break the while loop
-        //actually, this is always the case, since we de-activated the random init
-        abort =true;
-      }
-    }
-  }
-  // if the simplex was already initialized, we only have to compute the function values
-  // of its corners
-  else
-  {
-    //compute the function values of the initial simplex points
-    for (int k = 0; k < static_cast<int>(m_numberOfParameters +1); k++)
-    {
-      m_y[k][0] = evaluateCostFunction(m_vertices(0,k,m_numberOfParameters-1,k));
-    }
-  }
-}
-
-
-int DownhillSimplexOptimizer::optimize()
-{
-  //before optimizing, we initialize our simplex in all cases
-  // if you are pretty sure, that you already have a suitable initial
-  // simplex, you can skip this part
-  
-  //if(m_simplexInitialized == false)
-  //{
-      this->init();
-  //}
-
-  if(m_loger)
-    m_loger->logTrace("Starting Downhill Simplex Optimization\n");
-
-  //tmp contains the index of the best vertex point after running DHS
-  int tmp=amoeba();
-  m_parameters = m_vertices(0,tmp,m_numberOfParameters-1,tmp);
-
-  //final evaluation of the cost function with our optimal parameter settings
-  m_currentCostFunctionValue = evaluateCostFunction(m_parameters);
-  return m_returnReason;
-}
-
-
-/*
-* Taken from Numerical Recipies in C
-*/
-int DownhillSimplexOptimizer::amoeba()
-{
-  //define the desired tolerance of our solution
-  double tol = m_funcTol;
-
-  //how many parameters do we optimize?
-  const int ndim=m_numberOfParameters;
-  if (m_verbose)
-  {
-    std::cerr << "ndim: " << ndim << std::endl;
-  }  
-
-  // number of vertices
-  const int spts=ndim+1;
-  int i,j, max_val;
-    
-  // index of worst (lowest) vertex-point
-  int ilo;
-  // index of best (hightest) vertex point
-  int ihi;
-  // index of second worst (next hightest) vertex point
-  int inhi;
-
-  double rtol,ytry;
-    
-  // buffer to save a function value 
-  double ysave;
-  matrix_type psum(1,ndim);
-
-  //start time criteria
-  m_startTime = clock();
-
-  // get sum of vertex-coordinates
-  for (j=0;j<ndim;j++)
-  { 
-    double sum(0.0);
-    for (i=0;i<spts;i++)
-      sum += m_vertices[j][i];
-    psum[0][j]=sum;
-  }
-    
-  if (m_verbose)
-  {
-    std::cerr << "initial psum: ";
-    for (j=0;j<ndim;j++)
-    { 
-      std::cerr << psum[0][j] << " " ;
-    }
-    std::cerr << std::endl;    
-  }
-  
-  // loop until terminating
-  //this is our main loop for the whole optimization
-  for (;;)
-  {
-    //what is our current solution?
-    if(m_verbose)
-    {
-      for(int u = 0; u < ndim+1; u++)
-      {
-        for(int v = 0; v < ndim ; v++)
-        {
-          std::cerr << m_vertices[v][u] << " ";
-        }
-        std::cerr<< " " << m_y[u][0] << std::endl;
-      }
-      std::cerr << std::endl;
-    }
-
-
-    // first we must determine 
-    // which point is highest, 
-    // next-highest
-    // and lowest
-    // by looping over the simplex
-    ilo = 0;
-
-    //this works only, if m_numberOfParameters=ndim >= 2
-    if(ndim >= 2)
-    {
-      ihi = m_y[1][0]>m_y[2][0] ? (inhi=1,2) : (inhi=2,1); 	 
-      for (i=0;i<spts;i++)
-      {					 	               		
-        if (m_y[i][0] <= m_y[ilo][0]) ilo=i;
-        if (m_y[i][0] > m_y[ihi][0]) {
-          inhi=ihi;
-          ihi=i;
-        }
-        else
-          if (m_y[i][0] > m_y[inhi][0])
-            if (i != ihi) 
-              inhi=i;
-      }
-    }
-    //if we have less than 3 dimensions, the solution is straight forward
-    else
-    {
-      if(m_y[0][0]>m_y[1][0])
-      {
-        ilo  = 1;
-        inhi = 1;
-        ihi  = 0;
-      }
-      else
-      {
-        ilo  = 0;
-        inhi = 0;
-        ihi  = 1;
-      }
-    }
-    
-    // log parameters if parameter logger is given (does nothing for other loggers!)
-    if(m_loger)
-    {
-      // extract optimal parameters from simplex
-      matrix_type optparams(m_vertices.rows(),1,0);
-
-      for(int i= 0; i< m_vertices.rows(); ++i)
-      {
-          optparams[i][0]= m_vertices[i][ilo];
-      }
-      matrix_type fullparams= m_costFunction->getFullParamsFromSubParams(optparams);
-      m_loger->writeParamsToFile(fullparams);
-    }
-    
-    //Check m_abort .. outofbounds may have occurred in amotry() of last iteration
-    if(m_abort == true)
-    {
-      break;
-    }
-
-    //Check time criterion
-    //in the default setting, this is deactivated
-    if(m_maxSecondsActive)
-    {
-      m_currentTime = clock();
-
-      /* time limit exceeded ? */
-      if(((float)(m_currentTime - m_startTime )/CLOCKS_PER_SEC) >= m_maxSeconds )
-      {
-        /* set according return status and end optimization */
-        m_returnReason = SUCCESS_TIMELIMIT;
-        break;
-      }
-    }
-
-    
-    //check functol criterion
-    if(m_funcTolActive == true)
-    {
-      // compute the fractional 
-      // range from highest to lowest    
-      // avoid division by zero
-      rtol=2.0*fabs(m_y[ihi][0]-m_y[ilo][0])/(fabs(m_y[ihi][0])+fabs(m_y[ilo][0])+1e-10);
-      
-      #ifdef OPT_DEBUG        
-        std::cout<<"rtol"<<"  "<<rtol<< std::endl;
-      #endif    
-      
-      // if the found solution is satisfactory, than terminate
-      if (rtol<tol)  
-      {
-        // save lowest value, which is our desired solution
-        max_val=(int)m_y[ilo][0];
-        m_returnReason = SUCCESS_FUNCTOL;
-        //break the main loop and end this method
-        break;
-      }
-    }
-
-    //check param tol criterion
-    if (m_paramTolActive == true)
-    {
-      // get norm of
-      //matrix_type tmp = m_vertices(0,ihi,m_numberOfParameters-1,ihi) - m_vertices(0,ilo,m_numberOfParameters,ilo);
-      //double norm)
-      if (   (m_vertices(0,ihi,m_numberOfParameters-1,ihi) - 
-        m_vertices(0,ilo,m_numberOfParameters-1,ilo)).Norm(0) < m_paramTol)
-      {
-        /*
-          set according return reason and end optimization
-        */
-        m_returnReason = SUCCESS_PARAMTOL;
-        break;
-      }
-    }
-    
-    m_numIter++;
-
-    //check max num iter criterion
-    if(m_maxNumIterActive == true)
-    {
-      if (m_numIter >= m_maxNumIter)
-      {										
-        //max_val=(int)m_y[ilo][0];
-        m_returnReason = SUCCESS_MAXITER;
-        break;
-      }
-    }
-    
-    //informative output
-    if (m_verbose)
-    {    
-      std::cerr << "start new iteration with amotry -alpha, i.e., reflect worst point through simplex" << std::endl;
-    }
-
-    // Begin a new iteration. 
-    // First extrapolate by the 
-    // factor alpha through the 
-    // face of the simplex across 
-    // from the high point, i.e. 
-    // reflect the simplex from the
-    // high point:
-    ytry=amotry(psum,ihi,-m_alpha);
-    //did we got a new point better than anything else so far?
-    if (ytry < m_y[ilo][0])
-    {
-      //informative output
-      if (m_verbose)
-      {
-        std::cerr << "reflected point is better than best point, perform further extrapolation with gamma" << std::endl;
-      }
-
-      // result is better than best
-      // point, try additional 
-      // extrapolation
-      ytry=amotry(psum,ihi,m_gamma);
-      
-      #ifdef OPT_DEBUG        
-        std::cout<<"Case one .. reflected highest through simplex" << std::endl;
-      #endif
-    }
-    //new point is not better as anything else
-    else
-    {
-      //perhaps it is better than our second worst point
-      if (ytry >= m_y[inhi][0]) 
-      {
-        //informative output
-        if (m_verbose)
-        {
-          std::cerr << "reflected point is worse then second worst, looking for intermediate point with beta" << std::endl;
-        }
-
-        // The reflected point is worse
-        // than the second worst
-        ysave=m_y[ihi][0];
-
-        // let's  look for an intermediate lower point.
-        ytry=amotry(psum,ihi,m_beta);
-        #ifdef OPT_DEBUG        
-          std::cout<<"Case two .. looking for intermediate point" << std::endl;
-        #endif   
-        //unfortunately, the intermediate point is still worse
-        //then the original one
-        if (ytry >= ysave)
-        {
-          #ifdef OPT_DEBUG        
-            std::cout<<"Case three .. contract around lowest point" << std::endl;
-          #endif 
-          //informative output
-          if (m_verbose)
-          {
-            std::cerr <<  "Intermediate point is also worse, contract around current best point with factor 0.5." << std::endl;
-          }
-          // Since we can't get rid 
-          // of that bad point, we better 
-          // our simplex around the current best point
-          // note: contraction is performed by a factor of 0.5
-          // as suggested in Numerical Recipes
-          
-          //contract all points
-          for (i=0;i<spts;i++) 
-          {
-            // but the best point has not to be contracted
-            if (i!=ilo) 
-            {
-              //contract in every dimension
-              for (j=0;j<ndim;j++) 
-              {
-                psum[0][j]=0.5*(m_vertices[j][i]+m_vertices[j][ilo]); 
-                #ifdef OPT_DEBUG                    
-                printf("psum(%d)=%f\n",j,psum[0][j]);
-                #endif                  
-                m_vertices[j][i]=psum[0][j];
-              }
-              //TODO what does this?
-              if (checkParameters(!psum)) 
-              {
-                m_y[i][0]=	evaluateCostFunction(!psum); 
-                // count function evaluations
-                //not needed in the current implementation
-                //eval_count++; 
-              }
-              else
-              {    
-                m_returnReason = ERROR_XOUTOFBOUNDS; // out of domain !!!
-                break;
-              }
-            }
-            // update psum: get sum of vertex-coordinates
-            for (j=0;j<ndim;j++)
-            {
-              double sum=0.0;
-              for (int ii=0;ii<spts;ii++)
-                sum += m_vertices[j][ii];
-              psum[0][j]=sum;
-            }//for
-              }//for-loop for contracting all points
-        }//if (ytry >= ysave)
-      }//if (ytry >= m_y(inhi))
-    }//else
-  }// next iteration
-   
-  // finally, return index of best point
-  return ilo;
-}
-
-
-double DownhillSimplexOptimizer::amotry(matrix_type & psum, int ihi, double fac)
-{
-    // extrapolate by a factor fac through the face of the simplex across
-    // from the low point, try this point it, and replace the low point if
-    // the new point is better
-    
-    const double maxreal= (m_maximize == true)? -1.0e+300 : 1.0e+300;
-    double fac1,fac2,ytry;
-    int ndim=m_numberOfParameters;
-    matrix_type ptry(1,ndim);
-    
-    //compute the factors as suggested in Numerical Recipes
-    fac1=(1.0-fac)/ndim;
-    fac2=fac1-fac;
-      
-    //compute the new point by performing a weighted superposition of the previous point and the surface of our simplex
-    for (int j=0;j<ndim;j++) 
-    {
-      ptry[0][j]=psum[0][j]*fac1-m_vertices[j][ihi]*fac2;
-    }
-
-    //informative output
-    if (m_verbose)
-    {
-      std::cerr << "amotry fac: " <<  fac << std::endl;
-      std::cerr << "fac1: " << fac1 << " fac2: " << fac2 << std::endl;
-      std::cerr << "ptry: ";
-      for (int j=0;j<ndim;j++) 
-      {
-        std::cerr << ptry[0][j] << " ";
-      }
-      std::cerr << std::endl;
-      
-    }
-    
-    //is the new point valid?
-    if (checkParameters(!ptry)) 
-    { 
-      // evaluate function at the 
-      // new trial point
-      ytry=evaluateCostFunction(!ptry);
-                         
-      // count function evaluations
-      //not needed in the current implementation      
-      // eval_count++;
-      
-      // if the new point is better than the old one
-      // we replace the old one with the new point
-      if (ytry<m_y[ihi][0])
-      {
-        //save function value of the new point
-        m_y[ihi][0]=ytry;
-        
-        //update the surface of our simplex
-        for (int j=0; j<ndim;j++)
-        {
-          // update psum
-          psum[0][j] = psum[0][j] + ptry[0][j]-m_vertices[j][ihi];
-          // replace lowest point
-          m_vertices[j][ihi]=ptry[0][j];
-        }
-      }
-    }
-    // out of domain
-    else 
-    {
-      ytry=maxreal;
-      m_abort = true;
-      m_returnReason = ERROR_XOUTOFBOUNDS;     
-    }
-    return ytry;
-}
-
-
-void DownhillSimplexOptimizer::setDownhillParams(const double alpha, const double beta, const double gamma)
-{
-  m_alpha = alpha;
-  m_beta = beta;
-  m_gamma = gamma;
-}
-
-
-void DownhillSimplexOptimizer::setRankDeficiencyThresh(float rankdeficiencythresh)
-{
-    m_rankdeficiencythresh= rankdeficiencythresh;
-}
-
-
-void DownhillSimplexOptimizer::setRankCheckStatus(bool status)
-{
-    m_rankcheckenabled= status;
-}
-
-double DownhillSimplexOptimizer::getDownhillParameterAlpha() const
-{
-  return m_alpha;
-}
-
-double DownhillSimplexOptimizer::getDownhillParameterBeta() const
-{
-  return m_beta;
-}
-
-double DownhillSimplexOptimizer::getDownhillParameterGamma() const
-{
-  return m_gamma;
-}
-
-
-bool DownhillSimplexOptimizer::getRankCheckStatus()
-{
-    return m_rankcheckenabled;
-}
-
-
-unsigned int getRank(const matrix_type &A,double numZero)
-{
-  unsigned int tmpCount = 0;
-  matrix_type U,s,Vt;
-
-  if(A.rows() < A.cols())
-  {
-    // call of the singular value decomp.
-    SingularValueDcmp(!A, U, s, Vt);
-  }
-  else
-  {
-    // call of the singular value decomp.
-    SingularValueDcmp(A, U, s, Vt);
-  }
-  
-  // count singular values > numZero
-  for(int i= 0; i < s.rows();i++)
-  {
-    if( s[i][i] > numZero )
-    {
-      tmpCount++;
-    }
-  }
-  
-  return tmpCount;
-}

+ 0 - 212
DownhillSimplexOptimizer.h

@@ -1,212 +0,0 @@
-///
-///
-/// @file: DownhillSimplexOptimizer.h: interface of the downhill Simplex Optimier
-/// @author: Matthias Wacker, Esther Platzer, Alexander Freytag
-/// @date: 27-09-2012 (last updated)
-///
-///
-
-#ifndef _DOWNHILL_SIMPLEX_OPTIMIZER_H_
-#define _DOWNHILL_SIMPLEX_OPTIMIZER_H_
-
-#include <cmath>
-#include "optimization/SimpleOptimizer.h"
-
-///
-/// @class DownhillSimplexOptimizer
-///
-///  HowToUse:
-///
-///  * use setWholeSimplex to initialize the whole simplex OR use setParameters()
-///  * use setParameters() to specify one point of the simplex (currently not implemented)
-///    the init call will then generate random disturbations to 
-///    generate a full rank simplex
-///  * use setDownhillParams() to use others than the default to "move"
-///    the simplex
-///  * call init() for setting up everything and evaluate your function on your initial simplex
-///  * call optimize() to run the actual optimization
-///
-///
-/// Implemented Abort criteria:
-///
-///  * maximum number of iterations (currently deactivated)
-///  * time limit exceeded (default: deactivated)
-///  * parameter bounds
-///  * function value tolerance (default: 1e-6)
-///  * parameter tolerance
-///  
-///  Additional return reason:
-///     - none
-///
-class DownhillSimplexOptimizer : public SimpleOptimizer
-{
-  public:
-
-    typedef SimpleOptimizer SuperClass;
-    typedef SuperClass::matrix_type matrix_type;
-    ///
-    /// Constructor
-    /// @param loger : OptLogBase * to existing log class or NULL
-    ///
-    DownhillSimplexOptimizer(OptLogBase *loger=NULL);
-
-    ///
-    /// CopyConstructor
-    /// @param opt : DownhillSimplexOptimizer to copy
-    ///
-    DownhillSimplexOptimizer(const DownhillSimplexOptimizer &opt);
-
-    ///
-    ///
-    ///
-    ~DownhillSimplexOptimizer();
-    
-
-
-    ///
-    /// set downhill specific parameters
-    /// @param alpha
-    /// @param beta
-    /// @param gamma
-    ///
-    void setDownhillParams(const double alpha, const double beta, const double gamma);
-        
-    ///
-    /// Sets the rank deficiency threshold
-    /// @param rankdeficiencythresh rank deficiency threshold (DEFAULT= 0.01)
-    ///
-    void setRankDeficiencyThresh(float rankdeficiencythresh);
-    
-    ///
-    /// Enable or disable the rank check
-    /// @param status give the status for a rank check
-    ///
-    void setRankCheckStatus(bool status);
-    
-    /**
-    * @brief get the downhill simplex parameter alpha, needed for the reflection
-    * @date 27-09-2012
-    * @author Alexander Freytag
-    */        
-    double getDownhillParameterAlpha() const;
-    
-    /**
-    * @brief get the downhill simplex parameter alpha, needed for the contraction
-    * @date 27-09-2012
-    * @author Alexander Freytag
-    */        
-    double getDownhillParameterBeta() const;
-    
-    /**
-    * @brief get the downhill simplex parameter alpha, needed for the expansion
-    * @date 27-09-2012
-    * @author Alexander Freytag
-    */        
-    double getDownhillParameterGamma() const;
-    
-    ///
-    /// Returns the status of rankcheck
-    /// @retval true, if rankcheck is enabled
-    /// @retval false, if rankcheck is disabled
-    ///
-    bool getRankCheckStatus();
-
-    ///
-    /// Do internal initializations
-    ///
-    void init();
-
-  protected:
-    ///
-    /// start optimization
-    ///
-    virtual int optimize();
-
-    
-  private:
-    ///
-    /// Initialize the whole simplex, for that, numOfParameters+1 points a needed.
-    /// (You might want to detemine these points by a random search before)
-    /// @param simplex : Matrix containing numOfParameters+1 points 
-    ///                 that are numOfParameters-dimensional
-    /// @return bool : indicating if attempt was successfull 
-    ///               (might not, if dimensions don't match)
-    ///
-    bool setWholeSimplex(const matrix_type &simplex);
-    
-    ///
-    /// internal bool to store if simplex is initialized
-    ///
-    bool m_simplexInitialized;
-    
-    
-    ///
-    /// internal bool to offer a break in all internal functions
-    ///
-    bool m_abort;
-
-    ///
-    /// internal parameter to control the transformations of the simplex
-    ///
-    double m_alpha;
-    
-    ///
-    /// internal parameter to control the transformations of the simplex
-    ///
-    double m_gamma;
-    
-    ///
-    /// internal parameter to control the transformations of the simplex
-    ///
-    double m_beta;
-
-
-
-    ///
-    /// This method does the optimization itself.
-    /// It is called by optimize and returns the index of the "final"
-    /// vertice matrix that is the lowest / highest point found (int).
-    ///
-    int amoeba();
-
-    ///
-    /// This method does the extrapolation of highest vertice through the
-    /// simplex by the factor fac. It is called by amoeba()
-    ///
-    double amotry(matrix_type& psum,int ihi, double fac);
-
-    ///
-    /// Matrix containing the vertices of the simplex
-    ///
-    matrix_type m_vertices;
-    
-    ///
-    /// Matrix(1dim) containing the function values corresponding to 
-    /// vertices
-    ///
-    matrix_type m_y;
-
-    ///
-    /// Rang deficiency threshold
-    ///
-    float m_rankdeficiencythresh;
-    
-    ///
-    /// Rank check status: if false, a rank check is disabled (default)
-    ///
-    bool m_rankcheckenabled;
-}; //class
-
-    ///
-    /// Check Rank of a matrix_type where singular values lower than numZero
-    /// are treated as zero. The computation is done by singular value
-    /// decomposition. Returns the numerical rank 
-    /// of the matrix
-    ///
-    /// @param A matrix to compute rank of..
-    /// @param numZero threshold to decide for numerical zero
-    /// @return (numerical) rank of A
-    ///
-    unsigned int getRank(const optimization::matrix_type& A, double numZero);
-    
-#endif

+ 1 - 1
EmptyLog.h

@@ -11,7 +11,7 @@
 
 #include <string>
 #include <sstream>
-#include "optimization/OptLogBase.h"
+#include "core/optimization/blackbox/OptLogBase.h"
 
 
 /*!

+ 1 - 1
FileLog.h

@@ -8,7 +8,7 @@
 
 #include <string>
 #include <fstream>
-#include "optimization/OptLogBase.h"
+#include "core/optimization/blackbox/OptLogBase.h"
 
 class FileLog : public OptLogBase
 {

+ 2 - 2
LineSearcher.h

@@ -12,8 +12,8 @@
 #define _LINE_SEARCHER_H_
 
 
-#include "optimization/CostFunction.h"
-#include "optimization/OptLogBase.h"
+#include "core/optimization/blackbox/CostFunction.h"
+#include "core/optimization/blackbox/OptLogBase.h"
 #include "optimization/Opt_Namespace.h"
 #include "optimization/InequalityConstraints.h"
 #include "optimization/EqualityConstraints.h"

+ 1 - 1
MatrixIterativeOptimizer.cpp

@@ -10,7 +10,7 @@
 #include "optimization/MatrixIterativeOptimizer.h"
 #include <iostream>
 #include "optimization/AdditionalIceUtils.h" // for linsolve
-#include "optimization/DownhillSimplexOptimizer.h" //FIXME WACKER: INCLUDE DOWNHILL SIMPLEX FOR THE GET RANK FUNCTION -> EXPORT IT 
+#include "core/optimization/blackbox/DownhillSimplexOptimizer.h" //FIXME WACKER: INCLUDE DOWNHILL SIMPLEX FOR THE GET RANK FUNCTION -> EXPORT IT 
 
 
 MatrixIterativeOptimizer::MatrixIterativeOptimizer(OptLogBase *loger) : SuperClass(loger)

+ 0 - 65
OptLogBase.cpp

@@ -1,65 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	OptLogBase.cpp: Implementation of the Log class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "optimization/OptLogBase.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-
-OptLogBase::OptLogBase()
-{
-	m_nMessageBufferSize = 8 * 1024;
-	m_pMessageBuffer = new char[m_nMessageBufferSize];
-}
-
-OptLogBase::~OptLogBase()
-{
-	delete[] m_pMessageBuffer;
-}
-
-void OptLogBase::logError(const char* format,...)
-{
-	va_list arguments;
-	va_start(arguments,format);
-	//_vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	va_end(arguments);
-
-	m_pMessageBuffer[m_nMessageBufferSize - 1] = '\0';
-	writeLogError(m_pMessageBuffer);
-}
-
-void OptLogBase::logWarning(const char* format,...)
-{
-	va_list arguments;
-	va_start(arguments,format);
-	//_vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	va_end(arguments);
-
-	m_pMessageBuffer[m_nMessageBufferSize - 1] = '\0';
-	writeLogWarning(m_pMessageBuffer);
-}
-
-void OptLogBase::logTrace(const char* format,...)
-{
-	va_list arguments;
-	va_start(arguments,format);
-	//_vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	vsnprintf(m_pMessageBuffer, m_nMessageBufferSize, format, arguments);
-	va_end(arguments);
-
-	m_pMessageBuffer[m_nMessageBufferSize - 1] = '\0';
-	writeLogTrace(m_pMessageBuffer);
-}
-
-
-void OptLogBase::init()
-{
-}

+ 0 - 85
OptLogBase.h

@@ -1,85 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	OptLogBase.h: interface of the Log class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#ifndef _OPT_LOG_BASE_H_
-#define _OPT_LOG_BASE_H_
-
-#include <string>
-#include <sstream>
-#include "optimization/Opt_Namespace.h"
-
-
-/*!
-    base class for all log classes
-*/
-
-class OptLogBase
-{
-	public:
-		
-        /*!
-            Constructor.
-		*/
-		OptLogBase();
-        
-        /*!
-            Destructor.
-         */
-        virtual ~OptLogBase();
-		
-		/*!
-			Logs an error
-		*/	
-		void logError(const char* format,...);
-
-		/*!
-			Logs a warning
-		*/	
-		void logWarning(const char* format,...);
-
-		/*!
-			Logs a trace message
-		*/	
-		void logTrace(const char* format,...);
-
-		/**! Write parameter vector to output device (file, stdio, etc.)
-        *
-        * @param parammatrix parameter matrix
-        */
-        // empty for all loger except the ParamLogger
-        virtual void writeParamsToFile(optimization::matrix_type& parammatrix)
-        {
-        }
-
-		void init();
-
-	protected:
-
-		/**! Write error message to an output device (file, stdio, etc.)
-		 */
-		virtual void writeLogError(const char* szMessage) = 0;
-
-		/**! Write warning message to an output device (file, stdio, etc.)
-		 */
-		virtual void writeLogWarning(const char* szMessage) = 0;
-
-		/**! Write trace message to an output device (file, stdio, etc.)
-		 */
-		virtual void writeLogTrace(const char* szMessage) = 0;
-
-	private:
-
-		//! Character buffer used to format messages to be logged
-		char* m_pMessageBuffer;
-
-		//! Size of the message format buffer
-		int m_nMessageBufferSize;
-		
-};
-
-#endif

+ 0 - 61
Optimizable.cpp

@@ -1,61 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	Optimizable.cpp: implementation of the Optimizable class.
-//
-//	Written By: Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "optimization/Optimizable.h"
-
-using namespace optimization;
-
-Optimizable::Optimizable() : m_numOfParameters(0)
-{
-}
-
-Optimizable::Optimizable(unsigned int numOfParameters) : m_numOfParameters(numOfParameters)
-{
-}
-
-Optimizable::Optimizable(const Optimizable &optimizable)
-{
-	m_numOfParameters = optimizable.m_numOfParameters;
-}
-
-Optimizable::~Optimizable()
-{
-}
-
-Optimizable &Optimizable::operator=(const Optimizable &opt)
-{
-		
-	/*
-			avoid self-copy
-	*/
-	if(this != &opt)
-	{
-		
-		/*
-			own values:
-		*/
-		m_numOfParameters = opt.m_numOfParameters;
-	
-	}
-
-  	return *this;
-}
-
-matrix_type Optimizable::evaluateSet(const matrix_type &parameterSet)
-{
-	unsigned int iMax = parameterSet.cols();
-	matrix_type result(parameterSet.cols(),1);
-
-	for(unsigned int i = 0; i < iMax; i++)
-	{
-		//result(i) = this->evaluate(parameterSet.Sub(m_numOfParameters,1,0,i));
-		result[i][0] = this->evaluate(parameterSet(0,i,m_numOfParameters-1,i));
-	}
-
-	return result;
-}

+ 0 - 81
Optimizable.h

@@ -1,81 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	Optimizable.h: interface of the Optimizable class.
-//
-//	Written by Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#ifndef _OPTIMIZABLE_H_
-#define _OPTIMIZABLE_H_
-
-#include "optimization/Opt_Namespace.h"
-
-namespace opt=optimization;
-
-/*!
-    \class
- */
-class Optimizable
-{
-	public:
-		
-	/*!
-		default Constructor
-	*/
-	Optimizable();
-
-        /*!
-            Constructor.
-         */
-        Optimizable(unsigned int numOfParameters);
-
-	/*!
-			Copy Constructor
-	*/
-        Optimizable(const Optimizable &optimizable);
-
-        /*!
-            Destructor.
-         */
-        virtual ~Optimizable();
-
-	/*!
-		operator=
-	*/
-	Optimizable & operator=(const Optimizable &opt);
-		
-	/*!
-		get Number of Parameters
-	*/
-	inline unsigned int getNumOfParameters(){return m_numOfParameters;};
-
-	/*!
-	    Evaluation of objective function.
-	    \param parameter double matrix (numOfParameters X 1) ^= column vector
-	    \return objective function value
-	 */
-       virtual double evaluate(const opt::matrix_type &parameter) = 0;
-
-	/*!
-		Evaluation of objection function 
-		\param parameterset [x_1, x_2, x_3, .... ,x_n]
-		\return doubleMatrix containing 
-				[evaluate(x_1), .... evaluate(x_n)];
-		
-		 can be overloaded for parallel computation
-
-	*/
-	opt::matrix_type evaluateSet(const opt::matrix_type &parameterSet);
-
-	protected:
-		
-
-		/*!
-			the number of parameters
-		*/
-		unsigned int m_numOfParameters;
-
-};
-
-#endif

+ 0 - 260
Optimizer.cpp

@@ -1,260 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	Optimizer.cpp: Implementation of the Optimizer class.
-//
-//	Written by Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "optimization/Optimizer.h"
-#include <iostream>
-#include <cassert>
-
-//Optimizer::Optimizer(unsigned int numOfParameters, CostFunction *objectiveFunction, OptLogBase *loger)
-Optimizer::Optimizer(OptLogBase *loger)
-{
-	m_costFunction			= NULL;
-	// may be NULL
-	m_loger				= loger;
-	
-	//  SET defaults
-	m_numberOfParameters		= 0;
-	m_maximize			= false;
-	m_lowerParameterBoundActive 	= false;
-	m_upperParameterBoundActive 	= false;
-	m_funcTolActive			= false;
-	m_paramTolActive		= false;
-	m_maxNumIterActive		= false;
-	m_maxSecondsActive		= false;
-	m_verbose 			= false;
-	m_paramTol	= 0.0001;
-	m_funcTol	= 0.000001;
-}
-
-
-Optimizer::Optimizer( const Optimizer &opt)
-{
-	
-	//  no deep copies!  
-	m_costFunction = opt.m_costFunction;
-	m_loger = opt.m_loger;
-	
-	// 
-	m_numberOfParameters = opt.m_numberOfParameters;
-	m_parameters = opt.m_parameters;
-	m_scales = opt.m_scales;
-	m_upperParameterBound = opt.m_upperParameterBound;
-	m_lowerParameterBound = opt.m_lowerParameterBound;
-	
-	m_funcTol = opt.m_funcTol;
-	m_paramTol = opt.m_paramTol;
-	m_maxNumIter = opt.m_maxNumIter;
-	m_maxSeconds = opt.m_maxSeconds;
-		
-	m_maximize		= opt.m_maximize;
-	m_funcTolActive		= opt.m_funcTolActive;
-	m_paramTolActive	= opt.m_paramTolActive;
-	m_maxNumIterActive	= opt.m_maxNumIterActive;
-	m_maxSecondsActive	= opt.m_maxSecondsActive;
-	m_lowerParameterBoundActive = opt.m_lowerParameterBoundActive;
-	m_upperParameterBoundActive = opt.m_upperParameterBoundActive;
-	m_verbose = opt.m_verbose;
-
-}
-
-Optimizer  & Optimizer::operator=(const Optimizer &opt)
-{
-		
-	/*
-			avoid self-copy
-	*/
-	if(this != &opt)
-	{
-		
-		//
-		//	=operator of SuperClass
-		//
-		//SuperClass::operator=(opt);
-
-		//
-		//	own values:
-		//
-	
-		//  no deep copies!  
-		m_costFunction = opt.m_costFunction;
-		m_loger = opt.m_loger;
-		
-		// 
-		m_numberOfParameters = opt.m_numberOfParameters;
-		m_parameters = opt.m_parameters;
-		m_scales = opt.m_scales;
-		m_upperParameterBound = opt.m_upperParameterBound;
-		m_lowerParameterBound = opt.m_lowerParameterBound;
-		
-		m_funcTol = opt.m_funcTol;
-		m_paramTol = opt.m_paramTol;
-		m_maxNumIter = opt.m_maxNumIter;
-		m_maxSeconds = opt.m_maxSeconds;
-			
-		m_maximize			= opt.m_maximize;
-		m_funcTolActive		= opt.m_funcTolActive;
-		m_paramTolActive		= opt.m_paramTolActive;
-		m_maxNumIterActive	= opt.m_maxNumIterActive;
-		m_maxSecondsActive	= opt.m_maxSecondsActive;
-		m_lowerParameterBoundActive = opt.m_lowerParameterBoundActive;
-		m_upperParameterBoundActive = opt.m_upperParameterBoundActive;
-		m_verbose = opt.m_verbose;
-
-	}
-
-  	return *this;
-}
-
-Optimizer::~Optimizer()
-{
-}
-
-void Optimizer::setMaximize(bool maximize)
-{
-	m_maximize = maximize;
-}
-
-void Optimizer::setParameters(const matrix_type & startParameters)
-{
-	if(checkParameters(startParameters) == true)
-	{
-		m_parameters = startParameters;
-	}
-	else
-	{
-		if(m_loger)
-			m_loger->logError("the parameters that were tried to set are not within the Bounds. Startparameters are set to the lower Bound");
-
-		assert(false); // :)
-		m_parameters = m_lowerParameterBound;
-	}
-}
-
-
-bool Optimizer::checkParameters(const matrix_type & parameters)
-{
-	assert( (parameters.rows() == static_cast<int>(m_numberOfParameters)) && (parameters.cols() == 1 ) );
-	
-	if(m_lowerParameterBoundActive || m_upperParameterBoundActive)
-	{
-		for(int i=0; i < static_cast<int>(m_numberOfParameters); i++)
-		{
-			if( m_upperParameterBoundActive)
-			{
-				if(parameters[i][0] >= m_upperParameterBound[i][0])
-				{
-					return false;
-				}
-			}
-			if( m_lowerParameterBoundActive)
-			{
-				if(parameters[i][0] <= m_lowerParameterBound[i][0])
-				{
-					return false;
-				}
-			}
-		}
-	}
-	return true;
-}
-
-
-void Optimizer::setScales(const matrix_type & scales)
-{
-	assert (scales.rows() == static_cast<int>(m_numberOfParameters) && (scales.cols() == 1 ) );
-
-	m_scales=scales;
-}
-
-void Optimizer::setUpperParameterBound(bool active, const matrix_type & upperBound)
-{
-	m_upperParameterBoundActive = active;
-	m_upperParameterBound = upperBound;
-}
-
-void Optimizer::setLowerParameterBound(bool active, const matrix_type & lowerBound)
-{
-	m_lowerParameterBoundActive = active;
-	m_lowerParameterBound = lowerBound;
-}
-
-void Optimizer::setFuncTol(bool active, double difference)
-{
-	m_funcTolActive = active;
-	m_funcTol = difference;
-}
-
-void Optimizer::setParamTol(bool active, double difference)
-{
-	m_paramTolActive = active;
-	m_paramTol = difference;
-}
-
-void Optimizer::setMaxNumIter(bool active, unsigned int num)
-{
-	m_maxNumIterActive = active;
-	m_maxNumIter = num;
-}
-
-void Optimizer::setTimeLimit(bool active, double seconds)
-{
-	m_maxSecondsActive = active;
-	m_maxSeconds = seconds;
-}
-
-
-void Optimizer::setLoger(OptLogBase *loger)
-{
-	m_loger = loger;
-
-	if(loger)
-	{
-		loger->init();
-	}
-}
-
-void Optimizer::changeCostFunction(CostFunction* costFunction)
-{
-	m_costFunction = costFunction;
-
-	if (m_costFunction)
-	{	
-		m_costFunction->init();
-	}
-}
-
-double Optimizer::evaluateCostFunction(const matrix_type & x)
-{
-	return ( m_maximize == true ? (-1.0 * m_costFunction->evaluate(x)):(m_costFunction->evaluate(x)));
-}
-
-void Optimizer::init()
-{
-	/* Check costfunctin and loger */
-	if( !m_costFunction)
-	{
-		if(m_loger)
-			m_loger->logError("Optimizer init() failed because of missing costfunction");
-		assert(false); // :) 
-	}
-	else
-	{
-		m_costFunction->init();
-	}
-
-	m_numIter = 0;
-
-}
-
-/*!
-	function that calls costfunction->evaluate for every column in x and inverts the sign in neccesary
-*/
-Optimizer::matrix_type Optimizer::evaluateSetCostFunction(const matrix_type & xSet)
-{
-	return ( m_maximize == true ? (m_costFunction->evaluateSet(xSet) * -1.0):(m_costFunction->evaluateSet(xSet)));
-}

+ 0 - 389
Optimizer.h

@@ -1,389 +0,0 @@
-///
-///	@file	Optimizer.h: interface of the Optimizer class.
-///	@author	Matthias Wacker, Esther Platzer
-///
-
-#ifndef _OPTIMIZER_H_
-#define _OPTIMIZER_H_
-
-#include "optimization/CostFunction.h"
-#include <time.h>
-#include "optimization/OptLogBase.h"
-#include "optimization/Opt_Namespace.h"
-
-
-/*!
-	Abstract base class of all optimizers.
- */
-class Optimizer
-{
-	public:
-		typedef optimization::matrix_type matrix_type;
-
-		///
-		///	Constructor (also Default constructor)
-		///	@param optProb pointer to optimization problem object 
-		///	@param loger OptLogBase * to existing log class or NULL
-		///
-		Optimizer(OptLogBase *loger=NULL);
-
-		///
-		///	Copy constructor
-		///	@param opt .. optimizer to copy
-		///
-		Optimizer( const Optimizer &opt);
-
-		///
-		///	assignment opterator
-		///	@param opt optimizer to "copy"
-		///	@return self-reference
-		///
-		Optimizer  & operator=(const Optimizer &opt);
-
-		///
-		///		Destructor.
-	        ///
-	        virtual ~Optimizer();
-		
-		///
-		///	enumeration for the return reasons of an optimizer
-		///
-		enum {
-			SUCCESS_FUNCTOL,
-			SUCCESS_PARAMTOL,
-			SUCCESS_MAXITER,
-			SUCCESS_TIMELIMIT,
-			ERROR_XOUTOFBOUNDS,
-			ERROR_COMPUTATION_UNSTABLE,
-			_to_continue_
-		};
-
-			
-		///
-		///	setScales means the parameters are internally handled scaled to compensate for illposed
-		///	Parameter relations. 
-		///	The scales are used multiplicative: higher scales mean bigger steps
-		///	(For Example rotation has much more effect than translation, 
-		///	so steps should be much smaller than for translation, i.g. use small scales for the
-		///	rotation parameters and higher scales for the translation parameters)
-		///
-		///	@brief Set the scaling vector for the parameters.
-		///	@param scales vector for the scales (i-th scale for i-th parameter dimension)
-		///
-		void setScales(const optimization::matrix_type & scales);
-
-		///	
-		///	@brief Get the scales
-		///	
-		///	@return matrix with the scales
-		///
-		inline const optimization::matrix_type & getScales(){return m_scales;};
-		
-		///
-		///	@brief Set bounds for x
-		///	
-		///	Sets an upper bound for the parameter space. Optimization aborts if it iterates over these given bound.
-		///
-		void setUpperParameterBound(bool active, const optimization::matrix_type & upperBound);
-		
-		///
-		///	@brief Set bounds for x.
-		///	
-		///	Sets a lower bound for the parameter space. Optimization aborts if it iterates over these given bound.
-		///
-		void setLowerParameterBound(bool active, const optimization::matrix_type & lowerBound);
-
-		///
-		///	@brief get the upper bound
-		///	@return matrix containing the upper bound
-		///
-		inline const optimization::matrix_type & getUpperParameterBound(){	return m_upperParameterBound;};
-
-
-		///
-		///	@brief get the lower parameter bound
-		///	@return matrix containing the lower bound
-		///
-		inline const optimization::matrix_type & getLowerParameterBound(){return m_lowerParameterBound;};
-
-		///
-		///	@brief Set function tolerance abort criteria
-		///	
-		///	Set function tolerance abort criteria. While iterating, if the change of the objective function between
-		///	two iterations is below the given difference threshold. The optimization stops and returns SUCCESS if 
-		///	active is 'true'
-		///
-		///	@param active bool to activate the criteria (true == active..)
-		///	@param difference double to set the threshold
-		///
-		void setFuncTol(bool active, double difference);
-		
-		///
-		///	@brief Get the function tolerance abort criteria
-		///	@return double representing the threshold
-		///
-		inline double getFuncTol(){return m_funcTol;};
-
-		///
-		///	@brief Set parameter tolerance abort criteria
-		///	
-		///	Set parameter tolerance abort criteria. While iterating, if the change of the parameters between
-		///	two iterations is below the given difference threshold. The optimization stops and returns SUCCESS if 
-		///	active is 'true'
-		///
-		///	@param active : bool to activate the criteria (true == active..)
-		///	@param difference : representing the threshold
-		///
-		void setParamTol(bool active, double difference);
-		
-		///
-		///	@brief Get the parameter tolerance abort criteria
-		///	@return double representing the threshold
-		///
-		inline double getParamTol(){return m_paramTol;};
-	
-		///
-		///	@brief Set maximum number of Iterations
-		///	@param active : bool to enable the criteria
-		///	@param num : unsigned int -> max number of iterations
-		///
-		void setMaxNumIter(bool active, unsigned int num);
-
-		///
-		///	@brief get maximum number of Iterations
-		///	@return unsigned int representing the max number of iterations
-		///
-		inline unsigned int getMaxNumIter(){return m_maxNumIter;};
-
-		///
-		///	@brief get actual Iteration count
-		///	@return unsigned int represention the actual iteration count
-		///
-		inline unsigned int getNumIter(){return m_numIter;};
-
-		///
-		///	@brief set time limit in sec
-		///	@param active: bool to set the timelimit active or not
-		///	@param seconds: double representing the timelimit in seconds
-		///
-		void setTimeLimit(bool active, double seconds);
-
-		///
-		///	@brief get time limit in sec
-		///	@return time limit
-		///
-		inline double getTimeLimit(){return m_maxSeconds;};
-
-		///
-		///	@brief get return reason
-		///	@return returns an int representing the return reason. Compare with enumeration
-		///
-		inline int getReturnReason(){return m_returnReason;};
-
-		///
-		///	@brief setMaximize 'true' Changes Optimization to maximization instead of the default: 'false' ^= minimization.	
-		///	@param maximize maximize? 
-		///
-		void setMaximize(bool maximize);
-	
-		///
-		///	@brief set loger
-		///	@param loger OptLogBase * to an instance of a loger
-		///
-		void setLoger(OptLogBase *loger);
-
-		///
-		///	@brief setVerbose = true to enable a lot of outputs 
-		///
-		inline void setVerbose(bool verbose){m_verbose = verbose;};
-	
-	protected:
-		//	pure virtual definitions
-		
-		///
-		///	@brief virtual function that will start the optimization
-		///	@return integer representing abortion status from enum
-        	///
-		virtual int optimize() = 0;
-
-		///
-		///	@brief Initializations
-		///
-		void init();
-
-		//	end of pure virtual definitions
-
-				
-		///
-		///	@brief Checks if parameters are valid
-		///	@param parameters : parameters to check.
-		///
-		bool checkParameters(const optimization::matrix_type & parameters);
-		
-		///
-		///	@brief Get the last parameters
-		///	@return optimization::matrix_type containing the last parameters used in Optimization
-		///
-		inline optimization::matrix_type  getLastParameters(){return m_parameters;}
-
-		///
-		///	 @brief get number of paramters
-		///
-		inline unsigned int getNumberOfParameters(){return m_numberOfParameters;}
-
-			
-		///
-		///	@brief Sets parameters used as initial point for Optimization
-		///	@param startParameters :  used as initial point
-		///
-		void setParameters(const optimization::matrix_type & startParameters);
-	
-	
-		///
-		///	@brief get loger
-		///	@return pointer to the loger
-		///
-		inline OptLogBase * getLoger(){return m_loger;};
-
-		///
-		///	@brief Change cost function.
-		///
-		void changeCostFunction(CostFunction* costFunction);
-
-		//////////////////////////////////////////
-		//					//
-		//	 member definitions		//
-   		//					//
-   		//////////////////////////////////////////
-
-	        ///
-		///	pointer to cost function
-		///
-		CostFunction* m_costFunction;
-
-		///
-		///	number of parameters to be optimized
-		///
-		unsigned int m_numberOfParameters;
-		
-		///
-		///	parameter vector
-		///
-		optimization::matrix_type   m_parameters;
-
-		///
-		///	function value corresponding to m_parameters
-		///
-		double m_currentCostFunctionValue;
-
-		///
-		///	scales vector
-		///
-		optimization::matrix_type   m_scales;
-
-		///
-		///	parameters tolerance threshold
-		///
-		double m_paramTol;
-
-		///
-		///	parameters tolerance active
-		///
-		bool m_paramTolActive;
-
-		///
-		///	function tolerance threshold
-		///
-		double m_funcTol;
-
-		///
-		///	function tolerance active
-		///
-		bool m_funcTolActive;
-				
-		///
-		///	Maximum number of Iterations
-		///
-		unsigned int m_maxNumIter;
-
-		///
-		///	Iteration limit active
-		///
-		bool m_maxNumIterActive;
-
-		///
-		///	Iteration counter
-		///
-		unsigned int m_numIter;
-
-		///
-		///	Time limit in seconds
-		///
-		double m_maxSeconds;
-
-		///
-		///	Time limit active
-		///
-		bool m_maxSecondsActive;
-
-		///
-		///	start time sturct
-		///
-		clock_t m_startTime;
-
-		///
-		///	current time struct
-		///
-		clock_t m_currentTime;
-
-		///
-		///	container to store the return reason until it is returned from optimize()
-		///
-		int m_returnReason ;
-		
-		///
-		///	upper parameter bound
-		///
-		optimization::matrix_type  m_upperParameterBound;
-		///
-		///	upper parameter bound active
-		///
-		bool m_upperParameterBoundActive;
-	
-		///
-		///	lower parameter bound
-		///
-		optimization::matrix_type  m_lowerParameterBound;
-		///
-		///	lower parameter bound active
-		///
-		bool m_lowerParameterBoundActive;
-
-		///
-		///	maximize
-		///
-		bool m_maximize;
-
-		///
-		///	log class OptLogBase
-		///
-		OptLogBase *m_loger;
-		
-		///
-		///	bool to enable a bunch of outputs 
-		///
-		bool m_verbose;
-
-		///
-		///	function that calls costfunction->evaluate but inverts the sign if neccesary (min or max..)
-		///
-		double evaluateCostFunction(const optimization::matrix_type & x);
-
-		///
-		///	function that calls costfunction->evaluate for every column in x and inverts the sign in neccesary
-		///
-		optimization::matrix_type evaluateSetCostFunction(const optimization::matrix_type & xSet);
-
-};
-
-#endif

+ 1 - 1
ParamLog.h

@@ -8,7 +8,7 @@
 
 #include <string>
 #include <fstream>
-#include "optimization/OptLogBase.h"
+#include "core/optimization/blackbox/OptLogBase.h"
 
 
 class ParamLog : public OptLogBase

+ 1 - 1
Plotter.h

@@ -27,7 +27,7 @@ Matthias Wacker <matthias.wacker@mti.uni-jena.de>
 #ifndef _PLOTTER_H_
 #define _PLOTTER_H_
 
-#include "optimization/SimpleOptProblem.h"
+#include "core/optimization/blackbox/SimpleOptProblem.h"
 
 
 class Plotter

+ 1 - 1
PowellBrentOptimizer.h

@@ -13,7 +13,7 @@
 #define _POWELL_BRENT_OPTIMIZER_H_
 
 #include <cmath>
-#include "optimization/SimpleOptimizer.h"
+#include "core/optimization/blackbox/SimpleOptimizer.h"
 #include "optimization/BrentLineSearcher.h"
 
 /*!

+ 0 - 412
SimpleOptProblem.cpp

@@ -1,412 +0,0 @@
-/*
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License version 2 as published by the Free Software Foundation.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-
-    ---
-    Copyright (C) 2009, Esther-Sabrina Platzer <esther.platzer@uni-jena.de>
-                        Matthias Wacker <Matthias.Wacker@mti.uni-jena.de>
-*/
-
-#include "optimization/SimpleOptProblem.h"
-
-using namespace optimization;
-
-// note: all matrices are of size 0x0 meaning that they are not initialised!
-SimpleOptProblem::SimpleOptProblem() : m_costfunc(NULL),
-                           m_numParams(0),
-                           m_numActiveParams(0),
-                           m_maximize(false),
-                           m_lowerBoundsActive(false),
-                           m_upperBoundsActive(false),
-                           m_dimwrapper(NULL)
-{
-}
-
-
-SimpleOptProblem::SimpleOptProblem(CostFunction* costfunc, optimization::matrix_type& initialParams, optimization::matrix_type& scales, bool allactive)
-{
-    // if dimension of initial parameter matrix and/or scale matrix do not fit the given dimension, stop
-    assert(initialParams.rows() == (int)costfunc->getNumOfParameters() && scales.rows() == (int)costfunc->getNumOfParameters());
-    
-    // pointer to costfunction
-    m_costfunc= costfunc;
-    
-    // full dimension of optimization problem
-    m_numParams= m_costfunc->getNumOfParameters();
-    
-    matrix_type tmp(m_numParams,1);
-    m_selection= tmp;
-    m_upperBounds= tmp;
-    m_lowerBounds= tmp;
-    
-    // number of active parameters (all or none?)
-    if(allactive)
-    {
-        m_numActiveParams= m_numParams;
-        for(int i= 0; i< m_numParams; ++i)
-            m_selection[i][0]= 1;
-    }
-    else
-    {
-        m_numActiveParams= 0;
-        for(int i= 0; i< m_numParams; ++i)
-            m_selection[i][0]= 0;
-    }
-    
-    // init parameters and scales
-    m_currentparams= initialParams;
-    m_scales= scales;
-    
-    // init upper and lower bounds with infitniy and -infinity
-    for(int i= 0; i< m_numParams; ++i)
-    {
-		m_lowerBounds[i][0]= -1.0*std::numeric_limits<double>::max( );
-		// -1.0*numeric_limits<double>::infinity( );//-1.0*numeric_limits<float>::max( );
-		m_upperBounds[i][0]= std::numeric_limits<double>::max( );
-		//numeric_limits<double>::infinity( );//numeric_limits<float>::max( );
-    }
-    
-    // per default minimization will be perfomed and no bounds are active
-    m_maximize= false;
-    m_lowerBoundsActive= false;
-    m_upperBoundsActive= false;
-    
-    m_dimwrapper= NULL;
-}
-
-
-SimpleOptProblem::SimpleOptProblem(const SimpleOptProblem& opt)
-{
-    m_costfunc= opt.getOriginalCostFunction();
-    m_numParams= opt.getNumParams();
-    m_numActiveParams= opt.getNumActiveParams();
-    m_currentparams= opt.getAllCurrentParams();
-    m_scales= opt.getAllScales();
-    m_selection=opt.m_selection; // direct member access
-    m_maximize= opt.getMaximize();
-    m_lowerBoundsActive= opt.lowerBoundsActive();
-    m_upperBoundsActive= opt.upperBoundsActive();
-    m_lowerBounds= opt.getAllLowerBounds();
-    m_upperBounds= opt.getAllUpperBounds();
-        
-    m_dimwrapper= NULL;
-}
-
-
-SimpleOptProblem::~SimpleOptProblem()
-{
-    if(m_dimwrapper != NULL)
-        delete m_dimwrapper;
-}
-
-
-SimpleOptProblem& SimpleOptProblem::operator=(const SimpleOptProblem& opt)
-{
-    m_costfunc= opt.m_costfunc;
-    m_selection=opt.m_selection; // direct member access
-    m_numParams= opt.getNumParams();
-    m_numActiveParams= opt.getNumActiveParams();
-    m_currentparams= opt.getAllCurrentParams();
-    m_scales= opt.getAllScales();
-    m_maximize= opt.getMaximize();
-    m_lowerBoundsActive= opt.lowerBoundsActive();
-    m_upperBoundsActive= opt.upperBoundsActive();
-    m_lowerBounds= opt.getAllLowerBounds();
-    m_upperBounds= opt.getAllUpperBounds();
-       
-    m_dimwrapper= NULL;
-    
-    return *this;
-}
-
-
-void SimpleOptProblem::activateAllParams(bool status)
-{
-    for(int i= 0; i< this->getNumParams(); ++i)
-    {
-        m_selection[i][0]= (int)(status);
-    }
-
-	if(status == true)
-	{
-		m_numActiveParams=m_numParams;
-	}
-	else
-	{
-		m_numActiveParams=0;
-	}
-}
-
-
-void SimpleOptProblem::activateParam(int paramnum, bool status)
-{
-
-    assert(paramnum < m_numParams && paramnum >= 0);
-    
-    m_selection[paramnum][0]= (int)(status);
-
-	int count = 0;
-	for(int i =0; i < m_numParams; ++i)
-	{
-		if(m_selection[i][0]==1)
-		{
-			count++;
-		}
-	}
-	m_numActiveParams=count;
-}
-
-
-bool SimpleOptProblem::isActive(int paramnum) const
-{
-    assert(paramnum < m_numParams && paramnum >= 0);
-    
-    if(m_selection[paramnum][0] == 1)
-        return true;
-    else
-        return false;
-}
-
-
-bool SimpleOptProblem::allActive() const
-{
-    if(m_numActiveParams == m_numParams)
-        return true;
-    else
-        return false;
-}
-
-
-int SimpleOptProblem::getNumParams() const
-{
-    return m_numParams;
-}
-
-
-int SimpleOptProblem::getNumActiveParams() const
-{
-    return m_numActiveParams;
-}
-
-
-matrix_type SimpleOptProblem::getAllCurrentParams() const
-{
-    return m_currentparams;
-}
-
-
-matrix_type SimpleOptProblem::getActiveCurrentParams() const
-{
-    //compute selection matrix (X x m_numParamsx)
-    matrix_type selmatrix= this->computeSelectionMatrix();
-    return (selmatrix*m_currentparams);
-}
-
-
-matrix_type SimpleOptProblem::getAllScales() const
-{
-    return m_scales;
-}
-
-
-matrix_type SimpleOptProblem::getActiveScales() const
-{
-    //compute selection matrix (X x m_numParamsx)
-    matrix_type selmatrix= this->computeSelectionMatrix();
-    return(selmatrix* m_scales);
-}
-
-
-matrix_type SimpleOptProblem::getAllUpperBounds() const
-{
-    return m_upperBounds;
-}
-
-
-matrix_type SimpleOptProblem::getActiveUpperBounds() const
-{
-    //compute selection matrix (X x m_numParamsx)
-    matrix_type selmatrix= this->computeSelectionMatrix();
-    return (selmatrix*m_upperBounds);
-}
-
-
-matrix_type SimpleOptProblem::getAllLowerBounds() const
-{
-    return m_lowerBounds;
-}
-
-
-matrix_type SimpleOptProblem::getActiveLowerBounds() const
-{
-    //compute selection matrix (X x m_numParamsx)
-    matrix_type selmatrix= this->computeSelectionMatrix();
-    return (selmatrix*m_lowerBounds);
-}
-
-
-CostFunction* SimpleOptProblem::getCostFunction() 
-{
-    // if number of active params is less then m_numParams we need a Wrapper function
-    if(m_numActiveParams < m_numParams)
-    {
-        // if there is still existing an old dimwrapper function
-        /// @todo little problem: if the opt problem was not changed concerning its selection and a dimension reduced version is already existing it will be deleted and newly allocated nevertheless; that is not so nice :(
-        if(m_dimwrapper != NULL)
-            delete m_dimwrapper;
-        
-        // new dimension reduction, wrapper function
-        m_dimwrapper= new DimWrapperCostFunction(m_costfunc, m_selection, m_currentparams);
-        return m_dimwrapper;
-    }
-    
-    // else we return just the normal costfunction
-    return m_costfunc;
-}
-
-
-CostFunction* SimpleOptProblem::getOriginalCostFunction() const
-{
-    return m_costfunc;
-}
-
-
-bool SimpleOptProblem::getMaximize() const
-{
-    return m_maximize;
-}
-
-
-bool SimpleOptProblem::lowerBoundsActive() const
-{
-    return m_lowerBoundsActive;
-}
-
-
-bool SimpleOptProblem::upperBoundsActive() const
-{
-    return m_upperBoundsActive;
-}
-
-
-void SimpleOptProblem::setAllCurrentParameters(matrix_type& params)
-{
-    assert(params.rows() == m_numParams && params.cols() == 1);
-    m_currentparams= params;
-}
-
-
-void SimpleOptProblem::setActiveCurrentParameters(matrix_type& params)
-{
-
-    assert(params.rows() == m_numActiveParams && params.cols() == 1);
-
-    int paramcopied= 0;
-    for(int i= 0; i< m_numParams; ++i)
-    {
-	if(m_selection[i][0] == 1)
-	{
-	    m_currentparams[i][0]= params[paramcopied][0];
-	    paramcopied++;
-	}
-    }
-}
-
-
-void SimpleOptProblem::setAllScales(matrix_type& scales)
-{
-    assert(scales.rows() == m_numParams && scales.cols() == 1);
-    m_scales= scales;
-}
-
-
-void SimpleOptProblem::setActiveScales(matrix_type& scales)
-{
-    assert(scales.rows() == m_numActiveParams && scales.cols() == 1);
-
-    int scalecopied= 0;
-    for(int i= 0; i< m_numParams; ++i)
-    {
-	if(m_selection[i][0] == 1)
-	{
-	    m_scales[i][0]= scales[scalecopied][0];
-	    scalecopied++;
-	}
-    }
-}
-
-
-void SimpleOptProblem::setLowerBound(int paramnumber, float lowerbound)
-{
-    assert(paramnumber >= 0 && paramnumber < m_numParams);
-    m_lowerBoundsActive= true;
-    m_lowerBounds[paramnumber][0]= lowerbound;
-}
-
-
-void SimpleOptProblem::setUpperBound(int paramnumber, float upperbound)
-{
-    assert(paramnumber >= 0 && paramnumber < m_numParams);
-    m_upperBoundsActive= true;
-    m_upperBounds[paramnumber][0]= upperbound;
-}
-
-
-void SimpleOptProblem::resetLowerBounds()
-{
-    m_lowerBoundsActive= false;
-    for(int i= 0; i< m_numParams; ++i)
-    {
-        m_lowerBounds[i][0]= -1.0*std::numeric_limits<double>::infinity( );
-    }
-}
-
-
-void SimpleOptProblem::resetUpperBounds()
-{
-    m_upperBoundsActive= false;
-    for(int i= 0; i< m_numParams; ++i)
-    {
-        m_upperBounds[i][0]= std::numeric_limits<double>::infinity( );
-    }
-}
-
-
-void SimpleOptProblem::changeCostFunc(CostFunction* costfunc)
-{
-    m_costfunc= costfunc;
-}
-
-
-void SimpleOptProblem::setMaximize(bool maximize)
-{
-    m_maximize=maximize;
-}
-
-
-matrix_type SimpleOptProblem::computeSelectionMatrix() const
-{
-    matrix_type selectionmatrix(m_numActiveParams,m_numParams,0);
-    int index= 0;
-    for(int i= 0; i < m_numParams; ++i)
-    {
-	if(m_selection[i][0] == 1)
-	{
-	    selectionmatrix[index][i]= 1.0;
-	    index++;
-	}
-    }
-    return selectionmatrix;
-}
-

+ 0 - 335
SimpleOptProblem.h

@@ -1,335 +0,0 @@
-/*
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License version 2 as published by the Free Software Foundation.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-
-    ---
-    Copyright (C) 2009, Esther-Sabrina Platzer <esther.platzer@uni-jena.de>
-                        Matthias Wacker <matthias.wacker@mti.uni-jena.de>
-*/
-
-    /// @class SimpleOptProblem
-    /// This class encapsulats simple optimization problems. Parameter values, scales and upper and lower bounds can be managed. Furthermore individual parameters can be deactivated,
-    /// which allows an optimization of just a parameter subset. Activation and Deactivation can also be done with help of the class interface.
-    ///
-    /// @author Esther-Sabrina Platzer, Matthias Wacker
-    /// @date 2009-07-02
-
-#ifndef _SimpleOptProblem_h_
-#define _SimpleOptProblem_h_
-
-#include <assert.h>
-
-#include "optimization/Opt_Namespace.h"
-#include "optimization/CostFunction.h"
-#include "optimization/DimWrapperCostFunction.h"
-
-
-class SimpleOptProblem 
-{
-  public:
-    ///
-    /// Standard Constructor
-    ///
-    SimpleOptProblem( );
-    
-    /// 
-    /// Parametrized Constructor allows to specify the initial parameter values, the parameter scales and the costfunction which should be used. Furthermore it is possible to optimize just a subset of the parameter set. For this the wanted parameters have to be activated and the unwanted must be deactivated. By usage of the allactive flag it is possible to activate/deactivate the initial parameter setting in advance. By default all parameters are activeted.
-    ///
-    /// @param costfunc pointer to costfunction
-    /// @param initialParams matrix containing the initial parameter values
-    /// @param scales matrix containing the scales for every parameter
-    /// @param allactive boolean flag for activating (true) or deactivating (false) all parameters
-    ///
-    SimpleOptProblem(CostFunction* costfunc, optimization::matrix_type& initialParams, optimization::matrix_type& scales, bool allactive=true);
-
-    /// 
-    /// Copy Constructor
-    ///
-    /// @param opt the optimization problem to copy
-    ///
-    SimpleOptProblem(const SimpleOptProblem& opt);
-    
-    ///
-    /// Destructor
-    ///
-    ~SimpleOptProblem();
-
-    ///
-    /// Assignment Operator
-    /// @param opt the optimization problem to assign
-    /// @return SimpleOptProblem
-    ///
-    SimpleOptProblem& operator=(const SimpleOptProblem& opt);
-    
-    ///
-    /// Depending on the value of status all parameters (the whole parameter set) is activated (status=true) or deactivated (status= false)
-    ///
-    /// @param status boolean activation flag
-    ///
-    void activateAllParams(bool status);
-    
-    ///
-    /// Given the number of a certain parameter it status (activated/deactivated) can be set individually
-    ///
-    /// @param paramnum number of the parameter in the overall parameter set
-    /// @param status activation status (true= activated, false= deactivated)
-    ///
-    void activateParam(int paramnum, bool status);
-    
-    /// 
-    /// Returns the status of individual parameters
-    ///
-    /// @param paramnum parameter number in the overall parameter set
-    /// @retval true, if the actual parameter is active
-    /// @retval false, if the actual parameter is inactive
-    ///
-    bool isActive(int paramnum) const;
-    
-    ///
-    /// Returns wether all params are active or not
-    /// @retval true, if all parameters are active (m_numParams == m_numActiveParams)
-    /// @retval false, if none or not all parameters are active (m_numParams != m_numActiveParams)
-    bool allActive() const;
-    
-    
-    ///
-    /// @name Getters
-    ///
-    
-    ///
-    /// Returns the size of the overall parameter set
-    ///
-    int getNumParams() const;
-    
-    ///
-    /// Returns the number of active parameters
-    ///
-    int getNumActiveParams() const;
-    
-    /// 
-    /// Returns the current parameter set
-    ///
-    /// @return current parameter matrix
-    ///
-    optimization::matrix_type getAllCurrentParams() const;
-
-    /// 
-    /// Returns the current parameter set
-    ///
-    /// @return current parameter matrix
-    ///
-    optimization::matrix_type getActiveCurrentParams() const;
-    
-    ///
-    /// Returns the current parameter scales
-    ///
-    /// @return current scale matrix
-    ///
-    optimization::matrix_type getAllScales() const;
-
-    ///
-    /// Returns the current parameter scales
-    ///
-    /// @return current scale matrix
-    ///
-    optimization::matrix_type getActiveScales() const;
-    
-    ///
-    /// Returns the upper bounds (if no upper bounds are active, the matrix just contains infinity)
-    ///
-    /// @return upper bound matrix
-    ///
-    optimization::matrix_type getAllUpperBounds() const;
-
-    ///
-    /// Returns the upper bounds (if no upper bounds are active, the matrix just contains infinity)
-    ///
-    /// @return upper bound matrix
-    ///
-    optimization::matrix_type getActiveUpperBounds() const;
-    
-    ///
-    /// Returns the lower bounds (if no lower bounds are active, the matrix just contains -infinity)
-    ///
-    /// @return lower bound matrix
-    ///
-    optimization::matrix_type getAllLowerBounds() const;
-
-    ///
-    /// Returns the lower bounds (if no lower bounds are active, the matrix just contains -infinity)
-    ///
-    /// @return lower bound matrix
-    ///
-    optimization::matrix_type getActiveLowerBounds() const;
-    
-    /// 
-    /// Returns a pointer to the CURRENT CostFunction with regard to the actual parameter selection
-    ///
-    /// @return CostFunction pointer
-    ///
-    CostFunction* getCostFunction();
-    
-    ///
-    /// Returns a pointer to the ORIGINAL CostFunction ignoring the acutal parameter selection
-    ///
-    /// @return CostFunction pointer
-    ///
-    CostFunction* getOriginalCostFunction() const;
-    
-    /// 
-    /// Current description of the optimization strategy
-    /// 
-    /// @retval true, if a maximization of the CostFunction is performed
-    /// @retval false, if a minimization of the CostFunction is performed
-    ///
-    bool getMaximize() const;
-    
-    /// 
-    /// Returns the current status of lower bounds
-    /// 
-    /// @retval true, if at least on lower bound (different from -infinity) is set
-    /// @retval false, if no lower bounds are set (lower bound matrix just contains -infinity)
-    ///
-    bool lowerBoundsActive() const;
-    
-    /// 
-    /// Returns the current status of upper bounds
-    /// 
-    /// @retval true, if at least on upper bound (different from infinity) is set
-    /// @retval false, if no upper bounds are set (lower bound matrix just contains infinity)
-    ///
-    bool upperBoundsActive() const;
-    
-    
-    ///
-    /// @name Setters
-    ///
-    
-    ///
-    /// (Re)initialization of the current parameter values
-    ///
-    /// @param params parameter value matrix (must be m_numParams x 1)
-    ///
-    void setAllCurrentParameters(optimization::matrix_type& params);
-
-    ///
-    /// (Re)initialization of the current parameter values of active parameters
-    ///
-    /// @param params parameter value matrix (must be m_numActiveParams x 1)
-    ///
-    void setActiveCurrentParameters(optimization::matrix_type& params);
-    
-    /// 
-    /// (Re)initialization of the current scale setting
-    /// 
-    /// @param scales parameter scale matrix (must be m_numParams x 1)
-    ///
-    void setAllScales(optimization::matrix_type& scales);
-
-    /// 
-    /// (Re)initialization of the current scale setting for active parameters
-    /// 
-    /// @param scales parameter scale matrix (must be m_numActiveParams x 1)
-    ///
-    void setActiveScales(optimization::matrix_type& scales);
-    
-    ///
-    /// Definition of a lower bound for an individual parameter
-    /// 
-    /// @param paramnumber number of the parameter in the overall parameter set
-    /// @param lowerbound the lower bound for this parameter
-    ///
-    void setLowerBound(int paramnumber, float lowerbound);
-    
-    ///
-    /// Definition of an upper bound for an individual parameter
-    /// 
-    /// @param paramnumber number of the parameter in the overall parameter set
-    /// @param upperbound the upper bound for this parameter
-    ///
-    void setUpperBound(int paramnumber, float upperbound);
-    
-    ///
-    /// Deactivates all lower bounds resulting in a lower bound matrix just containing -infinity.
-    ///
-    void resetLowerBounds();
-    
-    ///
-    /// Deactivates upper bounds and results in an upper bound matrix just containing infinity
-    ///
-    void resetUpperBounds();
-    
-    ///
-    /// Exchange of CostFunction. 
-    /// 
-    /// @param costfunc new CostFunction pointer
-    ///
-    void changeCostFunc(CostFunction* costfunc);
-    
-    ///
-    /// Definition of the optimization strategy. 
-    ///
-    /// @param maximize if maximize=true a maximization of the CostFunction will be performed, otherwise it is minimized (Default)
-    void setMaximize(bool maximize);
-    
-    
-  protected:
-
-  private:
-    ///
-    /// Computes a selection matrix out of the selection vector used for selecting active parameters which can be used to compute smaller dimension matrices containing just the active params (or scales and bounds for active params)
-    ///
-    /// @return selection matrix with dimension m_numActiveParams x m_numParams
-    optimization::matrix_type computeSelectionMatrix() const;
-
-    //! cost function pointer
-    CostFunction* m_costfunc;  
-      
-    //! number of parameters
-    int m_numParams;
-    
-    //! number of active parameters (active parameters are the ones, which currently should be optimized)
-    int m_numActiveParams;
-    
-    //! holds the current parameters as parameter vector
-    optimization::matrix_type m_currentparams;
-    
-    //! holds the current scales for the parameters
-    optimization::matrix_type m_scales;
-    
-    //! upper bounds for parameters
-    optimization::matrix_type m_upperBounds;
-    
-    //! lower bounds for parameters 
-    optimization::matrix_type m_lowerBounds;
-    
-    //! selection matrix: defines the active parameters
-    optimization::matrix_type m_selection;
-    
-    //! flag defining wether the optimization problem is a maximization problem (true) or a minimization problem (false)
-    bool m_maximize; 
-    
-    //! flag defining wether lowerBounds are set
-    bool m_lowerBoundsActive;
-    
-    //! flag defining wether upperBounds are set
-    bool m_upperBoundsActive;
-    
-    //! pointer to dimension wrapper function
-    CostFunction* m_dimwrapper;
-};
-
-
-#endif /* _SimpleOptProblem_h_ */
-

+ 0 - 95
SimpleOptimizer.cpp

@@ -1,95 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-//
-//	SimpleOptimizer.cpp: Implementation of the SimpleOptimizer class.
-//
-//	Written by Matthias Wacker
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <iostream>
-
-#include "optimization/SimpleOptimizer.h"
-
-
-SimpleOptimizer::SimpleOptimizer(OptLogBase *loger) : SuperClass(loger)
-{
-}
-
-SimpleOptimizer::SimpleOptimizer( const SimpleOptimizer &opt) : SuperClass(opt)
-{
-}
-
-SimpleOptimizer  & SimpleOptimizer::operator=(const SimpleOptimizer &opt)
-{
-		
-	/*
-			avoid self-copy
-	*/
-	if(this != &opt)
-	{
-		
-		//
-		//	=operator of SuperClass
-		//
-		SuperClass::operator=(opt);
-
-		//
-		//	own values:
-		// currently no member variables
-	}
-
-  	return *this;
-}
-
-SimpleOptimizer::~SimpleOptimizer()
-{
-}
-
-
-void SimpleOptimizer::init()
-{
-	SuperClass::init();
-}
-
-
-int SimpleOptimizer::optimizeProb(SimpleOptProblem &optProb)
-{
-	// get settings
-	getSettings(optProb);
-
-	// run optimization
-	int returnReason = optimize(); // implementation in child!
-
-	//store result
-	setResult(optProb);	
-
-	// return the return reason	
-	return returnReason;
-}
-
-
-void SimpleOptimizer::setResult(SimpleOptProblem &optProb)
-{
-	matrix_type tmp = this->getLastParameters(); 
-	optProb.setActiveCurrentParameters(tmp);
-}
-
-void SimpleOptimizer::getSettings(SimpleOptProblem &optProb)
-{
-	// Costf
-	m_costFunction=optProb.getCostFunction();
-	m_numberOfParameters=m_costFunction->getNumOfParameters();
-	
-	// bounds
-	setLowerParameterBound(optProb.lowerBoundsActive(),optProb.getActiveLowerBounds());
-	setUpperParameterBound(optProb.upperBoundsActive(),optProb.getActiveUpperBounds());
-
-	// scales
-	setScales(optProb.getActiveScales());
-	
-	// initial params
-	setParameters(optProb.getActiveCurrentParams());
-
-	// max
-	setMaximize(optProb.getMaximize());
-}

+ 0 - 85
SimpleOptimizer.h

@@ -1,85 +0,0 @@
-///
-///	@file	SimpleSimpleOptimizer.h: interface of the SimpleOptimizer class.
-///	@author	Matthias Wacker, Esther Platzer
-///
-
-#ifndef _SIMPLEOPTIMIZER_H_
-#define _SIMPLEOPTIMIZER_H_
-
-#include "optimization/Optimizer.h"
-#include "optimization/SimpleOptProblem.h"
-#include "optimization/Opt_Namespace.h"
-
-namespace opt=optimization;
-
-/*!
-	Abstract base class of all optimizers.
- */
-class SimpleOptimizer : public Optimizer
-{
-	public:
-		/// the SuperClass is Optimizer
-		typedef 	Optimizer 	SuperClass;
-
-		
-		///
-		///	Constructor (also the default constructor)
-		///	@param loger OptLogBase * to existing log class or NULL
-		///
-		SimpleOptimizer(OptLogBase *loger=NULL);
-
-		///
-		///	Copy constructor
-		///	@param opt .. optimizer to copy
-		///
-		SimpleOptimizer( const SimpleOptimizer &opt);
-
-		///
-		///	assignment opterator
-		///	@param opt optimizer to "copy"
-		///	@return self-reference
-		///
-		SimpleOptimizer  &operator=(const SimpleOptimizer &opt);
-
-
-		///
-		///		Destructor.
-	    ///
-	    virtual ~SimpleOptimizer();
-
-		///
-		///	start the optimization for the simple optimization problem
-		///	@param optProb the optimization problem to solve
-		///
-		virtual int optimizeProb(SimpleOptProblem &optProb);
-
-
-protected:
-		///
-		/// redeclaring the interface of opt
-		///
-		virtual int optimize() = 0;
-
-		///
-		///	do initializations (this is called from child class and calls superclass::init)
-		///
-		void init();
-
-		///
-		/// call after optimization to store the result in the optProblem 
-		///
-		///	@param optProb the optimization problem 
-		///
-		void setResult(SimpleOptProblem &optProb);
-
-		///
-		///	get all settings from the optimization problem
-		///
-		///	@param optProb the optimization problem
-		///
-		void getSettings(SimpleOptProblem &optProb);
-
-
-};
-
-#endif

+ 6 - 6
liboptimization.h

@@ -6,19 +6,19 @@
 #include "optimization/AdaptiveDirectionRandomSearchOptimizer.h"
 #include "optimization/AdditionalIceUtils.h"
 #include "optimization/CombinatorialOptimizer.h"
-#include "optimization/CostFunction.h" 
+#include "core/optimization/blackbox/CostFunction.h" 
 #include "optimization/CostFunction_ndim_2ndOrder.h"
 #include "optimization/DimWrapperCostFunction.h"
-#include "optimization/DownhillSimplexOptimizer.h" 
+#include "core/optimization/blackbox/DownhillSimplexOptimizer.h" 
 #include "optimization/BFGSOptimizer.h"
 #include "optimization/PowellBrentOptimizer.h"
 #include "optimization/GradientDescentOptimizer.h"
 #include "optimization/EmptyLog.h"
-#include "optimization/Optimizable.h"
-#include "optimization/SimpleOptimizer.h"
+#include "core/optimization/blackbox/Optimizable.h"
+#include "core/optimization/blackbox/SimpleOptimizer.h"
 #include "optimization/Optimizer.h"
-#include "optimization/SimpleOptProblem.h"
-#include "optimization/OptLogBase.h"
+#include "core/optimization/blackbox/SimpleOptProblem.h"
+#include "core/optimization/blackbox/OptLogBase.h"
 #include "optimization/FileLog.h"
 #include "optimization/ParamLog.h"
 #include "optimization/Plotter.h"

+ 1 - 1
tests/MyCostFunction.h

@@ -2,7 +2,7 @@
 #define _MYCOSTFUNCTION_H
 
 //#include <cppunit/extensions/HelperMacros.h>
-#include "optimization/CostFunction.h"
+#include "core/optimization/blackbox/CostFunction.h"
 
 //define a simple cost function for one-dimensional or two-dimensional data
 class MyCostFunction : public CostFunction

+ 1 - 1
tests/TestDownhillSimplex.h

@@ -2,7 +2,7 @@
 #define _TESTDOWNHILLSIMPLEX_H
 
 #include <cppunit/extensions/HelperMacros.h>
-#include "optimization/DownhillSimplexOptimizer.h"
+#include "core/optimization/blackbox/DownhillSimplexOptimizer.h"
 
 /**
  * @brief CppUnit-Testcase for Downhill-Simplex Optimization