40 Real computeSimplexSize (
const std::vector<Array>& vertices) {
41 Array center(vertices.front().size(),0);
42 for (
const auto& vertice : vertices)
44 center *=1/
Real(vertices.size());
46 for (
const auto& vertice : vertices) {
47 Array temp = vertice - center;
48 result +=
Norm2(temp);
50 return result/
Real(vertices.size());
61 Real factor1 = (1.0 - factor)/dimensions;
62 Real factor2 = factor1 - factor;
86 Size maxStationaryStateIterations_
93 QL_FAIL(
"Initial guess " <<
x_ <<
" is not in the feasible region.");
100 for (
Size i=0; i<
n; ++i) {
107 for (
Size i=0; i<=
n; ++i)
118 Size iHighest, iNextHighest;
126 for (i=1;i<=
n; i++) {
128 iNextHighest = iHighest;
149 if (simplexSize < xtol ||
152 maxStationaryStateIterations_, ecType);
163 if ((vTry <=
values_[iLowest]) && (factor == -1.0)) {
167 if (vTry >=
values_[iNextHighest]) {
171 if (vTry >= vSave && std::fabs(factor) >
QL_EPSILON) {
172 for (
Size i=0; i<=
n; i++) {
191 QL_FAIL(
"optimization failed: unexpected behaviour");
1-D array used in linear algebra.
Size size() const
dimension of the array
bool test(const Array &p) const
Real update(Array &p, const Array &direction, Real beta) const
Criteria to end optimization process:
@ StationaryFunctionValue
bool checkStationaryPoint(Real xOld, Real xNew, Size &statStateIterations, EndCriteria::Type &ecType) const
Size maxStationaryStateIterations() const
bool checkMaxIterations(Size iteration, EndCriteria::Type &ecType) const
Constrained optimization problem.
const Array & currentValue() const
current value of the local minimum
void setCurrentValue(Array currentValue)
Constraint & constraint() const
Constraint.
Real value(const Array &x)
call cost function computation and increment evaluation counter
void setFunctionValue(Real functionValue)
std::vector< Array > vertices_
Real extrapolate(Problem &P, Size iHighest, Real &factor) const
EndCriteria::Type minimize(Problem &P, const EndCriteria &endCriteria) override
minimize the optimization problem P
Abstract constraint class.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
Real Norm2(const Array &v)
Simplex optimization method.