/* Optimizer.cpp Written by Matthew Fisher Generic non-linear optimizer. Uses conjugate gradient descent (or other inferior/sub-component algorithms like steepest descent.) For a full description of the Optimizer class, se Optimizer.h. */ const double SmallDelta = 1e-4; //small delta used to calculate the derivative const double LineSearchEpsilon = 1e-4; //starting epsilon for the line search const int LineSearchIterations = 20; //maximum number of line search iterations void Optimizer::ComputeGradient() { double BaseError = Error(); //store the starting error double VStart,NewError; for(UINT i=0;i PrevError) Exit = true; //if we gained error, exit the search else PrevError = CurError; //otherwise keep going LSIters++; if(LSIters > 25) //if we're stuck in an infinite loop, { cout << "Iterations failed." << endl; for(UINT i=0;i