44#ifndef ROL_TYPEP_IPIANOALGORITHM_DEF_HPP
45#define ROL_TYPEP_IPIANOALGORITHM_DEF_HPP
50template<
typename Real>
57 ParameterList &lslist = list.sublist(
"Step").sublist(
"iPiano");
58 t0_ = list.sublist(
"Status Test").get(
"Gradient Scale", 1.0);
59 maxit_ = lslist.get(
"Reduction Iteration Limit", 20);
61 beta_ = lslist.get(
"Momentum Parameter", 0.25);
62 rhodec_ = lslist.get(
"Backtracking Rate", 0.5);
63 rhoinc_ = lslist.get(
"Increase Rate", 2.0);
64 c1_ = lslist.get(
"Upper Interpolation Factor", 1e-5);
65 c2_ = lslist.get(
"Lower Interpolation Factor", 1e-6);
66 L_ = lslist.get(
"Initial Lipschitz Constant Estimate", 0.5/
t0_);
67 initProx_ = lslist.get(
"Apply Prox to Initial Guess",
false);
68 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
72template<
typename Real>
79 std::ostream &outStream) {
100template<
typename Real>
105 std::ostream &outStream ) {
106 const Real half(0.5), one(1), two(2);
110 Real strial(0), strialP(0), snormP(0), LP(0), alphaP(0), betaP(0), gs(0), b(0);
124 beta_ = (b - one) / (b - half);
134 state_->stepVec->axpy(-one,x);
142 if (strial <= state_->svalue + gs + half *
L_ *
state_->snorm *
state_->snorm) {
144 for (
int i = 0; i <
maxit_; ++i) {
153 xP->set(*
state_->iterateVec);
154 sP->set(*
state_->stepVec);
159 beta_ = (b - one) / (b - half);
169 state_->stepVec->axpy(-one,x);
182 state_->iterateVec->set(*xP);
183 state_->stepVec->set(*sP);
202 beta_ = (b - one) / (b - half);
212 state_->stepVec->axpy(-one,x);
230 dg->set(
state_->gradientVec->dual());
241template<
typename Real>
243 std::stringstream hist;
245 hist << std::string(109,
'-') << std::endl;
246 hist <<
"iPiano: Inertial proximal algorithm for nonconvex optimization";
247 hist <<
" status output definitions" << std::endl << std::endl;
248 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
249 hist <<
" value - Objective function value" << std::endl;
250 hist <<
" gnorm - Norm of the proximal gradient with parameter lambda" << std::endl;
251 hist <<
" snorm - Norm of the step (update to optimization vector)" << std::endl;
252 hist <<
" alpha - Inertial gradient parameter" << std::endl;
253 hist <<
" beta - Inertial step parameter" << std::endl;
254 hist <<
" L - Lipschitz constant estimate" << std::endl;
255 hist <<
" #sval - Cumulative number of times the smooth objective function was evaluated" << std::endl;
256 hist <<
" #nval - Cumulative number of times the nonsmooth objective function was evaluated" << std::endl;
257 hist <<
" #grad - Cumulative number of times the gradient was computed" << std::endl;
258 hist <<
" #prox - Cumulative number of times the proximal operator was computed" << std::endl;
259 hist << std::string(109,
'-') << std::endl;
263 hist << std::setw(6) << std::left <<
"iter";
264 hist << std::setw(15) << std::left <<
"value";
265 hist << std::setw(15) << std::left <<
"gnorm";
266 hist << std::setw(15) << std::left <<
"snorm";
267 hist << std::setw(15) << std::left <<
"alpha";
268 hist << std::setw(15) << std::left <<
"beta";
269 hist << std::setw(15) << std::left <<
"L";
270 hist << std::setw(10) << std::left <<
"#sval";
271 hist << std::setw(10) << std::left <<
"#nval";
272 hist << std::setw(10) << std::left <<
"#grad";
273 hist << std::setw(10) << std::left <<
"#nprox";
278template<
typename Real>
280 std::stringstream hist;
281 hist << std::endl <<
"iPiano: Inertial Proximal Algorithm for Nonconvex Optimization (Type P)" << std::endl;
285template<
typename Real>
287 std::stringstream hist;
288 hist << std::scientific << std::setprecision(6);
291 if (
state_->iter == 0 ) {
293 hist << std::setw(6) << std::left <<
state_->iter;
294 hist << std::setw(15) << std::left <<
state_->value;
295 hist << std::setw(15) << std::left <<
state_->gnorm;
296 hist << std::setw(15) << std::left <<
"---";
297 hist << std::setw(15) << std::left <<
"---";
298 hist << std::setw(15) << std::left <<
"---";
299 hist << std::setw(15) << std::left <<
L_;
300 hist << std::setw(10) << std::left <<
state_->nsval;
301 hist << std::setw(10) << std::left <<
state_->nnval;
302 hist << std::setw(10) << std::left <<
state_->ngrad;
303 hist << std::setw(10) << std::left <<
state_->nprox;
308 hist << std::setw(6) << std::left <<
state_->iter;
309 hist << std::setw(15) << std::left <<
state_->value;
310 hist << std::setw(15) << std::left <<
state_->gnorm;
311 hist << std::setw(15) << std::left <<
state_->snorm;
312 hist << std::setw(15) << std::left <<
alpha_;
313 hist << std::setw(15) << std::left <<
beta_;
314 hist << std::setw(15) << std::left <<
L_;
315 hist << std::setw(10) << std::left <<
state_->nsval;
316 hist << std::setw(10) << std::left <<
state_->nnval;
317 hist << std::setw(10) << std::left <<
state_->ngrad;
318 hist << 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)
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.