gramods
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
gramods::gmMisc::NelderMead< TYPE_OUT, TYPE_IN > Class Template Reference
Collaboration diagram for gramods::gmMisc::NelderMead< TYPE_OUT, TYPE_IN >:
Collaboration graph
[legend]

Public Member Functions

 NelderMead (std::function< TYPE_OUT(const TYPE_IN &X)> F)
 
TYPE_IN solve (const std::vector< TYPE_IN > &X0, size_t &iterations)
 

Public Attributes

std::function< TYPE_OUT(const TYPE_IN &X)> function
 
TYPE_OUT epsilon = std::numeric_limits<TYPE_OUT>::epsilon()
 
std::function< TYPE_IN(const std::vector< std::pair< TYPE_OUT, TYPE_IN > > &F_X)> func_midpoint
 Function to estimate midpoint, i.e.
 
std::function< TYPE_IN(const TYPE_IN &Xm, const TYPE_IN &Xn)> func_reflect
 Function to estimate reflection, i.e.
 
std::function< TYPE_IN(const TYPE_IN &XA, const TYPE_IN &XB)> func_mean
 Function to estimate mean, i.e.
 

Member Data Documentation

◆ func_mean

template<class TYPE_OUT , class TYPE_IN >
std::function<TYPE_IN(const TYPE_IN &XA, const TYPE_IN &XB)> gramods::gmMisc::NelderMead< TYPE_OUT, TYPE_IN >::func_mean
Initial value:
=
[](const TYPE_IN &XA, const TYPE_IN XB) -> TYPE_IN {
return XA * 0.5f + XB * 0.5f;
}

Function to estimate mean, i.e.

0.5 x XA + 0.5 x XB.

◆ func_midpoint

template<class TYPE_OUT , class TYPE_IN >
std::function<TYPE_IN(const std::vector<std::pair<TYPE_OUT, TYPE_IN>> &F_X)> gramods::gmMisc::NelderMead< TYPE_OUT, TYPE_IN >::func_midpoint
Initial value:
=
[](const std::vector<std::pair<TYPE_OUT, TYPE_IN>> &F_X) -> TYPE_IN {
auto factor = 1.f / (F_X.size() - 1.f);
TYPE_IN Xm = F_X.front().second * factor;
for (size_t idx = 1; idx < F_X.size() - 1; idx++) {
Xm = Xm + F_X[idx].second * factor;
}
return Xm;
}

Function to estimate midpoint, i.e.

the mean of all points except the last in the list.

◆ func_reflect

template<class TYPE_OUT , class TYPE_IN >
std::function<TYPE_IN(const TYPE_IN &Xm, const TYPE_IN &Xn)> gramods::gmMisc::NelderMead< TYPE_OUT, TYPE_IN >::func_reflect
Initial value:
=
[](const TYPE_IN &Xm, const TYPE_IN Xn) -> TYPE_IN {
return Xm * 2.f - Xn;
}

Function to estimate reflection, i.e.

Xm + (Xm - Xn).


The documentation for this class was generated from the following file: