Loading...
Searching...
No Matches
GCMMA.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) 2020-2023 PCOpt/NTUA
9 Copyright (C) 2020-2023 FOSS GP
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::GCMMA
29
30Description
31 Class implementing a workaround for using the Globally converging wrapper
32 of the MMA update method. Implemented as a lineSearch, even though the
33 search direction changes within each inner iteration of GCMMA, due the
34 existing framework for re-solving the primal equations and checking the
35 convergence of a merit function.
36
37 Reference:
38 \verbatim
39 Svanberg, K. (2002)
40 A class of globally convergent optimization methods based on
41 conservative convex separable approximations.
42 SIAM Journal of Optimization, 12), 555-573.
43 https://doi.org/10.1137/S1052623499362822
44 \endverbatim
45
46SourceFiles
47 GCMMA.C
48
49\*---------------------------------------------------------------------------*/
50
51#ifndef GCMMA_H
52#define GCMMA_H
53
54#include "lineSearch.H"
55#include "MMA.H"
56#include "OFstream.H"
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
63/*---------------------------------------------------------------------------*\
64 Class GCMMA Declaration
65\*---------------------------------------------------------------------------*/
66
67class GCMMA
68:
69 public lineSearch
70{
71protected:
72
73 // Protected data
74
75 //- Cast of the update method to MMA
76 MMA& mma_;
77
78 //- File with rho values in each inner loop
80
81 //- File with CPU cost in each inner loop
84 //- Total cost, measured in Equivalent Flow Solutions, up to this cycle
85 label cost_;
86
87 //- Write the header of the output files
89
90
91 // Protected Member Functions
92
93 //- Write rho and objective/constraint values & approx to files
94 void writeToFiles(bool isConverged);
95
96
97private:
98
99 // Private Member Functions
100
101 //- No copy construct
102 GCMMA(const GCMMA&) = delete;
103
104 //- No copy assignment
105 void operator=(const GCMMA&) = delete;
106
107
108public:
109
110 //- Runtime type information
111 TypeName("GCMMA");
112
113
114 // Constructors
115
116 //- Construct from components
117 GCMMA
118 (
119 const dictionary& dict,
120 const Time& time,
121 updateMethod& UpdatheMethod
122 );
123
125 // Destructor
126 virtual ~GCMMA() = default;
127
128
129 // Member Functions
130
131 //- Check whether linear search has converged
132 virtual bool converged();
133
134 //- Actually computes a new direction entirely,
135 //- targeting the satisfaction of the GCMMA condition
136 virtual void updateStep();
137
138 //- Replace the correction with the one computed in updateStep
140
141 // Member operators
142
143 //- Increment iteration number and store merit value corresponding to
144 //- the previous optimisation cycle
145 //virtual GCMMA& operator++();
146};
147
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151} // End namespace Foam
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155#endif
156
157// ************************************************************************* //
virtual bool converged()
Check whether linear search has converged.
Definition GCMMA.C:146
virtual void updateStep()
Actually computes a new direction entirely, targeting the satisfaction of the GCMMA condition.
Definition GCMMA.C:159
OFstream GCMMAFile_
File with rho values in each inner loop.
Definition GCMMA.H:78
void writeToFiles(bool isConverged)
Write rho and objective/constraint values & approx to files.
Definition GCMMA.C:42
virtual void updateCorrection(scalarField &correction)
Replace the correction with the one computed in updateStep.
Definition GCMMA.C:172
virtual ~GCMMA()=default
TypeName("GCMMA")
Runtime type information.
MMA & mma_
Cast of the update method to MMA.
Definition GCMMA.H:73
OFstream costFile_
File with CPU cost in each inner loop.
Definition GCMMA.H:83
label cost_
Total cost, measured in Equivalent Flow Solutions, up to this cycle.
Definition GCMMA.H:88
bool writeHeader_
Write the header of the output files.
Definition GCMMA.H:93
Update design variables using the Method of Moving Assymptotes. Can handle inequality constraints.
Definition MMA.H:65
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Definition OFstream.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Abstract base class for optimisation methods.
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68