The quasi-Newton Limited-memory BFGS formula. Keeps nPrevSteps_ of the y and s vectors and approximates the inverse areas through them. Values of 3 < nPrevSteps_ < 20 are suggested. More...
Public Member Functions | |
TypeName ("LBFGS") | |
Runtime type information. More... | |
LBFGS (const fvMesh &mesh, const dictionary &dict) | |
Construct from components. More... | |
virtual | ~LBFGS ()=default |
Destructor. More... | |
void | computeCorrection () |
Compute design variables correction. More... | |
virtual void | updateOldCorrection (const scalarField &oldCorrection) |
virtual void | write () |
Write old info to dict. More... | |
Public Member Functions inherited from updateMethod | |
TypeName ("updateMethod") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, updateMethod, dictionary,(const fvMesh &mesh, const dictionary &dict),(mesh, dict)) | |
updateMethod (const fvMesh &mesh, const dictionary &dict) | |
Construct from components. More... | |
virtual | ~updateMethod ()=default |
Destructor. More... | |
void | setObjectiveDeriv (const scalarField &derivs) |
Set objective derivative. More... | |
void | setConstraintDeriv (const PtrList< scalarField > &derivs) |
Set constraints derivative. More... | |
void | setObjectiveValue (const scalar value) |
Set constraints derivative. More... | |
void | setConstraintValues (const scalarField &values) |
Set constraints derivative. More... | |
void | setStep (const scalar eta) |
Set step for optimisation methods. More... | |
void | setGlobalSum (const bool useGlobalSum) |
Set globalSum variable. More... | |
virtual void | computeCorrection ()=0 |
Return the correction of the design variables. More... | |
scalarField & | returnCorrection () |
Return the correction of the design variables. More... | |
void | writeCorrection () |
virtual scalar | computeMeritFunction () |
virtual scalar | meritFunctionDirectionalDerivative () |
bool & | initialEtaSet () |
Return whether initial eta was set. More... | |
virtual void | updateOldCorrection (const scalarField &oldCorrection) |
virtual void | write () |
Write useful quantities to files. More... | |
Protected Member Functions | |
void | allocateMatrices () |
Allocate matrices in the first optimisation cycle. More... | |
void | pivotFields (PtrList< scalarField > &list, const scalarField &f) |
void | updateVectors () |
Update y and s vectors. More... | |
void | update () |
Update design variables. More... | |
void | steepestDescentUpdate () |
Update based on steepest descent. More... | |
void | LBFGSUpdate () |
Update based on LBFGS. More... | |
void | readFromDict () |
Read old info from dict. More... | |
Protected Member Functions inherited from updateMethod | |
const scalarField | leftMult (const scalarField &, const SquareMatrix< scalar > &) |
const scalarField | rightMult (const SquareMatrix< scalar > &, const scalarField &) |
SquareMatrix< scalar > | outerProd (const scalarField &, const scalarField &) |
SquareMatrix< scalar > | inv (SquareMatrix< scalar > A) |
scalar | globalSum (const scalarField &field) |
Compute either global or local sum, based on globalSum flag. More... | |
scalar | globalSum (tmp< scalarField > &tfield) |
Compute either global or local sum, based on globalSum flag. More... | |
dictionary | coeffsDict () |
Return optional dictionary with parameters specific to each method. More... | |
Protected Attributes | |
scalar | etaHessian_ |
Step for the Newton method. More... | |
label | nSteepestDescent_ |
Number of first steepest descent steps. More... | |
labelList | activeDesignVars_ |
Map to active design variables. More... | |
label | nPrevSteps_ |
Number of old corrections and grad differences kept. More... | |
PtrList< scalarField > | y_ |
The previous differences of derivatives. Holds nPrevSteps_ fields. More... | |
PtrList< scalarField > | s_ |
The previous correction. Holds nPrevSteps_ fields. More... | |
scalarField | derivativesOld_ |
The previous derivatives. More... | |
scalarField | correctionOld_ |
The previous correction. More... | |
label | counter_ |
Optimisation cycle counter. More... | |
Protected Attributes inherited from updateMethod | |
const fvMesh & | mesh_ |
const dictionary | dict_ |
IOdictionary | optMethodIODict_ |
Used to output values useful for continuation runs. More... | |
scalarField | objectiveDerivatives_ |
Derivatives of the objective functions. More... | |
PtrList< scalarField > | constraintDerivatives_ |
Derivatives of the constraints. More... | |
scalar | objectiveValue_ |
Objective value. More... | |
scalarField | cValues_ |
Constraint values. More... | |
scalarField | correction_ |
Design variables correction. More... | |
scalarField | cumulativeCorrection_ |
scalar | eta_ |
Step multiplying the correction. More... | |
bool | initialEtaSet_ |
Is initially set? More... | |
word | correctionFolder_ |
Folder storing the corrections to file. More... | |
bool | globalSum_ |
Whether to use gSum or sum in the inner products. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from updateMethod | |
static autoPtr< updateMethod > | New (const fvMesh &mesh, const dictionary &dict) |
Return a reference to the selected turbulence model. More... | |
The quasi-Newton Limited-memory BFGS formula. Keeps nPrevSteps_ of the y and s vectors and approximates the inverse areas through them. Values of 3 < nPrevSteps_ < 20 are suggested.
LBFGS | ( | const fvMesh & | mesh, |
const dictionary & | dict | ||
) |
Construct from components.
Definition at line 194 of file LBFGS.C.
References LBFGS::activeDesignVars_, updateMethod::coeffsDict(), Foam::endl(), Foam::Info, LBFGS::readFromDict(), and readIfPresent().
|
virtualdefault |
Destructor.
|
protected |
Allocate matrices in the first optimisation cycle.
Definition at line 49 of file LBFGS.C.
References LBFGS::activeDesignVars_, UList< T >::empty(), Foam::identity(), LBFGS::nPrevSteps_, updateMethod::objectiveDerivatives_, LBFGS::s_, UList< T >::size(), LBFGS::y_, and Foam::Zero.
|
protected |
Move pointers in PtrList to the left and replace last element with given field
Definition at line 67 of file LBFGS.C.
References f(), and UPtrList< T >::reorder().
|
protected |
Update y and s vectors.
Definition at line 90 of file LBFGS.C.
References DebugInfo, Foam::endl(), and Foam::nl.
|
protected |
Update based on steepest descent.
Definition at line 109 of file LBFGS.C.
References Foam::endl(), and Foam::Info.
|
protected |
Update based on LBFGS.
Definition at line 116 of file LBFGS.C.
References b, forAll, gamma, Foam::min(), and Foam::Zero.
|
protected |
Read old info from dict.
Definition at line 171 of file LBFGS.C.
References Foam::identity(), and Foam::Zero.
Referenced by LBFGS::LBFGS().
TypeName | ( | "LBFGS" | ) |
Runtime type information.
|
virtual |
Compute design variables correction.
Implements updateMethod.
Definition at line 239 of file LBFGS.C.
References update().
|
virtual |
Update old correction. Useful for quasi-Newton methods coupled with line search
Reimplemented from updateMethod.
Definition at line 255 of file LBFGS.C.
References updateMethod::updateOldCorrection().
|
virtual |
Write old info to dict.
Reimplemented from updateMethod.
Definition at line 262 of file LBFGS.C.
References updateMethod::write().
|
protected |
|
protected |
Map to active design variables.
Definition at line 81 of file LBFGS.H.
Referenced by LBFGS::allocateMatrices(), and LBFGS::LBFGS().
|
protected |
Number of old corrections and grad differences kept.
Definition at line 84 of file LBFGS.H.
Referenced by LBFGS::allocateMatrices().
|
protected |
The previous differences of derivatives. Holds nPrevSteps_ fields.
Definition at line 87 of file LBFGS.H.
Referenced by LBFGS::allocateMatrices().
|
protected |
The previous correction. Holds nPrevSteps_ fields.
Definition at line 90 of file LBFGS.H.
Referenced by LBFGS::allocateMatrices().
|
protected |
|
protected |