double OptimizationAlgorithmBase::getObjectiveValue( const char* fileName ) const{ FILE *file = fopen(fileName,"w"); acadoFPrintf( file , "%.16e \n", getObjectiveValue() ); fclose(file); return SUCCESSFUL_RETURN; }
void SimulatedAnnealing::optimiseImplementation() { ++numberOfIterations_; bestParameter_ = initialParameter_; bestObjectiveValue_ = getObjectiveValue(initialParameter_); arma::Col<double> state = bestParameter_; while (!isFinished() && !isTerminated()) { ++numberOfIterations_; const arma::Col<double>& candidateParameter = getRandomNeighbour(bestParameter_, arma::zeros<arma::Col<double>>(numberOfDimensions_), maximalStepSize_); const double candidateObjectiveValue = getObjectiveValue(candidateParameter); if (updateBestParameter(candidateParameter, candidateObjectiveValue) || isAcceptableState(candidateObjectiveValue)) { state = candidateParameter; } } }