Loading...
Searching...
No Matches
lineSearch Class Referenceabstract

Abstract base class for line search methods. More...

#include <lineSearch.H>

Inheritance diagram for lineSearch:
Collaboration diagram for lineSearch:

Public Member Functions

 TypeName ("lineSearch")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, lineSearch, dictionary,(const dictionary &dict, const Time &time, updateMethod &UpdateMethod),(dict, time, UpdateMethod))
 lineSearch (const dictionary &dict, const Time &time, updateMethod &UpdateMethod)
 Construct from components.
virtual ~lineSearch ()=default
 Destructor.
virtual void setDeriv (const scalar deriv)
 Set directional derivative.
virtual void setNewDeriv (const scalar deriv)
 Set new directional derivative.
void setDirection (const scalarField &direction)
 Set direction.
void setNewMeritValue (const scalar value)
 Set new objective value.
void setOldMeritValue (const scalar value)
 Set old objective value.
virtual void reset ()
 Reset step to initial value.
label innerIter () const
 Get inner line search iteration.
label maxIters () const
 Get max number of iterations.
scalar step () const
 Get current step.
virtual bool converged ()=0
 Return the correction of the design variables.
virtual void updateStep ()=0
 Update the line search step based on the specific line search strategy, e.g. bisection, quadratic fit, etc.
virtual void updateStep (const scalar newStep)
 Update the step using the supplied value.
virtual void updateCorrection (scalarField &correction)
 Update the correction.
virtual bool loop ()
 Return true if lineSearch should continue and if so increment inner.
virtual bool computeGradient () const
 Does line search need to update the gradient?
virtual void postUpdate ()
 Execute steps at the end of the line search iterations.
virtual lineSearch & operator++ ()
 Increment iteration number and store merit value corresponding to the previous optimisation cycle.
virtual lineSearch & operator++ (int)
 Postfix increment. Necessary for compilation.

Static Public Member Functions

static autoPtr< lineSearch > New (const dictionary &dict, const Time &time, updateMethod &UpdateMethod)
 Return a reference to the selected turbulence model.

Protected Member Functions

const dictionarycoeffsDict ()
 Optional coeffs dict.

Protected Attributes

const dictionary dict_
 Subdict within updateMethod.
IOdictionary lineSearchDict_
 IOdictionary under time/uniform for continuation.
scalar directionalDeriv_
 Directional derivative of the merit function.
scalarField direction_
 Update direction.
scalar oldMeritValue_
 Old merit value from this opt cycle.
scalar newMeritValue_
 New merit value from this opt cycle.
scalar prevMeritDeriv_
 Merit directional deriv from the previous opt cycle.
scalar initialStep_
 Correction multiplier at the first step of line search.
scalar minStep_
 Minimum allowed correction multiplier.
scalar step_
 Correction multiplier.
label iter_
 Optimisation cycle.
label innerIter_
 Inner line search iteration.
label maxIters_
 Maximum line search iterations.
bool extrapolateInitialStep_
 Whether to extrapolate the correction multiplier for this optimisation cycle based on the previous ones.
autoPtr< stepUpdatestepUpdate_
 Mechanism to update method if line search conditions are not set.
updateMethodupdateMethod_
 Reference to the update method related to the line search.

Detailed Description

Abstract base class for line search methods.

Source files

Definition at line 53 of file lineSearch.H.

Constructor & Destructor Documentation

◆ lineSearch()

lineSearch ( const dictionary & dict,
const Time & time,
updateMethod & UpdateMethod )

Construct from components.

Definition at line 45 of file lineSearch.C.

References dict, dict_, direction_, directionalDeriv_, extrapolateInitialStep_, initialStep_, innerIter_, iter_, lineSearchDict_, maxIters_, minStep_, New(), newMeritValue_, oldMeritValue_, prevMeritDeriv_, step_, stepUpdate_, timeName, updateMethod_, and Foam::Zero.

Here is the call graph for this function:

◆ ~lineSearch()

virtual ~lineSearch ( )
virtualdefault

Destructor.

Member Function Documentation

◆ coeffsDict()

const Foam::dictionary & coeffsDict ( )
protected

Optional coeffs dict.

