#include "itkExampleCostFunction.h"
typedef itk::ExampleCostFunction CostType;
int main(int, char *[])
{
CostType::Pointer cost = CostType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
optimizer->SetNumberOfIterations( 100 );
optimizer->UseCostFunctionGradientOff();
optimizer->SetCostFunction( cost );
CostType::ParametersType p(cost->GetNumberOfParameters());
p.Fill( 1 );
optimizer->SetInitialPosition(p);
optimizer->StartOptimization();
std::cout << "Position: " << optimizer->GetCurrentPosition() << std::endl;
std::cout << "Value: " << optimizer->GetValue() << std::endl;
return EXIT_SUCCESS;
}