79 std::ostream &outStream) {
80 Real ftol = std::sqrt(ROL_EPSILON<Real>());
85 nobj.
prox(*state_->iterateVec,x,t0_,ftol); state_->nprox++;
86 x.
set(*state_->iterateVec);
89 state_->svalue = sobj.
value(x,ftol); state_->nsval++;
91 state_->nvalue = nobj.
value(x,ftol); state_->nnval++;
92 state_->value = state_->svalue + state_->nvalue;
93 sobj.
gradient(*state_->gradientVec,x,ftol); state_->ngrad++;
94 dg.
set(state_->gradientVec->dual());
95 pgstep(*state_->iterateVec, *state_->stepVec, nobj, x, dg, t0_, ftol);
96 state_->snorm = state_->stepVec->norm();
97 state_->gnorm = state_->snorm / t0_;
105 std::ostream &outStream ) {
106 const Real half(0.5), one(1), two(2);
109 initialize(x,g,sobj,nobj,*sP,*dg,outStream);
110 Real strial(0), strialP(0), snormP(0), LP(0), alphaP(0), betaP(0), gs(0), b(0);
111 Real tol(std::sqrt(ROL_EPSILON<Real>()));
117 if (verbosity_ > 0) writeOutput(outStream,
true);
120 while (status_->check(*state_)) {
122 if (!useConstBeta_) {
123 b = (c1_ + half * L_) / (c2_ + half * L_);
124 beta_ = (b - one) / (b - half);
126 alpha_ = two * (1 - beta_) / (two * c2_ + L_);
128 state_->stepVec->set(x);
129 state_->stepVec->axpy(-alpha_, *dg);
130 state_->stepVec->axpy(beta_, x);
131 state_->stepVec->axpy(-beta_, *xold);
132 nobj.
prox(*state_->iterateVec, *state_->stepVec, alpha_, tol); state_->nprox++;
133 state_->stepVec->set(*state_->iterateVec);
134 state_->stepVec->axpy(-one,x);
135 state_->snorm = state_->stepVec->norm();
139 strial = sobj.
value(*state_->iterateVec,tol); state_->nsval++;
140 gs = state_->gradientVec->apply(*state_->stepVec);
142 if (strial <= state_->svalue + gs + half * L_ * state_->snorm * state_->snorm) {
144 for (
int i = 0; i < maxit_; ++i) {
152 snormP = state_->snorm;
153 xP->set(*state_->iterateVec);
154 sP->set(*state_->stepVec);
157 if (!useConstBeta_) {
158 b = (c1_ + half * L_) / (c2_ + half * L_);
159 beta_ = (b - one) / (b - half);
161 alpha_ = two * (one - beta_) / (two * c2_ + L_);
163 state_->stepVec->set(x);
164 state_->stepVec->axpy(-alpha_, *dg);
165 state_->stepVec->axpy(beta_, x);
166 state_->stepVec->axpy(-beta_, *xold);
167 nobj.
prox(*state_->iterateVec, *state_->stepVec, alpha_, tol); state_->nprox++;
168 state_->stepVec->set(*state_->iterateVec);
169 state_->stepVec->axpy(-one,x);
170 state_->snorm = state_->stepVec->norm();
173 strial = sobj.
value(*state_->iterateVec,tol); state_->nsval++;
174 gs = state_->gradientVec->apply(*state_->stepVec);
175 if (strial > state_->svalue + gs + half * L_ * state_->snorm * state_->snorm) {
181 state_->snorm = snormP;
182 state_->iterateVec->set(*xP);
183 state_->stepVec->set(*sP);
197 while (strial > state_->svalue + gs + half * L_ * state_->snorm * state_->snorm) {
200 if (!useConstBeta_) {
201 b = (c1_ + half * L_) / (c2_ + half * L_);
202 beta_ = (b - one) / (b - half);
204 alpha_ = two * (one - beta_) / (two * c2_ + L_);
206 state_->stepVec->set(x);
207 state_->stepVec->axpy(-alpha_, *dg);
208 state_->stepVec->axpy(beta_, x);
209 state_->stepVec->axpy(-beta_, *xold);
210 nobj.
prox(*state_->iterateVec, *state_->stepVec, alpha_, tol); state_->nprox++;
211 state_->stepVec->set(*state_->iterateVec);
212 state_->stepVec->axpy(-one,x);
213 state_->snorm = state_->stepVec->norm();
216 strial = sobj.
value(*state_->iterateVec,tol); state_->nsval++;
217 gs = state_->gradientVec->apply(*state_->stepVec);
225 x.
set(*state_->iterateVec);
226 state_->svalue = strial;
227 state_->nvalue = nobj.
value(x,tol); state_->nnval++;
228 state_->value = state_->svalue + state_->nvalue;
229 sobj.
gradient(*state_->gradientVec,x,tol); state_->ngrad++;
230 dg->set(state_->gradientVec->dual());
232 pgstep(*xP,*sP,nobj,x,*dg,t0_,tol);
233 state_->gnorm = sP->norm() / t0_;
236 if (verbosity_ > 0) writeOutput(outStream,writeHeader_);
243 std::stringstream hist;
244 if (verbosity_ > 1) {
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";
287 std::stringstream hist;
288 hist << std::scientific << std::setprecision(6);
289 if ( state_->iter == 0 ) writeName(os);
290 if ( write_header ) writeHeader(os);
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;