19 #ifndef JSBSim_FGNelderMead_H 20 #define JSBSim_FGNelderMead_H 35 virtual double eval(
const std::vector<double> & v) = 0;
41 virtual void eval(
const std::vector<double> & v) = 0;
46 const std::vector<double> & lowerBound,
47 const std::vector<double> & upperBound,
48 const std::vector<double> & initialStepSize,
int iterMax=2000,
49 double rtol=std::numeric_limits<float>::epsilon(),
50 double abstol=std::numeric_limits<float>::epsilon(),
52 double randomization=0.1,
53 bool showConvergeStatus=
true,
bool showSimplex=
false,
56 std::vector<double> getSolution();
65 double m_randomization;
66 const std::vector<double> & m_lowerBound;
67 const std::vector<double> & m_upperBound;
68 size_t m_nDim, m_nVert;
69 int m_iMax, m_iNextMax, m_iMin;
70 std::vector< std::vector<double> > m_simplex;
71 std::vector<double> m_cost;
72 std::vector<double> m_elemSum;
74 const std::vector<double> & initialGuess;
75 const std::vector<double> & initialStepSize;
77 double rtol,abstol,speed;
78 bool showConvergeStatus, showSimplex, pause;
79 double rtolI, minCostPrevResize, minCost, minCostPrev,
83 double getRandomFactor();
84 double tryStretch(
double factor);
86 void constructSimplex(
const std::vector<double> & guess,
const std::vector<double> & stepSize);
87 void boundVertex(std::vector<double> & vertex,
88 const std::vector<double> & upperBound,
89 const std::vector<double> & lowerBound);
90 double eval(
const std::vector<double> & vertex,
bool check =
false);