SQPBase.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 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 
28 Class
29  Foam::SQPBase
30 
31 Description
32  Base class for Sequantial Quadratic Programming (SQP) methods
33 
34 SourceFiles
35  SQPBase.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef SQPBase_H
40 #define SQPBase_H
41 
43 #include "quasiNewton.H"
44 #include "OFstream.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class SQPBase Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class SQPBase
56 :
58 {
59 protected:
60 
61  // Protected data
62 
63  //- Derivatives of the Lagrangian function
65 
66  //- The previous constraint derivatives
68 
69  //- Lagrange multipliers
71 
72  //- Name of the objective folder
74 
75  //- File including the l1 merit function
77 
78  //- Penalty value for the merit function
79  scalar mu_;
80 
81  //- Safety factor
82  scalar delta_;
83 
84 
85  // Protected Member Functions
86 
87  //- Get the part the merit function that depends on the constraints
88  virtual scalar meritFunctionConstraintPart() const = 0;
89 
90 
91 private:
92 
93  // Private Member Functions
94 
95  //- No copy construct
96  SQPBase(const SQPBase&) = delete;
97 
98  //- No copy assignment
99  void operator=(const SQPBase&) = delete;
100 
101  //- Make folder holding the Lagrangian file
102  void makeFolder();
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("SQPBase");
109 
110 
111  // Constructors
112 
113  //- Construct from components
114  SQPBase
115  (
116  const fvMesh& mesh,
117  const dictionary& dict,
118  autoPtr<designVariables>& designVars,
119  const updateMethod& UpdateMethod,
120  const word& type
121  );
122 
123 
124  //- Destructor
125  virtual ~SQPBase() = default;
126 
127 
128  // Member Functions
129 
130  //- Write continuation info
131  virtual bool addToFile(Ostream& os) const;
132 
133  //- Write info about the merit function
134  virtual bool writeMeritFunction(const updateMethod& UpdateMethod);
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
dictionary dict
autoPtr< OFstream > meritFunctionFile_
File including the l1 merit function.
Definition: SQPBase.H:81
A class for handling file names.
Definition: fileName.H:72
Abstract base class for optimisation methods supporting constraints. Does not add functionality to up...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Abstract base class for optimisation methods.
Definition: updateMethod.H:50
virtual bool addToFile(Ostream &os) const
Write continuation info.
Definition: SQPBase.C:102
scalarField LagrangianDerivatives_
Derivatives of the Lagrangian function.
Definition: SQPBase.H:61
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
dynamicFvMesh & mesh
scalar delta_
Safety factor.
Definition: SQPBase.H:91
A class for handling words, derived from Foam::string.
Definition: word.H:63
List< scalarField > constraintDerivativesOld_
The previous constraint derivatives.
Definition: SQPBase.H:66
Base class for Sequantial Quadratic Programming (SQP) methods.
Definition: SQPBase.H:50
TypeName("SQPBase")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
scalar mu_
Penalty value for the merit function.
Definition: SQPBase.H:86
virtual scalar meritFunctionConstraintPart() const =0
Get the part the merit function that depends on the constraints.
virtual ~SQPBase()=default
Destructor.
virtual bool writeMeritFunction(const updateMethod &UpdateMethod)
Write info about the merit function.
Definition: SQPBase.C:115
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
scalarField lamdas_
Lagrange multipliers.
Definition: SQPBase.H:71
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
fileName objFunctionFolder_
Name of the objective folder.
Definition: SQPBase.H:76
Namespace for OpenFOAM.