Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 861 Bytes

README.md

File metadata and controls

23 lines (20 loc) · 861 Bytes

nelder_mead

Implementation of the simplest and at the same time effective optimization method — the Nelder—Mead method

!

#include <cmath>
#include <iostream>
#include <nelder_mead/impl.h>

double himmelblau(double x, double y, double z) {
  return std::pow(std::pow(x, 2) + y - 11, 2) + std::pow(x + std::pow(y, 2) - 7, 2);
}

int main() {
  nelder_mead::impl optimizer;
  const auto min_point = optimizer.run(himmelblau);
  std::cout << min_point.value << std::endl;
  std::cout << min_point.vec.x << " " << min_point.vec.y << " " << min_point.vec.z;
}