33 #ifndef __H__UG__LIB_DISC__OPERATOR__NON_LINEAR_OPERATOR__LINE_SEARCH__
34 #define __H__UG__LIB_DISC__OPERATOR__NON_LINEAR_OPERATOR__LINE_SEARCH__
58 template <
typename TVector>
99 template <
typename TVector>
128 std::stringstream ss;
175 number norm, norm_old = defect;
176 bool converged =
false;
177 std::vector<number> vRho;
185 <<
" + Iter lambda Defect Rate \n");
202 vRho.push_back(norm/norm_old);
207 << k <<
": " << std::setw(11)
208 << std::resetiosflags( ::std::ios::scientific )<<
210 << std::scientific << norm <<
" " << vRho.back() <<
"\n");
213 if(vRho.back() <= 1 -
m_alpha * std::fabs(lambda))
233 number rho_min = vRho.front();
234 for(
size_t i = 1; i < vRho.size(); ++i)
236 if(rho_min > vRho[i])
255 best+1 <<
", Rate = "<< vRho[best] <<
".\n");
270 UG_LOG(
"ERROR in 'StandardLineSearch::search':"
271 " maximum defect-limit is reached.\n");
Definition: smart_pointer.h:108
Definition: line_search.h:60
virtual std::string config_string() const =0
returns information about configuration parameters
virtual void set_offset(std::string offset)=0
set string to be printed before each output of line search
virtual ~ILineSearch()
virtual destructor
Definition: line_search.h:95
TVector vector_type
Definition: line_search.h:62
virtual bool search(SmartPtr< IOperator< vector_type > > spOp, vector_type &u, vector_type &p, vector_type &d, number defect)=0
describes a mapping X->Y
Definition: operator.h:86
standard implementation of the line search based on the "sufficient descent"
Definition: line_search.h:101
void set_reduce_factor(number factor)
sets factor by which line search factor is multiplied in each step
Definition: line_search.h:142
std::string m_offset
number of spaces inserted before output
Definition: line_search.h:325
number m_lambdaStart
initial step length scaling
Definition: line_search.h:304
int m_maxSteps
maximum number of steps to be performed
Definition: line_search.h:301
void set_check_all(bool bCheckAll)
sets iff all the max_steps line search steps must be tested even if the sufficient descent is achieve...
Definition: line_search.h:151
void set_suff_descent_factor(number factor)
sets the factor controlling the sufficient descent
Definition: line_search.h:145
vector_type s
solution in line direction
Definition: line_search.h:297
number m_alpha
sufficient descent factor
Definition: line_search.h:310
virtual std::string config_string() const
returns information about configuration parameters
Definition: line_search.h:126
TVector vector_type
Definition: line_search.h:104
number m_maxDefect
maximum allowed defect
Definition: line_search.h:313
void set_maximum_defect(number maxDef)
sets maximum allowed norm of the defect (an exception is thrown if this value if exceeded)
Definition: line_search.h:154
virtual void set_offset(std::string offset)
set string to be printed before each output of line search
Definition: line_search.h:160
void set_maximum_steps(int steps)
sets maximum number of line search steps
Definition: line_search.h:136
void set_verbose(bool level)
sets if info should be printed
Definition: line_search.h:157
void set_lambda_start(number start)
sets start factor
Definition: line_search.h:139
StandardLineSearch(int maxSteps, number lambdaStart, number lambdaReduce, bool bAcceptBest)
constructor
Definition: line_search.h:114
StandardLineSearch()
default constructor (setting default values)
Definition: line_search.h:108
void set_accept_best(bool bAcceptBest)
sets iff after max_steps the best try is used
Definition: line_search.h:148
bool m_bAcceptBest
accept best
Definition: line_search.h:319
virtual bool search(SmartPtr< IOperator< vector_type > > spOp, vector_type &u, vector_type &p, vector_type &d, number defect)
Definition: line_search.h:163
bool m_bCheckAll
check all
Definition: line_search.h:322
bool m_verbose
verbosity level
Definition: line_search.h:316
StandardLineSearch(int maxSteps, number lambdaStart, number lambdaReduce, bool bAcceptBest, bool bCheckAll)
constructor
Definition: line_search.h:120
number m_lambdaReduce
reduction factor for the step length
Definition: line_search.h:307
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
void VecScaleAdd(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
Scales two Vectors, adds them and returns the sum in a third vector.
Definition: math_vector_functions_common_impl.hpp:265
#define PROFILE_BEGIN_GROUP(name, groups)
Definition: profiler.h:255