#include <SequentialMinimizer.h>
Public Types | |
enum | ImproveRet { Unchanged = 2, Done = 1, NotDone = 0 } |
Public Member Functions | |
const char * | cname () const |
ImproveRet | improve (int steps=1, double ytol=0, double xtol=0, bool force=true) |
void | init (const MinimizerContext &ctx, unsigned int idx, double xmin, double xmax, double xstep, const std::string &name) |
void | initDefault (const MinimizerContext &ctx, unsigned int idx) |
void | initUnbound (const MinimizerContext &ctx, unsigned int idx, double xstep, const std::string &name) |
bool | isInit () const |
double | max () const |
double | min () const |
bool | minimize (int steps=1, double ytol=0, double xtol=0) |
void | moveTo (double x) |
const std::string & | name () const |
OneDimMinimizer () | |
OneDimMinimizer (const MinimizerContext &ctx, unsigned int idx) | |
OneDimMinimizer (const MinimizerContext &ctx, unsigned int idx, double xmin, double xmax, double xstep, const std::string &name) | |
double | step () const |
Private Member Functions | |
void | assign (int to, int from) |
bool | doloop (int steps, double ytol, double xtol) |
double | eval () |
double | eval (double x) |
void | goldenBisection () |
do the golden bisection More... | |
double | parabolaFit () |
do the parabola fit More... | |
bool | parabolaStep () |
do the parabola fit More... | |
void | reseek () |
void | seek () |
search for a triplet of points bracketing the maximum. return false in case of errors More... | |
double & | x () |
evaluate function at x More... | |
Private Attributes | |
const MinimizerContext * | f_ |
unsigned int | idx_ |
std::string | name_ |
double | xi_ [3] |
double | xmax_ |
double | xmin_ |
double | xstep_ |
double | yi_ [3] |
Definition at line 26 of file SequentialMinimizer.h.
improve minimum, re-evaluating points (other parameters of the function might have changed) return value is: 0: minimum changed, and did not converge there yet 1: minimum changed, but did converge to it 2: minimum did not change significantly in case 2, then the final position is NOT changed at all. force = true will instead force the update even if it's trivial
Enumerator | |
---|---|
Unchanged | |
Done | |
NotDone |
Definition at line 63 of file SequentialMinimizer.h.
|
inline |
Definition at line 28 of file SequentialMinimizer.h.
|
inline |
Definition at line 29 of file SequentialMinimizer.h.
|
inline |
Definition at line 31 of file SequentialMinimizer.h.
|
inlineprivate |
Definition at line 106 of file SequentialMinimizer.h.
References Capri::details::from(), xi_, and yi_.
|
inline |
Definition at line 35 of file SequentialMinimizer.h.
References name_.
Referenced by cmsmath::SequentialMinimizer::improve().
|
private |
basic loop return false if ended steps, true if reached tolerance
Definition at line 113 of file SequentialMinimizer.cc.
References DEBUG_ODM_printf, i, max(), and relval_steps::steps.
|
inlineprivate |
Definition at line 103 of file SequentialMinimizer.h.
References cmsmath::MinimizerContext::eval(), and f_.
|
inlineprivate |
Definition at line 104 of file SequentialMinimizer.h.
References cmsmath::MinimizerContext::cleanEval(), f_, and idx_.
|
private |
do the golden bisection
pre-condition: the endpoint equal to x1 is not the highest
Definition at line 199 of file SequentialMinimizer.cc.
References assign.
cmsmath::OneDimMinimizer::ImproveRet cmsmath::OneDimMinimizer::improve | ( | int | steps = 1 , |
double | ytol = 0 , |
||
double | xtol = 0 , |
||
bool | force = true |
||
) |
Definition at line 47 of file SequentialMinimizer.cc.
References DEBUG_ODM_printf, run_regression::done, max(), and vdt::x.
Referenced by cmsmath::SequentialMinimizer::improve().
|
inline |
Definition at line 41 of file SequentialMinimizer.h.
References f_, idx_, name(), name_, xmax_, xmin_, and xstep_.
Referenced by initDefault(), and initUnbound().
void cmsmath::OneDimMinimizer::initDefault | ( | const MinimizerContext & | ctx, |
unsigned int | idx | ||
) |
Definition at line 30 of file SequentialMinimizer.cc.
References infinity, and init().
|
inline |
Definition at line 46 of file SequentialMinimizer.h.
References infinity, and init().
|
inline |
Definition at line 40 of file SequentialMinimizer.h.
References f_.
Referenced by cmsmath::SequentialMinimizer::minimize().
|
inline |
Definition at line 36 of file SequentialMinimizer.h.
References xmax_.
Referenced by cmsmath::SequentialMinimizer::doFullMinim().
|
inline |
Definition at line 37 of file SequentialMinimizer.h.
References xmin_.
Referenced by cmsmath::SequentialMinimizer::doFullMinim().
bool cmsmath::OneDimMinimizer::minimize | ( | int | steps = 1 , |
double | ytol = 0 , |
||
double | xtol = 0 |
||
) |
do N steps of golden bisection (or until tolerance in x, y is reached) return true if converged, false if finished steps
Definition at line 35 of file SequentialMinimizer.cc.
References run_regression::done, and vdt::x.
Referenced by cmsmath::SequentialMinimizer::minimize().
void cmsmath::OneDimMinimizer::moveTo | ( | double | x | ) |
Definition at line 285 of file SequentialMinimizer.cc.
References max(), min, and vdt::x.
Referenced by cmsmath::SequentialMinimizer::doFullMinim().
|
inline |
Definition at line 34 of file SequentialMinimizer.h.
References name_.
Referenced by cmsmath::SequentialMinimizer::doFullMinim(), and init().
|
private |
|
private |
do the parabola fit
Definition at line 266 of file SequentialMinimizer.cc.
|
private |
re-search for a triplet of points bracketing the maximum. return false in case of errors assume that value and error make sense
Definition at line 141 of file SequentialMinimizer.cc.
|
private |
search for a triplet of points bracketing the maximum. return false in case of errors
Definition at line 132 of file SequentialMinimizer.cc.
References max().
|
inline |
Definition at line 38 of file SequentialMinimizer.h.
References xstep_.
Referenced by cmsmath::SequentialMinimizer::doFullMinim().
|
inlineprivate |
evaluate function at x
Definition at line 102 of file SequentialMinimizer.h.
References f_, idx_, and cmsmath::MinimizerContext::x.
Referenced by svgfig.Curve.Sample::__repr__(), svgfig.Ellipse::__repr__(), Vispa.Gui.WidgetContainer.WidgetContainer::autosize(), Vispa.Gui.VispaWidget.VispaWidget::boundingRect(), geometryXMLparser.Alignable::pos(), and Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget().
|
private |
|
private |
Definition at line 71 of file SequentialMinimizer.h.
|
private |
Definition at line 73 of file SequentialMinimizer.h.
|
private |
Definition at line 76 of file SequentialMinimizer.h.
Referenced by assign().
|
private |
Definition at line 79 of file SequentialMinimizer.h.
|
private |
Definition at line 79 of file SequentialMinimizer.h.
|
private |
Definition at line 79 of file SequentialMinimizer.h.
|
private |
Definition at line 76 of file SequentialMinimizer.h.
Referenced by assign().