Public Member Functions | |
| PDEConstrainedObjBase (const Functional &lagrangian, const Array< Expr > &stateVarVals, const Array< Expr > &adjointVarVals, const Expr &designVarVal, const RCP< IterCallbackBase > &iterCallback, int verb=0) | |
| PDEConstrainedObjBase (const Functional &lagrangian, const Array< Expr > &stateVarVals, const Array< Expr > &adjointVarVals, const Expr &designVarVal, int verb=0) | |
| virtual | ~PDEConstrainedObjBase () |
| void | evalGrad (const Vector< double > &x, double &f, Vector< double > &grad) const |
| void | eval (const Vector< double > &x, double &f) const |
| Vector< double > | getInit () const |
| virtual void | statePostprocCallback () const |
| virtual void | iterationCallback (const Vector< double > &x, int iter) const |
| const Mesh & | mesh () const |
| int | numFuncEvals () const |
| virtual void | solveState (const Vector< double > &x) const =0 |
| virtual void | solveStateAndAdjoint (const Vector< double > &x) const =0 |
| virtual void | initEquations (const Array< Expr > &stateVars, const Array< Expr > &adjointVars, const Array< Array< Expr > > &fixedVarsInStateEqns, const Array< Array< Expr > > &fixedVarsInStateEqnsVals, const Array< Array< Expr > > &fixedVarsInAdjointEqns, const Array< Array< Expr > > &fixedVarsInAdjointEqnsVals)=0 |
| void | setHScale (const double &H) |
| double | getInvHScale () const |
| const Expr & | designVar () const |
| const Array< Expr > & | stateVars () const |
| const Array< Expr > & | adjointVars () const |
Protected Member Functions | |
| void | init (const Array< Expr > &stateVars, const Array< Expr > &adjointVars, const Expr &designVar) |
| Expr & | designVarVal () const |
| Expr & | stateVarVals (int i) const |
| Expr & | adjointVarVals (int i) const |
| const Functional & | Lagrangian () const |
Private Attributes | |
| Functional | Lagrangian_ |
| Expr | designVarVal_ |
| Array< Expr > | stateVarVals_ |
| Array< Expr > | adjointVarVals_ |
| FunctionalEvaluator | fEval_ |
| int | numFuncEvals_ |
| int | numGradEvals_ |
| double | invHScale_ |
| RCP< IterCallbackBase > | iterCallback_ |
PDEConstrainedObj is a base class for objective functions of the reduced-space variable where the constraint is a PDE in the state variables. Objects of this type are suitable for use in adjoint gradient methods.
One constructs such an objective function by giving it a Lagrangian in the form of a Sundance Functional, along with a specification of which functions are to be regarded as the adjoint, state, and design variables.
Definition at line 66 of file PDEOptPDEConstrainedObjBase.hpp.
| PDEConstrainedObjBase::PDEConstrainedObjBase | ( | const Functional & | lagrangian, |
| const Array< Expr > & | stateVarVals, | ||
| const Array< Expr > & | adjointVarVals, | ||
| const Expr & | designVarVal, | ||
| const RCP< IterCallbackBase > & | iterCallback, | ||
| int | verb = 0 |
||
| ) |
Constructor
Definition at line 74 of file PDEOptPDEConstrainedObjBase.cpp.
| PDEConstrainedObjBase::PDEConstrainedObjBase | ( | const Functional & | lagrangian, |
| const Array< Expr > & | stateVarVals, | ||
| const Array< Expr > & | adjointVarVals, | ||
| const Expr & | designVarVal, | ||
| int | verb = 0 |
||
| ) |
Constructor
Definition at line 55 of file PDEOptPDEConstrainedObjBase.cpp.
| virtual Sundance::PDEConstrainedObjBase::~PDEConstrainedObjBase | ( | ) | [inline, virtual] |
virtual dtor
Definition at line 88 of file PDEOptPDEConstrainedObjBase.hpp.
| const Array<Expr>& Sundance::PDEConstrainedObjBase::adjointVars | ( | ) | const [inline] |
Access to the adjoint variables
Definition at line 156 of file PDEOptPDEConstrainedObjBase.hpp.
References adjointVarVals_.
Referenced by Sundance::DefaultIterCallback::call().
| Expr& Sundance::PDEConstrainedObjBase::adjointVarVals | ( | int | i | ) | const [inline, protected] |
Access to the adjoint variables
Definition at line 175 of file PDEOptPDEConstrainedObjBase.hpp.
References adjointVarVals_.
Referenced by Sundance::LinearPDEConstrainedObj::initEquations(), and Sundance::NonlinearPDEConstrainedObj::initEquations().
| const Expr& Sundance::PDEConstrainedObjBase::designVar | ( | ) | const [inline] |
Access to the design variable
Definition at line 148 of file PDEOptPDEConstrainedObjBase.hpp.
References designVarVal_.
Referenced by Sundance::DefaultIterCallback::call().
| Expr& Sundance::PDEConstrainedObjBase::designVarVal | ( | ) | const [inline, protected] |
Access to the design variable
Definition at line 167 of file PDEOptPDEConstrainedObjBase.hpp.
References designVarVal_.
Referenced by getInit(), Sundance::LinearPDEConstrainedObj::solveState(), and Sundance::NonlinearPDEConstrainedObj::solveState().
| void PDEConstrainedObjBase::eval | ( | const Vector< double > & | x, |
| double & | f | ||
| ) | const [virtual] |
evaluate objective function without gradient.
Implements Playa::ObjectiveBase.
Definition at line 179 of file PDEOptPDEConstrainedObjBase.cpp.
References adjointVarVals_, Sundance::FunctionalEvaluator::evaluate(), fEval_, Sundance::getDiscreteFunctionVector(), numFuncEvals_, PLAYA_MSG2, Sundance::setDiscreteFunctionVector(), solveState(), Playa::ObjectWithVerbosity::verb(), and Playa::Vector< Scalar >::zero().
| void PDEConstrainedObjBase::evalGrad | ( | const Vector< double > & | x, |
| double & | f, | ||
| Vector< double > & | grad | ||
| ) | const [virtual] |
evaluate objective function and gradient
Implements Playa::ObjectiveBase.
Definition at line 159 of file PDEOptPDEConstrainedObjBase.cpp.
References Playa::Vector< Scalar >::copy(), Sundance::FunctionalEvaluator::evalGradient(), fEval_, Sundance::getDiscreteFunctionVector(), Playa::Vector< Scalar >::norm2(), numFuncEvals_, numGradEvals_, PLAYA_MSG2, PLAYA_MSG5, solveStateAndAdjoint(), and Playa::ObjectWithVerbosity::verb().
| Vector< double > PDEConstrainedObjBase::getInit | ( | ) | const [virtual] |
return an initial guess for the design vector
Implements Playa::ObjectiveBase.
Definition at line 205 of file PDEOptPDEConstrainedObjBase.cpp.
References designVarVal(), and Sundance::getDiscreteFunctionVector().
| double Sundance::PDEConstrainedObjBase::getInvHScale | ( | ) | const [inline, virtual] |
return an initial approximation to the scale for the inverse of the Hessian
Reimplemented from Playa::ObjectiveBase.
Definition at line 144 of file PDEOptPDEConstrainedObjBase.hpp.
References invHScale_.
| void PDEConstrainedObjBase::init | ( | const Array< Expr > & | stateVars, |
| const Array< Expr > & | adjointVars, | ||
| const Expr & | designVar | ||
| ) | [protected] |
Definition at line 94 of file PDEOptPDEConstrainedObjBase.cpp.
References adjointVarVals_, designVarVal_, Sundance::Functional::evaluator(), fEval_, initEquations(), Lagrangian_, stateVars(), and stateVarVals_.
Referenced by Sundance::LinearPDEConstrainedObj::LinearPDEConstrainedObj(), and Sundance::NonlinearPDEConstrainedObj::NonlinearPDEConstrainedObj().
| virtual void Sundance::PDEConstrainedObjBase::initEquations | ( | const Array< Expr > & | stateVars, |
| const Array< Expr > & | adjointVars, | ||
| const Array< Array< Expr > > & | fixedVarsInStateEqns, | ||
| const Array< Array< Expr > > & | fixedVarsInStateEqnsVals, | ||
| const Array< Array< Expr > > & | fixedVarsInAdjointEqns, | ||
| const Array< Array< Expr > > & | fixedVarsInAdjointEqnsVals | ||
| ) | [pure virtual] |
Set up the state and adjoint equations. This is left to the derived class, because we can't know at this level whether the equations are linear or nonlinear
Implemented in Sundance::NonlinearPDEConstrainedObj, and Sundance::LinearPDEConstrainedObj.
Referenced by init().
| void PDEConstrainedObjBase::iterationCallback | ( | const Vector< double > & | x, |
| int | iter | ||
| ) | const [virtual] |
Reimplemented from Playa::ObjectiveBase.
Definition at line 210 of file PDEOptPDEConstrainedObjBase.cpp.
References iterCallback_.
| const Functional& Sundance::PDEConstrainedObjBase::Lagrangian | ( | ) | const [inline, protected] |
Definition at line 178 of file PDEOptPDEConstrainedObjBase.hpp.
References Lagrangian_.
Referenced by Sundance::LinearPDEConstrainedObj::initEquations(), and Sundance::NonlinearPDEConstrainedObj::initEquations().
| const Mesh& Sundance::PDEConstrainedObjBase::mesh | ( | ) | const [inline] |
Definition at line 111 of file PDEOptPDEConstrainedObjBase.hpp.
References Lagrangian_, and Sundance::Functional::mesh().
Referenced by Sundance::DefaultIterCallback::call().
| int Sundance::PDEConstrainedObjBase::numFuncEvals | ( | ) | const [inline, virtual] |
Reimplemented from Playa::ObjectiveBase.
Definition at line 114 of file PDEOptPDEConstrainedObjBase.hpp.
References numFuncEvals_.
| void Sundance::PDEConstrainedObjBase::setHScale | ( | const double & | H | ) | [inline] |
Set the scale of the Hessian
Definition at line 140 of file PDEOptPDEConstrainedObjBase.hpp.
References invHScale_.
| virtual void Sundance::PDEConstrainedObjBase::solveState | ( | const Vector< double > & | x | ) | const [pure virtual] |
Solve the state equations, followed by postprocessing. At the end of this call, the system is ready for evaluation of the objective function or solution of the adjoint equations.
Implemented in Sundance::NonlinearPDEConstrainedObj, and Sundance::LinearPDEConstrainedObj.
Referenced by eval().
| virtual void Sundance::PDEConstrainedObjBase::solveStateAndAdjoint | ( | const Vector< double > & | x | ) | const [pure virtual] |
Solve the state equations, then do postprocessing, then finally the adjoint equations in reverse order. At the end of this call, the system is ready for evaluation of the objective function and its gradient.
Implemented in Sundance::NonlinearPDEConstrainedObj, and Sundance::LinearPDEConstrainedObj.
Referenced by evalGrad().
| virtual void Sundance::PDEConstrainedObjBase::statePostprocCallback | ( | ) | const [inline, virtual] |
Hook for anything that needs to be done between the solution of the state equations and the evaluation of the functional or solution of adjoints.
Default is a no-op.
Definition at line 105 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by Sundance::LinearPDEConstrainedObj::solveState(), and Sundance::NonlinearPDEConstrainedObj::solveState().
| const Array<Expr>& Sundance::PDEConstrainedObjBase::stateVars | ( | ) | const [inline] |
Access to the state variables
Definition at line 152 of file PDEOptPDEConstrainedObjBase.hpp.
References stateVarVals_.
Referenced by Sundance::DefaultIterCallback::call(), and init().
| Expr& Sundance::PDEConstrainedObjBase::stateVarVals | ( | int | i | ) | const [inline, protected] |
Access to the state variables
Definition at line 171 of file PDEOptPDEConstrainedObjBase.hpp.
References stateVarVals_.
Referenced by Sundance::LinearPDEConstrainedObj::initEquations(), Sundance::NonlinearPDEConstrainedObj::initEquations(), and Sundance::LinearPDEConstrainedObj::solveState().
Array<Expr> Sundance::PDEConstrainedObjBase::adjointVarVals_ [mutable, private] |
Definition at line 188 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by adjointVars(), adjointVarVals(), eval(), and init().
Expr Sundance::PDEConstrainedObjBase::designVarVal_ [mutable, private] |
Definition at line 184 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by designVar(), designVarVal(), and init().
Definition at line 190 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by eval(), evalGrad(), and init().
double Sundance::PDEConstrainedObjBase::invHScale_ [private] |
Definition at line 196 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by getInvHScale(), and setHScale().
RCP<IterCallbackBase> Sundance::PDEConstrainedObjBase::iterCallback_ [private] |
Definition at line 198 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by iterationCallback().
Definition at line 182 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by init(), Lagrangian(), and mesh().
int Sundance::PDEConstrainedObjBase::numFuncEvals_ [mutable, private] |
Definition at line 192 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by eval(), evalGrad(), and numFuncEvals().
int Sundance::PDEConstrainedObjBase::numGradEvals_ [mutable, private] |
Definition at line 194 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by evalGrad().
Array<Expr> Sundance::PDEConstrainedObjBase::stateVarVals_ [mutable, private] |
Definition at line 186 of file PDEOptPDEConstrainedObjBase.hpp.
Referenced by init(), stateVars(), and stateVarVals().