KASKADE 7 development version
hyp_ip.hh
Go to the documentation of this file.
1#ifndef HYP_IP_HH
2#define HYP_IP_HH
3
4#include <memory>
5#include "newton_base.hh"
6#include "newton_damped.hh"
7#include "searchspace.hh"
8
9namespace Kaskade
10{
11
12class HypIP;
13
15{
16public:
17 HypIPParameters(double desiredAccuracy_, int maxSteps_) :
18 IterationParameters(desiredAccuracy_, maxSteps_),
19 gamma(1.0),
20 alpha(1.0),
21 sigma(1.0/3.0),
22 Thetad(0.25),
23 ThetaAim(0.9),
24 ThetaNormal(0.5),
25 ThetaMax(1.0),
26 fracBdr(0.25),
27 safetyFactor(1.0),
28 nu0(1.0),
29 tau0(0.0),
30 firstmu(true)
31 {
32 reset();
33 }
34
35
36// Parameters with predefined values that can be changed by client
37 double gamma; // weighing between optimality and feasibility
38 double alpha; // weighing between optimality and feasibility
39 double sigma; // Bit-counting Lemma
40 double Thetad; // desired contraction close to constraints
41 double ThetaAim; // required contraction
42 double ThetaNormal; // required contraction
43 double ThetaMax; // required contraction
44 double fracBdr; // fraction, how much slacks may approach the boundary
46 double nu0,tau0; // starting values for damping
47 bool firstmu;
49
50protected:
51 friend class HypIP;
52
53 virtual void doForAll(LQAction::ToDo td)
54 {
55 omegaC.doAction(td,"omegaC");
56 omegaL.doAction(td,"omegaL");
57 }
58
59};
60
61
62class HypIP : public Algorithm
63{
64public:
65
66 virtual ~HypIP() {}
67
70 AbstractAdaptiveGrid* grid_=0, AbstractCompositeStepErrorEstimator* errorEstimator_=0):
71 RemainderTerm(0.0), nu0(0.0), searchSpace(searchSpace_), normL(nL), normC(nC), chart(chart_), grid(grid_), p(p_), dimx(dimx_), errorEstimator(errorEstimator_)
72 {
73 }
74
75
78
79 virtual IterationParameters const& getParameters() {return p;}
81 void setDesiredAccuracy(double da) { assert(da>0); p.desiredAccuracy=da;}
83 virtual void setDesiredRelativeAccuracy(double ra) { assert(false); }
85 void resetParameters() {p.reset();}
86
87 int stepsPerformed() {return step;}
88 int maxSteps() {return p.maxSteps;}
89protected:
90
93
94
95
96 virtual AcceptanceTest evaluateCorrection(AbstractFunctionSpaceElement& correction, AbstractLinearization& lin, CUBThetaModelFunction& mF, double f0, std::vector<double>& coeff);
97
98// virtual NewtonsMethod::AcceptanceTest evaluateCorrectionOld(
99// AbstractFunctionSpaceElement& correction,
100// AbstractLinearization& lin,
101// CUBModelFunction& mF,
102// double f0,
103// std::vector<double>& coeff);
104
105
106
108 virtual Convergence
109 convergenceTest(AbstractFunctionSpaceElement const& correction, AbstractFunctionSpaceElement const& iterate, std::vector<double>& coeff);
110
112 AbstractFunctionSpaceElement& trialIterate,
113 AbstractLinearization const& lin)
114 {
115// normC.add(trialIterate,iterate,*scorrection,1.0,p.fracBdr);
116// iterate.swap(trialIterate);
117 }
118
119
120 virtual RegularityTest regularityTest(double scalingFactor)
121 {
123 }
124
125 void terminationMessage(int flag);
126
127private:
128 int runAlgorithm();
129 double omegaL,omegaC, Theta, RelNormalSteps, RemainderTerm, normalstepnorm, snormalstepnorm, sbarstepnorm, theta2, nu0;
130 SearchSpaceCreator& searchSpace;
131 AbstractFunctional* functionalN;
132 AbstractFunctional* functionalT;
133 AbstractNormalSolver* normalSolver;
136 AbstractChart& chart;
139 int step;
140 int dimx;
141 std::vector<double> coeff;
142
143 std::unique_ptr<AbstractFunctionSpaceElement> iterate, trialIterate, correction, scorrection;
144 std::vector<AbstractFunctionSpaceElement* > basisVectors;
145 std::vector<std::tr1::shared_ptr<AbstractFunctionSpaceElement> > bV;
146 std::vector<double> coeffs;
147
148 std::unique_ptr<AbstractLinearization> normalLinearization;
149 std::unique_ptr<AbstractLinearization> tangentialLinearization;
150 std::unique_ptr<AbstractErrorEstimate> estimate;
152};
153
154} // namespace Kaskade
155#endif
Representation of an adaptive grid and a simple set of operations thereon.
Representation of an error estimator.
Abstract Vector for function space algorithms.
Representation of a nonlinear functional.
Base class for algorithms. Provides a unified interface and some simple wrapper routines,...
For optimization with cubic upper bounds method.
Definition: searchspace.hh:80
void terminationMessage(int flag)
virtual RegularityTest regularityTest(double scalingFactor)
Definition: hyp_ip.hh:120
void resetParameters()
Reset all algorithmic parameters to their default values.
Definition: hyp_ip.hh:85
virtual IterationParameters const & getParameters()
Definition: hyp_ip.hh:79
void solve(AbstractFunctional *fN, AbstractFunctional *fT, AbstractFunctionSpaceElement &x)
Solve the system f=0 with starting value x. On (successful) exit, the solution is x,...
virtual AcceptanceTest evaluateCorrection(AbstractFunctionSpaceElement &correction, AbstractLinearization &lin, CUBThetaModelFunction &mF, double f0, std::vector< double > &coeff)
int stepsPerformed()
Definition: hyp_ip.hh:87
void dampingLoop()
HypIP(SearchSpaceCreator &searchSpace_, AbstractScalarProduct &nL, AbstractScalarProduct &nC, AbstractChart &chart_, HypIPParameters &p_, int dimx_, AbstractAdaptiveGrid *grid_=0, AbstractCompositeStepErrorEstimator *errorEstimator_=0)
Create Newton's Method, providing a solver, a norm and algorithmic parameters.
Definition: hyp_ip.hh:69
int maxSteps()
Definition: hyp_ip.hh:88
virtual ~HypIP()
Definition: hyp_ip.hh:66
int refinementLoop()
virtual void setDesiredRelativeAccuracy(double ra)
set the desired accuracy
Definition: hyp_ip.hh:83
virtual Convergence convergenceTest(AbstractFunctionSpaceElement const &correction, AbstractFunctionSpaceElement const &iterate, std::vector< double > &coeff)
Return true, if convergence is detected, false otherwise.
void setDesiredAccuracy(double da)
set the desired accuracy
Definition: hyp_ip.hh:81
virtual void updateIterate(AbstractFunctionSpaceElement &iterate, AbstractFunctionSpaceElement &trialIterate, AbstractLinearization const &lin)
Definition: hyp_ip.hh:111
virtual void doForAll(LQAction::ToDo td)
To be overloaded by derived class.
Definition: hyp_ip.hh:53
LoggedQuantity< double > omegaL
Definition: hyp_ip.hh:48
HypIPParameters(double desiredAccuracy_, int maxSteps_)
Definition: hyp_ip.hh:17
LoggedQuantity< double > omegaC
Definition: hyp_ip.hh:48
Base class for algorithmic parameters.
virtual void reset()
Reset all quantities in this class.
void doAction(LQAction::ToDo td, std::string const &name_="noName")
enum toDo ToDo
Some model functions for various purposes.