Definition at line 37 of file lineSearch.C.

References dict_, and Foam::type().

Referenced by ArmijoConditions::ArmijoConditions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeName()

TypeName ( "lineSearch" )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr ,
lineSearch ,
dictionary ,
(const dictionary &dict, const Time &time, updateMethod &UpdateMethod) ,
(dict, time, UpdateMethod)  )

References dict.

◆ New()

Foam::autoPtr< Foam::lineSearch > New ( const dictionary & dict,
const Time & time,
updateMethod & UpdateMethod )
static

Return a reference to the selected turbulence model.

Definition at line 95 of file lineSearch.C.

References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, Foam::Info, and autoPtr< T >::reset().

Referenced by lineSearch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDeriv()

void setDeriv ( const scalar deriv)
virtual

Set directional derivative.

Definition at line 137 of file lineSearch.C.

References directionalDeriv_, and stepUpdate_.

◆ setNewDeriv()

void setNewDeriv ( const scalar deriv)
virtual

Set new directional derivative.

Does nothing in base. Only used by methods that require the gradient information to be computed at the new point

Definition at line 144 of file lineSearch.C.

◆ setDirection()

void setDirection ( const scalarField & direction)
inline

Set direction.

Definition at line 239 of file lineSearch.H.

References direction_.

◆ setNewMeritValue()

void setNewMeritValue ( const scalar value)

Set new objective value.

Definition at line 150 of file lineSearch.C.

References newMeritValue_, and stepUpdate_.

◆ setOldMeritValue()

void setOldMeritValue ( const scalar value)

Set old objective value.

Definition at line 157 of file lineSearch.C.

References oldMeritValue_, and stepUpdate_.

◆ reset()

void reset ( )
virtual

Reset step to initial value.

Definition at line 164 of file lineSearch.C.

References Foam::clamp(), directionalDeriv_, Foam::endl(), extrapolateInitialStep_, Foam::Info, initialStep_, innerIter_, iter_, minStep_, prevMeritDeriv_, and step_.

Here is the call graph for this function:

◆ innerIter()

label innerIter ( ) const
inline

Get inner line search iteration.

Definition at line 262 of file lineSearch.H.

References innerIter_.

◆ maxIters()

label maxIters ( ) const
inline

Get max number of iterations.

Definition at line 270 of file lineSearch.H.

References maxIters_.

◆ step()

scalar step ( ) const
inline

Get current step.

Definition at line 278 of file lineSearch.H.

References step_.

◆ converged()

virtual bool converged ( )
pure virtual

Return the correction of the design variables.

Implemented in ArmijoConditions, and GCMMA.

◆ updateStep() [1/2]

virtual void updateStep ( )
pure virtual

Update the line search step based on the specific line search strategy, e.g. bisection, quadratic fit, etc.

Implemented in ArmijoConditions, and GCMMA.

References Foam::correction().

Here is the call graph for this function:

◆ updateStep() [2/2]

void updateStep ( const scalar newStep)
virtual

Update the step using the supplied value.

Definition at line 186 of file lineSearch.C.

References step_.

◆ updateCorrection()

void updateCorrection ( scalarField & correction)
virtual

Update the correction.

Multiplies with step in base

Reimplemented in GCMMA.

Definition at line 192 of file lineSearch.C.

References Foam::correction(), and step_.

Here is the call graph for this function:

◆ loop()

bool loop ( )
virtual

Return true if lineSearch should continue and if so increment inner.

iteration

Definition at line 198 of file lineSearch.C.

References innerIter_, and maxIters_.

◆ computeGradient()

bool computeGradient ( ) const
virtual

Does line search need to update the gradient?

Definition at line 211 of file lineSearch.C.

◆ postUpdate()

void postUpdate ( )
virtual

Execute steps at the end of the line search iterations.

Definition at line 217 of file lineSearch.C.

References operator++().

Here is the call graph for this function:

◆ operator++() [1/2]

Foam::lineSearch & operator++ ( )
virtual

Increment iteration number and store merit value corresponding to the previous optimisation cycle.

Definition at line 223 of file lineSearch.C.

References IOstreamOption::ASCII, directionalDeriv_, iter_, lineSearchDict_, and prevMeritDeriv_.

