DOpE
reducednewtonalgorithmwithinverse.h
Go to the documentation of this file.
1 
24 #ifndef REDUCEDNEWTON__ALGORITHM_INVERSE_H_
25 #define REDUCEDNEWTON__ALGORITHM_INVERSE_H_
26 
27 #include "reducednewtonalgorithm.h"
28 #include "parameterreader.h"
29 
30 #include <iostream>
31 #include <assert.h>
32 #include <iomanip>
33 namespace DOpE
34 {
49  template <typename PROBLEM, typename VECTOR>
51  {
52  public:
68  ParameterReader &param_reader,
69  DOpEExceptionHandler<VECTOR>* Except=NULL,
70  DOpEOutputHandler<VECTOR>* Output=NULL,
71  int base_priority=0);
73 
79  static void declare_params(ParameterReader &param_reader);
80 
81 
91  virtual int Solve(ControlVector<VECTOR>& q,double global_tol=-1.);
92 
93  protected:
112  const ControlVector<VECTOR>& gradient,
113  const ControlVector<VECTOR>& gradient_transposed,
115 
116  double Residual(const ControlVector<VECTOR>& gradient,
117  const ControlVector<VECTOR>& /*gradient_transposed*/)
118  {return gradient*gradient;}
119  private:
120  unsigned int line_maxiter_;
121  double linesearch_rho_, linesearch_c_;
122 
123  };
124 
125  /***************************************************************************************/
126  /****************************************IMPLEMENTATION*********************************/
127  /***************************************************************************************/
128  using namespace dealii;
129 
130  /******************************************************/
131 
132 template <typename PROBLEM, typename VECTOR>
134  {
136  }
137 /******************************************************/
138 
139 template <typename PROBLEM, typename VECTOR>
143  ParameterReader &param_reader,
146  int base_priority)
147  : ReducedNewtonAlgorithm<PROBLEM, VECTOR>(OP,S,param_reader,Except,Output,base_priority)
148  {
149  param_reader.SetSubsection("reducednewtonalgorithm parameters");
150  line_maxiter_ = param_reader.get_integer ("line_maxiter");
151  linesearch_rho_ = param_reader.get_double ("linesearch_rho");
152  linesearch_c_ = param_reader.get_double ("linesearch_c");
153  }
154 
155 /******************************************************/
156 
157 template <typename PROBLEM, typename VECTOR>
159  {
160 
161  }
162 /******************************************************/
163 
164 template <typename PROBLEM, typename VECTOR>
166 {
168 }
169 
170 /******************************************************/
171 
172 template <typename PROBLEM, typename VECTOR>
175  const ControlVector<VECTOR>& gradient,
176  const ControlVector<VECTOR>& /*gradient_transposed*/,
178 {
179  int iter = 0;
180  this->GetReducedProblem()->ComputeReducedHessianInverseVector(q,gradient,dq);
181 // {
182 // //Check...
183 // ControlVector<VECTOR> Hd(q), Hd_transposed(q);
184 // this->GetReducedProblem()->ComputeReducedHessianVector(q,dq,Hd,Hd_transposed);
185 // Hd.add(-1.,gradient);
186 // std::cout<<" Linear residual "<<Hd*Hd<<std::endl;
187 // }
188  return iter;
189 }
190 
191 
192 /******************************************************/
193 }
194 #endif
virtual int Solve(ControlVector< VECTOR > &q, double global_tol=-1.)
Definition: reducednewtonalgorithmwithinverse.h:165
double get_double(const std::string &entry_name)
Definition: parameterreader.h:115
Definition: parameterreader.h:36
Definition: optproblemcontainer.h:70
double Residual(const ControlVector< VECTOR > &gradient, const ControlVector< VECTOR > &)
Definition: reducednewtonalgorithmwithinverse.h:116
~ReducedNewtonAlgorithmWithInverse()
Definition: reducednewtonalgorithmwithinverse.h:158
int SolveReducedLinearSystem(const ControlVector< VECTOR > &q, const ControlVector< VECTOR > &gradient, const ControlVector< VECTOR > &gradient_transposed, ControlVector< VECTOR > &dq)
Definition: reducednewtonalgorithmwithinverse.h:174
Definition: controlvector.h:49
Definition: reducednewtonalgorithm.h:50
virtual int Solve(ControlVector< VECTOR > &q, double global_tol=-1.)
Definition: reducednewtonalgorithm.h:250
static void declare_params(ParameterReader &param_reader)
Definition: reducednewtonalgorithmwithinverse.h:133
int get_integer(const std::string &entry_name)
Definition: parameterreader.h:126
static void declare_params(ParameterReader &param_reader)
Definition: reducednewtonalgorithm.h:161
void SetSubsection(const std::string subsection)
Definition: parameterreader.h:93
Definition: reducednewtonalgorithmwithinverse.h:50
Definition: reducedprobleminterface.h:335
ReducedNewtonAlgorithmWithInverse(PROBLEM *OP, ReducedProblemInterface< PROBLEM, VECTOR > *S, ParameterReader &param_reader, DOpEExceptionHandler< VECTOR > *Except=NULL, DOpEOutputHandler< VECTOR > *Output=NULL, int base_priority=0)
Definition: reducednewtonalgorithmwithinverse.h:141
Definition: optproblemcontainer.h:72