Bjoern Froehlich 13 жил өмнө
parent
commit
d763ef1cab

+ 1 - 1
GradientDescentOptimizer.cpp

@@ -58,7 +58,7 @@ void GradientDescentOptimizer::init()
 		}
 		if(tmp==false)
 		{
-			std::cerr <<  "GradientDescentOptimizer::init  all stepsizes zero - check your code!"<< endl;
+			std::cerr <<  "GradientDescentOptimizer::init  all stepsizes zero - check your code!"<< std::endl;
 			exit(1);
 		}
 	}

+ 1 - 1
MatrixIterativeOptimizer.cpp

@@ -338,7 +338,7 @@ int MatrixIterativeOptimizer::optimize()
 		// the gradient as iteration direction
 		if( (!m_hk *m_gradient)[0][0] > 0.0)
 		{
-			cout << " resetting matrix" << endl;
+			std::cout << " resetting matrix" << std::endl;
 			resetMatrix();
 			m_hk=m_gradient * -1.0;
 		}

+ 11 - 11
OptTestSuite.cpp

@@ -26,7 +26,7 @@ void OptTestSuite::runAllTests()
 	// seed for test
 	srand ( time(NULL) );
 
-	cout << "beginning runAllTests()"<< endl;
+	std::cout << "beginning runAllTests()"<< std::endl;
 
 	// run simple opt test grid
 	runSimpleOptTestGrid();	
@@ -38,9 +38,9 @@ void OptTestSuite::runAllTests()
 
 void OptTestSuite::runSimpleOptTestGrid()
 {
-	cout << "beginning runSimpleOptTestGrid" << endl;
-	vector<CostFunction*> cfns;
-	vector<Optimizer*> opts;
+	std::cout << "beginning runSimpleOptTestGrid" << std::endl;
+	std::vector<CostFunction*> cfns;
+	std::vector<Optimizer*> opts;
 
 	SimpleOptTestGrid testGrid;
 	
@@ -51,9 +51,9 @@ void OptTestSuite::runSimpleOptTestGrid()
 	insertOptProbsInGrid(testGrid,cfns);
 	
 	// run
-	cout << "running tests"<< endl;
+	std::cout << "running tests"<< std::endl;
 	testGrid.test();
-	cout << "finisshed tests"<< endl;
+	std::cout << "finisshed tests"<< std::endl;
 
 	// delete the optimizers and costfunctions!
 	for (int i =0; i < static_cast<int>(opts.size());++i)
@@ -69,15 +69,15 @@ void OptTestSuite::runSimpleOptTestGrid()
 	}
 	cfns.clear();
 
-	cout << "finished runSimpleOptTestGrid" << endl;
+	std::cout << "finished runSimpleOptTestGrid" << std::endl;
 }
 
 
 
 
