10#ifndef ROL_TYPEP_IPIANOALGORITHM_DEF_HPP
11#define ROL_TYPEP_IPIANOALGORITHM_DEF_HPP
16template<
typename Real>
23 ParameterList &lslist = list.sublist(
"Step").sublist(
"iPiano");
24 t0_ = list.sublist(
"Status Test").get(
"Gradient Scale", 1.0);
25 maxit_ = lslist.get(
"Reduction Iteration Limit", 20);
27 beta_ = lslist.get(
"Momentum Parameter", 0.25);
28 rhodec_ = lslist.get(
"Backtracking Rate", 0.5);
29 rhoinc_ = lslist.get(
"Increase Rate", 2.0);
30 c1_ = lslist.get(
"Upper Interpolation Factor", 1e-5);
31 c2_ = lslist.get(
"Lower Interpolation Factor", 1e-6);
32 L_ = lslist.get(
"Initial Lipschitz Constant Estimate", 0.5/
t0_);
33 initProx_ = lslist.get(
"Apply Prox to Initial Guess",
false);
34 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
38template<
typename Real>
45 std::ostream &outStream) {
66template<
typename Real>
71 std::ostream &outStream ) {
72 const Real half(0.5), one(1), two(2);
76 Real strial(0), strialP(0), snormP(0), LP(0), alphaP(0), betaP(0), gs(0), b(0);
90 beta_ = (b - one) / (b - half);
100 state_->stepVec->axpy(-one,x);
108 if (strial <= state_->svalue + gs + half *
L_ *
state_->snorm *
state_->snorm) {
110 for (
int i = 0; i <
maxit_; ++i) {
119 xP->set(*
state_->iterateVec);
120 sP->set(*
state_->stepVec);
125 beta_ = (b - one) / (b - half);
135 state_->stepVec->axpy(-one,x);
148 state_->iterateVec->set(*xP);
149 state_->stepVec->set(*sP);
168 beta_ = (b - one) / (b - half);
178 state_->stepVec->axpy(-one,x);
196 dg->set(
state_->gradientVec->dual());
207template<
typename Real>
209 std::ios_base::fmtflags osFlags(os.flags());
211 os << std::string(109,
'-') << std::endl;
212 os <<
"iPiano: Inertial proximal algorithm for nonconvex optimization";
213 os <<
" status output definitions" << std::endl << std::endl;
214 os <<
" iter - Number of iterates (steps taken)" << std::endl;
215 os <<
" value - Objective function value" << std::endl;
216 os <<
" gnorm - Norm of the proximal gradient with parameter lambda" << std::endl;
217 os <<
" snorm - Norm of the step (update to optimization vector)" << std::endl;
218 os <<
" alpha - Inertial gradient parameter" << std::endl;
219 os <<
" beta - Inertial step parameter" << std::endl;
220 os <<
" L - Lipschitz constant estimate" << std::endl;
221 os <<
" #sval - Cumulative number of times the smooth objective function was evaluated" << std::endl;
222 os <<
" #nval - Cumulative number of times the nonsmooth objective function was evaluated" << std::endl;
223 os <<
" #grad - Cumulative number of times the gradient was computed" << std::endl;
224 os <<
" #prox - Cumulative number of times the proximal operator was computed" << std::endl;
225 os << std::string(109,
'-') << std::endl;
229 os << std::setw(6) << std::left <<
"iter";
230 os << std::setw(15) << std::left <<
"value";
231 os << std::setw(15) << std::left <<
"gnorm";
232 os << std::setw(15) << std::left <<
"snorm";
233 os << std::setw(15) << std::left <<
"alpha";
234 os << std::setw(15) << std::left <<
"beta";
235 os << std::setw(15) << std::left <<
"L";
236 os << std::setw(10) << std::left <<
"#sval";
237 os << std::setw(10) << std::left <<
"#nval";
238 os << std::setw(10) << std::left <<
"#grad";
239 os << std::setw(10) << std::left <<
"#nprox";
244template<
typename Real>
246 std::ios_base::fmtflags osFlags(os.flags());
247 os << std::endl <<
"iPiano: Inertial Proximal Algorithm for Nonconvex Optimization (Type P)" << std::endl;
251template<
typename Real>
253 std::ios_base::fmtflags osFlags(os.flags());
254 os << std::scientific << std::setprecision(6);
257 if (
state_->iter == 0 ) {
259 os << std::setw(6) << std::left <<
state_->iter;
260 os << std::setw(15) << std::left <<
state_->value;
261 os << std::setw(15) << std::left <<
state_->gnorm;
262 os << std::setw(15) << std::left <<
"---";
263 os << std::setw(15) << std::left <<
"---";
264 os << std::setw(15) << std::left <<
"---";
265 os << std::setw(15) << std::left <<
L_;
266 os << std::setw(10) << std::left <<
state_->nsval;
267 os << std::setw(10) << std::left <<
state_->nnval;
268 os << std::setw(10) << std::left <<
state_->ngrad;
269 os << std::setw(10) << std::left <<
state_->nprox;
274 os << std::setw(6) << std::left <<
state_->iter;
275 os << std::setw(15) << std::left <<
state_->value;
276 os << std::setw(15) << std::left <<
state_->gnorm;
277 os << std::setw(15) << std::left <<
state_->snorm;
278 os << std::setw(15) << std::left <<
alpha_;
279 os << std::setw(15) << std::left <<
beta_;
280 os << std::setw(15) << std::left <<
L_;
281 os << std::setw(10) << std::left <<
state_->nsval;
282 os << std::setw(10) << std::left <<
state_->nnval;
283 os << std::setw(10) << std::left <<
state_->ngrad;
284 os << std::setw(10) << std::left <<
state_->nprox;
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
Provides the interface to evaluate objective functions.
virtual void prox(Vector< Real > &Pv, const Vector< Real > &v, Real t, Real &tol)
Compute the proximity operator.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Provides an interface to check status of optimization algorithms.
void pgstep(Vector< Real > &pgiter, Vector< Real > &pgstep, Objective< Real > &nobj, const Vector< Real > &x, const Vector< Real > &dg, Real t, Real &tol) const
const Ptr< AlgorithmState< Real > > state_
virtual void writeExitStatus(std::ostream &os) const
const Ptr< CombinedStatusTest< Real > > status_
void initialize(const Vector< Real > &x, const Vector< Real > &g)
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &sobj, Objective< Real > &nobj, std::ostream &outStream=std::cout) override
Run algorithm on unconstrained problems (Type-U). This general interface supports the use of dual opt...
void writeName(std::ostream &os) const override
Print step name.
void writeHeader(std::ostream &os) const override
Print iterate header.
void writeOutput(std::ostream &os, bool write_header=false) const override
Print iterate status.
iPianoAlgorithm(ParameterList &list)
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &sobj, Objective< Real > &nobj, Vector< Real > &px, Vector< Real > &dg, std::ostream &outStream=std::cout)
Defines the linear algebra or vector space interface.
virtual void set(const Vector &x)
Set where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.