44 #ifndef ROL_TYPEU_ALGORITHM_DEF_H
45 #define ROL_TYPEU_ALGORITHM_DEF_H
54 template<
typename Real>
62 template<
typename Real>
64 if (state_->iterateVec == nullPtr) {
65 state_->iterateVec = x.
clone();
67 state_->iterateVec->set(x);
68 if (state_->stepVec == nullPtr) {
69 state_->stepVec = x.
clone();
71 state_->stepVec->zero();
72 if (state_->gradientVec == nullPtr) {
73 state_->gradientVec = g.
clone();
75 state_->gradientVec->set(g);
76 if (state_->minIterVec == nullPtr) {
77 state_->minIterVec = x.
clone();
79 state_->minIterVec->set(x);
80 state_->minIter = state_->iter;
81 state_->minValue = state_->value;
84 template<
typename Real>
93 template<
typename Real>
95 std::ostream &outStream ) {
108 template<
typename Real>
111 std::ostream &outStream ) {
112 run(x,x.
dual(),obj,outStream);
115 template<
typename Real>
120 std::ostream &outStream ) {
121 run(x,x.
dual(),obj,linear_con,linear_mul,linear_mul.
dual(),outStream);
124 template<
typename Real>
131 std::ostream &outStream ) {
132 Ptr<Vector<Real>> xfeas = x.
clone(); xfeas->set(x);
134 Ptr<Vector<Real>> s = x.
clone(); s->zero();
136 run(*s,g,*rlc.
transform(makePtrFromRef(obj)),outStream);
141 template<
typename Real>
143 std::stringstream hist;
145 hist << std::setw(6) << std::left <<
"iter";
146 hist << std::setw(15) << std::left <<
"value";
147 hist << std::setw(15) << std::left <<
"gnorm";
148 hist << std::setw(15) << std::left <<
"snorm";
149 hist << std::setw(10) << std::left <<
"#fval";
150 hist << std::setw(10) << std::left <<
"#grad";
155 template<
typename Real>
160 template<
typename Real>
162 std::stringstream hist;
163 hist << std::scientific << std::setprecision(6);
164 if ( write_header ) writeHeader(os);
165 if ( state_->iter == 0 ) {
167 hist << std::setw(6) << std::left << state_->iter;
168 hist << std::setw(15) << std::left << state_->value;
169 hist << std::setw(15) << std::left << state_->gnorm;
174 hist << std::setw(6) << std::left << state_->iter;
175 hist << std::setw(15) << std::left << state_->value;
176 hist << std::setw(15) << std::left << state_->gnorm;
177 hist << std::setw(15) << std::left << state_->snorm;
178 hist << std::setw(10) << std::left << state_->nfval;
179 hist << std::setw(10) << std::left << state_->ngrad;
185 template<
typename Real>
187 std::stringstream hist;
188 hist <<
"Optimization Terminated with Status: ";
194 template<
typename Real>
200 template<
typename Real>
Contains definitions of custom data types in ROL.
Provides an interface to check two status tests of optimization algorithms.
Defines the general constraint operator interface.
Provides the interface to evaluate objective functions.
const Ptr< Vector< Real > > & getPrimalOptimizationVector()
Get the primal optimization space vector.
const Ptr< Vector< Real > > & getDualOptimizationVector()
Get the dual optimization space vector.
EProblem getProblemType()
Get the optimization problem type (U, B, E, or G).
void finalizeIteration()
Transform the optimization variables to the native parameterization after an optimization algorithm h...
const Ptr< Objective< Real > > & getObjective()
Get the objective function.
Performs null-space transformation for reducible linear equality constraints.
Ptr< const Vector< Real > > getFeasibleVector(void) const
void project(Vector< Real > &x, const Vector< Real > &y) const
Ptr< Objective< Real > > transform(const Ptr< Objective< Real >> &obj) const
Provides an interface to check status of optimization algorithms.
Algorithm()
Constructor, given a step and a status test.
const Ptr< CombinedStatusTest< Real > > status_
Ptr< const AlgorithmState< Real > > getState() const
void setStatusTest(const Ptr< StatusTest< Real >> &status, bool combineStatus=false)
void initialize(const Vector< Real > &x, const Vector< Real > &g)
virtual void writeOutput(std::ostream &os, bool write_header=false) const
Print iterate status.
virtual void writeExitStatus(std::ostream &os) const
virtual void writeHeader(std::ostream &os) const
Print iterate header.
virtual void writeName(std::ostream &os) const
Print step name.
virtual void run(Problem< Real > &problem, std::ostream &outStream=std::cout)
Run algorithm on unconstrained problems (Type-U). This is the primary Type-U interface.
Defines the linear algebra or vector space interface.
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis,...
std::string EExitStatusToString(EExitStatus tr)