53 const label m(rhoValues.
size() - 1);
60 <<
setw(width) <<
"#OuterIter" <<
" " 61 <<
setw(width) <<
"InnerIter" <<
" " 62 <<
setw(width) <<
"rhoObj" <<
" ";
65 <<
setw(width) <<
"#nCycle" <<
" " 66 <<
setw(width) <<
"cumulativeCost" <<
" " 67 <<
setw(width) <<
"Objective" <<
" ";
68 for (label i = 0; i < m; ++i)
71 <<
setw(width) <<
"rhoConst" <<
" ";
73 <<
setw(width) <<
"Constraint" <<
" ";
76 <<
setw(width) <<
"J" <<
" " 77 <<
setw(width) <<
"JTilda" <<
" ";
78 for (label i = 0; i < m; ++i)
81 <<
setw(width) <<
"C" <<
" " 82 <<
setw(width) <<
"CTilda" <<
" ";
96 <<
setw(width) << rhoValues[i] <<
" ";
101 <<
setw(width) << objValues[0][i] <<
" " 102 <<
setw(width) << objValues[1][i] <<
" ";
117 <<
setw(width) << objValues[0][i] <<
" ";
129 const dictionary&
dict,
131 updateMethod& UpdateMethod
134 lineSearch(
dict, time, UpdateMethod),
135 mma_(
refCast<MMA>(UpdateMethod)),
137 (time.globalPath()/
"optimisation"/
"objective"/time.
timeName()/
"GCMMA"),
140 time.globalPath()/
"optimisation"/
"objective"/time.
timeName()
157 bool isConverged = mma_.converged();
158 writeToFiles(isConverged);
161 <<
"GCMMA converged ... " <<
Switch(isConverged) <<
endl;
169 <<
"GCMMA:: recomputing direction "<<
endl;
175 mma_.solveSubproblem();
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
MMA & mma_
Cast of the update method to MMA.
void size(const label n)
Older name for setAddressableSize.
void setVariableRho(bool varRho=true)
Set variable rho.
OFstream GCMMAFile_
File with rho values in each inner loop.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
void writeToFiles(bool isConverged)
Write rho and objective/constraint values & approx to files.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
virtual void updateStep()
Actually computes a new direction entirely, targeting the satisfaction of the GCMMA condition...
virtual void updateCorrection(scalarField &correction)
Replace the correction with the one computed in updateStep.
const scalarField & getRho() const
Get rho value if needed.
label iter_
Optimisation cycle.
#define DebugInfo
Report an information message using Foam::Info.
Istream and Ostream manipulators taking arguments.
defineTypeNameAndDebug(combustionModel, 0)
label innerIter_
Inner line search iteration.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const PtrList< scalarField > & getValuesAndApproximations() const
Get objective/constraint values and their approximations.
Omanip< int > setw(const int i)
virtual bool converged()
Check whether linear search has converged.
OFstream costFile_
File with CPU cost in each inner loop.
label cost_
Total cost, measured in Equivalent Flow Solutions, up to this cycle.
bool writeHeader_
Write the header of the output files.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)