Referenced by operator++(), and postUpdate().

Here is the caller graph for this function:

◆ operator++() [2/2]

Foam::lineSearch & operator++ ( int )
virtual

Postfix increment. Necessary for compilation.

Definition at line 242 of file lineSearch.C.

References operator++().

Here is the call graph for this function:

Member Data Documentation

◆ dict_

const dictionary dict_
protected

Subdict within updateMethod.

Definition at line 62 of file lineSearch.H.

Referenced by coeffsDict(), and lineSearch().

◆ lineSearchDict_

IOdictionary lineSearchDict_
protected

IOdictionary under time/uniform for continuation.

Definition at line 67 of file lineSearch.H.

Referenced by lineSearch(), and operator++().

◆ directionalDeriv_

scalar directionalDeriv_
protected

Directional derivative of the merit function.

Definition at line 72 of file lineSearch.H.

Referenced by ArmijoConditions::converged(), lineSearch(), operator++(), reset(), and setDeriv().

◆ direction_

scalarField direction_
protected

Update direction.

Definition at line 77 of file lineSearch.H.

Referenced by lineSearch(), and setDirection().

◆ oldMeritValue_

scalar oldMeritValue_
protected

Old merit value from this opt cycle.

Definition at line 82 of file lineSearch.H.

Referenced by ArmijoConditions::converged(), lineSearch(), and setOldMeritValue().

◆ newMeritValue_

scalar newMeritValue_
protected

New merit value from this opt cycle.

Definition at line 87 of file lineSearch.H.

Referenced by ArmijoConditions::converged(), lineSearch(), and setNewMeritValue().

◆ prevMeritDeriv_

scalar prevMeritDeriv_
protected

Merit directional deriv from the previous opt cycle.

Definition at line 92 of file lineSearch.H.

Referenced by lineSearch(), operator++(), and reset().

◆ initialStep_

scalar initialStep_
protected

Correction multiplier at the first step of line search.

Definition at line 97 of file lineSearch.H.

Referenced by lineSearch(), and reset().

◆ minStep_

scalar minStep_
protected

Minimum allowed correction multiplier.

Definition at line 102 of file lineSearch.H.

Referenced by lineSearch(), and reset().

◆ step_

scalar step_
protected

Correction multiplier.

Definition at line 107 of file lineSearch.H.

Referenced by ArmijoConditions::converged(), lineSearch(), reset(), step(), updateCorrection(), ArmijoConditions::updateStep(), and updateStep().

◆ iter_

label iter_
protected

Optimisation cycle.

Definition at line 112 of file lineSearch.H.

Referenced by lineSearch(), operator++(), reset(), and GCMMA::writeToFiles().

◆ innerIter_

label innerIter_
protected

Inner line search iteration.

Definition at line 117 of file lineSearch.H.

Referenced by innerIter(), lineSearch(), loop(), reset(), and GCMMA::writeToFiles().

◆ maxIters_

label maxIters_
protected

Maximum line search iterations.

Definition at line 122 of file lineSearch.H.

Referenced by lineSearch(), loop(), and maxIters().

◆ extrapolateInitialStep_

bool extrapolateInitialStep_
protected

Whether to extrapolate the correction multiplier for this optimisation cycle based on the previous ones.

Useful for non-quasi Newton methods

Definition at line 130 of file lineSearch.H.

Referenced by lineSearch(), and reset().

◆ stepUpdate_

autoPtr<stepUpdate> stepUpdate_
protected

Mechanism to update method if line search conditions are not set.

Definition at line 135 of file lineSearch.H.

Referenced by lineSearch(), setDeriv(), setNewMeritValue(), setOldMeritValue(), and ArmijoConditions::updateStep().

◆ updateMethod_

updateMethod& updateMethod_
protected

Reference to the update method related to the line search.

Definition at line 140 of file lineSearch.H.

Referenced by lineSearch().


The documentation for this class was generated from the following files:
  • src/optimisation/adjointOptimisation/adjoint/optimisation/lineSearch/lineSearch/lineSearch.H
  • src/optimisation/adjointOptimisation/adjoint/optimisation/lineSearch/lineSearch/lineSearch.C