Loading...
Searching...
No Matches
SQP.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2007-2021 PCOpt/NTUA
9 Copyright (C) 2013-2021 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
13 This file is part of OpenFOAM.
14
15 OpenFOAM is free software: you can redistribute it and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27
28
29Class
30 Foam::SQP
31
32Description
33 The quasi-Newton SQP formula for constrained optimisation
34
35SourceFiles
36 SQP.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef SQP_H
41#define SQP_H
42
43#include "quasiNewton.H"
44#include "SQPBase.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
51/*---------------------------------------------------------------------------*\
52 Class SQP Declaration
53\*---------------------------------------------------------------------------*/
54
55class SQP
56:
57 public quasiNewton,
58 public SQPBase
59{
60protected:
61
62 // Protected data
63
64 //- Curvature threshold
65 scalar dumpingThreshold_;
66
67
68private:
69
70 // Private Member Functions
71
72 //- No copy construct
73 SQP(const SQP&) = delete;
74
75 //- No copy assignment
76 void operator=(const SQP&) = delete;
77
78 //- Update the Hessian matrix
79 virtual void updateHessian();
80
81 //- Compute new lamdas and update correction
82 virtual void update();
83
84 //- Store old fields needed for the next iter
85 void storeOldFields();
86
87 //- Get the part the merit function that depends on the constraints
88 virtual scalar meritFunctionConstraintPart() const;
89
90
91public:
92
93 //- Runtime type information
94 TypeName("SQP");
95
96
97 // Constructors
98
99 //- Construct from components
100 SQP
101 (
102 const fvMesh& mesh,
103 const dictionary& dict,
104 autoPtr<designVariables>& designVars,
105 const label nConstraints,
106 const word& type
107 );
108
109
110 //- Destructor
111 virtual ~SQP() = default;
112
113
114 // Member Functions
115
116 //- Compute design variables correction
117 void computeCorrection();
118
119 //- Compute merit function. Could be different than the objective
120 //- in the presence of constraints
121 virtual scalar computeMeritFunction();
122
123 //- Derivative of the merit function. Could be different than the
124 //- objective derivative in the presence of constraints
125 virtual scalar meritFunctionDirectionalDerivative();
127 //- Write useful quantities to files
128 virtual bool writeData(Ostream& os) const;
129
130 //- Write merit function information
131 virtual bool writeAuxiliaryData();
132};
133
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace Foam
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140
141#endif
142
143// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
virtual scalar meritFunctionConstraintPart() const =0
Get the part the merit function that depends on the constraints.
void computeCorrection()
Compute design variables correction.
Definition SQP.C:246
virtual scalar meritFunctionDirectionalDerivative()
Derivative of the merit function. Could be different than the objective derivative in the presence of...
Definition SQP.C:273
virtual ~SQP()=default
Destructor.
virtual bool writeAuxiliaryData()
Write merit function information.
Definition SQP.C:289
virtual bool writeData(Ostream &os) const
Write useful quantities to files.
Definition SQP.C:283
virtual scalar computeMeritFunction()
Compute merit function. Could be different than the objective in the presence of constraints.
Definition SQP.C:256
scalar dumpingThreshold_
Curvature threshold.
Definition SQP.H:62
TypeName("SQP")
Runtime type information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
virtual void updateHessian()=0
Update approximation of the inverse Hessian.
virtual void update()=0
Update design variables.
label nConstraints() const
Get the number of constraints.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68