00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef BALL_MOLMEC_MINIMIZATION_LINESEARCH_H
00010 #define BALL_MOLMEC_MINIMIZATION_LINESEARCH_H
00011
00012 #ifndef BALL_COMMON_H
00013 # include <BALL/common.h>
00014 #endif
00015
00016 namespace BALL
00017 {
00018 class EnergyMinimizer;
00019
00032 class BALL_EXPORT LineSearch
00033 {
00034 public:
00035
00039
00040 BALL_CREATE(LineSearch)
00041
00042
00044 LineSearch();
00045
00048 LineSearch(EnergyMinimizer& minimizer);
00049
00052 LineSearch(const LineSearch& line_search);
00053
00056 virtual ~LineSearch() ;
00057
00059
00062
00065 const LineSearch& operator=(const LineSearch& LineSearch);
00066
00068
00071
00075 void setAlpha(double alpha);
00076
00080 void setBeta(double beta);
00081
00085 double getAlpha() const;
00086
00090 double getBeta() const;
00091
00094 Size getMaxSteps() const;
00095
00098 void setMaxSteps(Size steps);
00099
00103 void setLowerBound(double lbound);
00104
00107 double getLowerBound() const;
00108
00111 void setXTol(double xtol);
00112
00115 double getXTol() const;
00116
00124 void setBracketedFlag(bool bracktd);
00125
00130 bool isBracketed() const;
00131
00135 void setMinimizer(EnergyMinimizer& minimizer);
00136
00158 virtual void takeStep(double &st_a, double &f_a, double &g_a, double &st_b, double &f_b,
00159 double &g_b, double &stp, double f, double g, double minstp, double maxstp);
00160
00162
00165
00195 virtual bool minimize(double& stp, bool keep_gradient = false);
00197
00198 protected:
00199
00200
00201
00202 double alpha_;
00203
00204
00205
00206 double beta_;
00207
00208
00209
00210 Size max_steps_;
00211
00212
00213
00214 double lower_energy_bound_;
00215
00216
00217
00218 double stptol_;
00219
00220
00221
00222 bool is_bracketed_;
00223
00224
00225
00226 EnergyMinimizer* minimizer_;
00227
00228 };
00229
00230 }
00231
00232 #endif // BALL_MOLMEC_MINIMIZATION/LINESEARCH_H