-void OptTestSuite::insertOptsInGrid(SimpleOptTestGrid &testGrid, vector<Optimizer*> &opts )
+void OptTestSuite::insertOptsInGrid(SimpleOptTestGrid &testGrid, std::vector<Optimizer*> &opts )
 {
-	cout << "insert opts" << endl;
+	std::cout << "insert opts" << std::endl;
 
 	// 0
 	// DownhillSimplexOptimizer
@@ -126,9 +126,9 @@ void OptTestSuite::insertOptsInGrid(SimpleOptTestGrid &testGrid, vector<Optimize
 }
 
 
-void OptTestSuite::insertOptProbsInGrid(SimpleOptTestGrid &testGrid, vector<CostFunction*> &cfns)
+void OptTestSuite::insertOptProbsInGrid(SimpleOptTestGrid &testGrid, std::vector<CostFunction*> &cfns)
 {
-	cout << "insert opt probs" << endl;
+	std::cout << "insert opt probs" << std::endl;
 
 	int dim=0;
 

+ 2 - 2
OptTestSuite.h

@@ -40,10 +40,10 @@ private:
 	void runSimpleOptTestGrid();
 
 	/// instert optimizers
-	void insertOptsInGrid(SimpleOptTestGrid &testGrid, vector<Optimizer*> &opts);
+	void insertOptsInGrid(SimpleOptTestGrid &testGrid, std::vector<Optimizer*> &opts);
 
 	/// insert opt probs
-	void insertOptProbsInGrid(SimpleOptTestGrid &testGrid, vector<CostFunction*> &cfns);
+	void insertOptProbsInGrid(SimpleOptTestGrid &testGrid, std::vector<CostFunction*> &cfns);
 
 };
 

+ 8 - 8
Plotter.cpp

@@ -98,7 +98,7 @@ void Plotter::plot1D(int paramnum, const float from, const float to, const float
 	while(tmpParams[paramnum][0] <= end)
 	{
 		// evaluate costfunction and write to plotfile
-		plotfile << tmpParams[paramnum][0] << " " << m_pCostfunc->evaluate(tmpParams) << endl;
+		plotfile << tmpParams[paramnum][0] << " " << m_pCostfunc->evaluate(tmpParams) << std::endl;
 		
 		// increment evaluation value
 		tmpParams[paramnum][0]+= stepwidth;
@@ -149,12 +149,12 @@ void Plotter::plot2D(int paramnum1, const float from1, const float to1, const fl
 		while(tmpParams[paramnum2][0] <= end2)
 		{
 			// evaluate costfunction and write to plotfile
-			plotfile << tmpParams[paramnum1][0] << " " << tmpParams[paramnum2][0] << " " << m_pCostfunc->evaluate(tmpParams) << endl;
+			plotfile << tmpParams[paramnum1][0] << " " << tmpParams[paramnum2][0] << " " << m_pCostfunc->evaluate(tmpParams) << std::endl;
 		
 			// increment evaluation value of parameter 2
 			tmpParams[paramnum2][0]+= stepwidth2;
 		}
-		plotfile<<endl;
+		plotfile<<std::endl;
 		// reset inner loop
 		tmpParams[paramnum2][0]= start2;
 		
@@ -192,10 +192,10 @@ void Plotter::plot3D(int paramnum1, const float from1, const float to1, const fl
 	
 	// iterating over the first parameter
 	tmpParams[paramnum1][0]= start1;
-	string filename(const_cast<char*>(path));
+	std::string filename(const_cast<char*>(path));
 	
 	// cutting suffix ".txt", if there
-	if(filename.find(".txt") != string::npos)
+	if(filename.find(".txt") != std::string::npos)
 	{
 		filename.erase(filename.find(".txt"),4);
 	}
@@ -205,7 +205,7 @@ void Plotter::plot3D(int paramnum1, const float from1, const float to1, const fl
 		// generate name of plotfile
 		char number[5];
 		sprintf(number,"%f",tmpParams[paramnum1][0]);
-		string numfilename= filename + "_" + number + ".txt";
+		std::string numfilename= filename + "_" + number + ".txt";
 		
 		// open plot file for writing
 		std::ofstream plotfile;
@@ -239,12 +239,12 @@ void Plotter::plot3D(int paramnum1, const float from1, const float to1, const fl
 			while(tmpParams[paramnum3][0] <= end3)
 			{
 				// evaluate costfunction and write to plotfile
-				plotfile << tmpParams[paramnum2][0] << " " << tmpParams[paramnum3][0] << " " << m_pCostfunc->evaluate(tmpParams) << endl;
+				plotfile << tmpParams[paramnum2][0] << " " << tmpParams[paramnum3][0] << " " << m_pCostfunc->evaluate(tmpParams) << std::endl;
 			
 				// increment evaluation value of parameter 3
 				tmpParams[paramnum3][0]+= stepwidth3;
 			}
-			plotfile<<endl;
+			plotfile<<std::endl;
 			// reset inner loop
 			tmpParams[paramnum3][0]= start3;
 			

+ 4 - 4
SimpleOptProblem.cpp

@@ -71,9 +71,9 @@ SimpleOptProblem::SimpleOptProblem(CostFunction* costfunc, optimization::matrix_
     // init upper and lower bounds with infitniy and -infinity
     for(int i= 0; i< m_numParams; ++i)
     {
-		m_lowerBounds[i][0]= -1.0*numeric_limits<double>::max( );
+		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]= numeric_limits<double>::max( );
+		m_upperBounds[i][0]= std::numeric_limits<double>::max( );
 		//numeric_limits<double>::infinity( );//numeric_limits<float>::max( );
     }
     
@@ -368,7 +368,7 @@ void SimpleOptProblem::resetLowerBounds()
     m_lowerBoundsActive= false;
     for(int i= 0; i< m_numParams; ++i)
     {
-        m_lowerBounds[i][0]= -1.0*numeric_limits<double>::infinity( );
+        m_lowerBounds[i][0]= -1.0*std::numeric_limits<double>::infinity( );
     }
 }
 
@@ -378,7 +378,7 @@ void SimpleOptProblem::resetUpperBounds()
     m_upperBoundsActive= false;
     for(int i= 0; i< m_numParams; ++i)
     {
-        m_upperBounds[i][0]= numeric_limits<double>::infinity( );
+        m_upperBounds[i][0]= std::numeric_limits<double>::infinity( );
     }
 }