#include "ExampleCostFunction.h"
typedef itk::ExampleCostFunction CostType;
int main(int argc, char ** argv)
{
OptimizerType::Pointer optimizer = OptimizerType::New();
optimizer->SetMaximumNumberOfIterations( 100 );
optimizer->SetParametersConvergenceTolerance( 0.01 );
optimizer->SetFunctionConvergenceTolerance( 0.01 );
CostType::Pointer cost = CostType::New();
optimizer->SetCostFunction( cost.GetPointer() );
OptimizerType::ParametersType initial(2);
initial[0] = 123;
initial[1] = -97.4;
optimizer->SetInitialPosition( initial );
optimizer->StartOptimization();
std::cout << "Position: " << optimizer->GetCurrentPosition() << std::endl;
std::cout << "Value: " << optimizer->GetValue() << std::endl;
return EXIT_SUCCESS;
}