ROL
ROL_Bundle_U_AS_Def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 #ifndef ROL_BUNDLE_U_AS_DEF_H
45 #define ROL_BUNDLE_U_AS_DEF_H
46 
47 namespace ROL {
48 
49 template<typename Real>
50 Bundle_U_AS<Real>::Bundle_U_AS(const unsigned maxSize,
51  const Real coeff,
52  const Real omega,
53  const unsigned remSize)
54  : Bundle_U<Real>(maxSize,coeff,omega,remSize), isInitialized_(false) {}
55 
56 template<typename Real>
59  if ( !isInitialized_ ) {
60  tG_ = g.clone();
61  yG_ = g.clone();
62  eG_ = g.clone();
63  gx_ = g.clone();
64  ge_ = g.clone();
65  isInitialized_ = true;
66  }
67 }
68 
69 template<typename Real>
70 unsigned Bundle_U_AS<Real>::solveDual(const Real t, const unsigned maxit, const Real tol) {
71  unsigned iter = 0;
72  if (Bundle_U<Real>::size() == 1) {
73  iter = Bundle_U<Real>::solveDual_dim1(t,maxit,tol);
74  }
75  else if (Bundle_U<Real>::size() == 2) {
76  iter = Bundle_U<Real>::solveDual_dim2(t,maxit,tol);
77  }
78  else {
79  iter = solveDual_arbitrary(t,maxit,tol);
80  }
81  return iter;
82 }
83 
84 template<typename Real>
86  const Real zero(0);
87  Real sum(0), err(0), tmp(0), y(0);
88  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
89  // Compute sum of dualVariables_ using Kahan's compensated sum
90  //sum += Bundle_U<Real>::getDualVariable(i);
92  tmp = sum + y;
93  err = (tmp - sum) - y;
94  sum = tmp;
95  }
96  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
99  }
100  nworkingSet_.clear();
101  workingSet_.clear();
102  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
104  workingSet_.insert(i);
105  }
106  else {
107  nworkingSet_.insert(i);
108  }
109  }
110 }
111 
112 template<typename Real>
113 void Bundle_U_AS<Real>::computeLagMult(std::vector<Real> &lam, const Real mu, const std::vector<Real> &g) const {
114  const Real zero(0);
115  unsigned n = workingSet_.size();
116  if ( n > 0 ) {
117  lam.resize(n,zero);
118  typename std::set<unsigned>::iterator it = workingSet_.begin();
119  for (unsigned i = 0; i < n; ++i) {
120  lam[i] = g[*it] - mu; it++;
121  }
122  }
123  else {
124  lam.clear();
125  }
126 }
127 
128 template<typename Real>
129 bool Bundle_U_AS<Real>::isNonnegative(unsigned &ind, const std::vector<Real> &x) const {
130  bool flag = true;
131  unsigned n = workingSet_.size();
132  ind = Bundle_U<Real>::size();
133  if ( n > 0 ) {
134  Real min = ROL_OVERFLOW<Real>();
135  typename std::set<unsigned>::iterator it = workingSet_.begin();
136  for (unsigned i = 0; i < n; ++i) {
137  if ( x[i] < min ) {
138  ind = *it;
139  min = x[i];
140  }
141  it++;
142  }
143  flag = ((min < -ROL_EPSILON<Real>()) ? false : true);
144  }
145  return flag;
146 }
147 
148 template<typename Real>
149 Real Bundle_U_AS<Real>::computeStepSize(unsigned &ind, const std::vector<Real> &x, const std::vector<Real> &p) const {
150  const Real zero(0);
151  Real alpha(1), tmp(0);
152  ind = Bundle_U<Real>::size();
153  typename std::set<unsigned>::iterator it;
154  for (it = nworkingSet_.begin(); it != nworkingSet_.end(); it++) {
155  if ( p[*it] < -ROL_EPSILON<Real>() ) {
156  tmp = -x[*it]/p[*it];
157  if ( alpha >= tmp ) {
158  alpha = tmp;
159  ind = *it;
160  }
161  }
162  }
163  return std::max(zero,alpha);
164 }
165 
166 template<typename Real>
167 unsigned Bundle_U_AS<Real>::solveEQPsubproblem(std::vector<Real> &s, Real &mu,
168  const std::vector<Real> &g, const Real tol) const {
169  // Build reduced QP information
170  const Real zero(0);
171  unsigned n = nworkingSet_.size(), cnt = 0;
172  mu = zero;
173  s.assign(Bundle_U<Real>::size(),zero);
174  if ( n > 0 ) {
175  std::vector<Real> gk(n,zero);
176  typename std::set<unsigned>::iterator it = nworkingSet_.begin();
177  for (unsigned i = 0; i < n; ++i) {
178  gk[i] = g[*it]; it++;
179  }
180  std::vector<Real> sk(n,zero);
181  cnt = projectedCG(sk,mu,gk,tol);
182  it = nworkingSet_.begin();
183  for (unsigned i = 0; i < n; ++i) {
184  s[*it] = sk[i]; it++;
185  }
186  }
187  return cnt;
188 }
189 
190 template<typename Real>
191 void Bundle_U_AS<Real>::applyPreconditioner(std::vector<Real> &Px, const std::vector<Real> &x) const {
192  const Real zero(0);
193  int type = 0;
194  std::vector<Real> tmp(Px.size(),zero);
195  switch (type) {
196  case 0: applyPreconditioner_Identity(tmp,x); break;
197  case 1: applyPreconditioner_Jacobi(tmp,x); break;
198  case 2: applyPreconditioner_SymGS(tmp,x); break;
199  }
200  applyPreconditioner_Identity(Px,tmp);
201 }
202 
203 template<typename Real>
204 void Bundle_U_AS<Real>::applyG(std::vector<Real> &Gx, const std::vector<Real> &x) const {
205  int type = 0;
206  switch (type) {
207  case 0: applyG_Identity(Gx,x); break;
208  case 1: applyG_Jacobi(Gx,x); break;
209  case 2: applyG_SymGS(Gx,x); break;
210  }
211 }
212 
213 template<typename Real>
214 void Bundle_U_AS<Real>::applyPreconditioner_Identity(std::vector<Real> &Px, const std::vector<Real> &x) const {
215  unsigned dim = nworkingSet_.size();
216  Real sum(0), err(0), tmp(0), y(0);
217  for (unsigned i = 0; i < dim; ++i) {
218  // Compute sum of x using Kahan's compensated sum
219  //sum += x[i];
220  y = x[i] - err;
221  tmp = sum + y;
222  err = (tmp - sum) - y;
223  sum = tmp;
224  }
225  sum /= (Real)dim;
226  for (unsigned i = 0; i < dim; ++i) {
227  Px[i] = x[i] - sum;
228  }
229 }
230 
231 template<typename Real>
232 void Bundle_U_AS<Real>::applyG_Identity(std::vector<Real> &Gx, const std::vector<Real> &x) const {
233  Gx.assign(x.begin(),x.end());
234 }
235 
236 template<typename Real>
237 void Bundle_U_AS<Real>::applyPreconditioner_Jacobi(std::vector<Real> &Px, const std::vector<Real> &x) const {
238  const Real zero(0), one(1);
239  unsigned dim = nworkingSet_.size();
240  Real eHe(0), sum(0);
241  Real errX(0), tmpX(0), yX(0), errE(0), tmpE(0), yE(0);
242  std::vector<Real> gg(dim,zero);
243  typename std::set<unsigned>::iterator it = nworkingSet_.begin();
244  for (unsigned i = 0; i < dim; ++i) {
245  gg[i] = one/std::abs(Bundle_U<Real>::GiGj(*it,*it)); it++;
246  // Compute sum of inv(D)x using Kahan's aggregated sum
247  //sum += x[i]*gg[i];
248  yX = x[i]*gg[i] - errX;
249  tmpX = sum + yX;
250  errX = (tmpX - sum) - yX;
251  sum = tmpX;
252  // Compute sum of inv(D)e using Kahan's aggregated sum
253  //eHe += gg[i];
254  yE = gg[i] - errE;
255  tmpE = eHe + yE;
256  errE = (tmpE - eHe) - yE;
257  eHe = tmpE;
258  }
259  sum /= eHe;
260  for (unsigned i = 0; i < dim; ++i) {
261  Px[i] = (x[i]-sum)*gg[i];
262  }
263 }
264 
265 template<typename Real>
266 void Bundle_U_AS<Real>::applyG_Jacobi(std::vector<Real> &Gx, const std::vector<Real> &x) const {
267  unsigned dim = nworkingSet_.size();
268  typename std::set<unsigned>::iterator it = nworkingSet_.begin();
269  for (unsigned i = 0; i < dim; ++i) {
270  Gx[i] = std::abs(Bundle_U<Real>::GiGj(*it,*it))*x[i]; it++;
271  }
272 }
273 
274 template<typename Real>
275 void Bundle_U_AS<Real>::applyPreconditioner_SymGS(std::vector<Real> &Px, const std::vector<Real> &x) const {
276  int dim = nworkingSet_.size();
277  //unsigned cnt = 0;
278  gx_->zero(); ge_->zero();
279  Real eHx(0), eHe(0), one(1);
280  // Forward substitution
281  std::vector<Real> x1(dim,0), e1(dim,0),gg(dim,0);
282  typename std::set<unsigned>::iterator it, jt;
283  it = nworkingSet_.begin();
284  for (int i = 0; i < dim; ++i) {
285  gx_->zero(); ge_->zero(); jt = nworkingSet_.begin();
286  for (int j = 0; j < i; ++j) {
287  Bundle_U<Real>::addGi(*jt,x1[j],*gx_);
288  Bundle_U<Real>::addGi(*jt,e1[j],*ge_);
289  jt++;
290  }
291  gg[i] = Bundle_U<Real>::GiGj(*it,*it);
292  x1[i] = (x[i] - Bundle_U<Real>::dotGi(*it,*gx_))/gg[i];
293  e1[i] = (one - Bundle_U<Real>::dotGi(*it,*ge_))/gg[i];
294  it++;
295  }
296  // Apply diagonal
297  for (int i = 0; i < dim; ++i) {
298  x1[i] *= gg[i];
299  e1[i] *= gg[i];
300  }
301  // Back substitution
302  std::vector<Real> Hx(dim,0), He(dim,0); it = nworkingSet_.end();
303  for (int i = dim-1; i >= 0; --i) {
304  it--;
305  gx_->zero(); ge_->zero(); jt = nworkingSet_.end();
306  for (int j = dim-1; j >= i+1; --j) {
307  jt--;
308  Bundle_U<Real>::addGi(*jt,Hx[j],*gx_);
309  Bundle_U<Real>::addGi(*jt,He[j],*ge_);
310  }
311  Hx[i] = (x1[i] - Bundle_U<Real>::dotGi(*it,*gx_))/gg[i];
312  He[i] = (e1[i] - Bundle_U<Real>::dotGi(*it,*ge_))/gg[i];
313  // Compute sums
314  eHx += Hx[i];
315  eHe += He[i];
316  }
317  // Accumulate preconditioned vector
318  for (int i = 0; i < dim; ++i) {
319  Px[i] = Hx[i] - (eHx/eHe)*He[i];
320  }
321 }
322 
323 template<typename Real>
324 void Bundle_U_AS<Real>::applyG_SymGS(std::vector<Real> &Gx, const std::vector<Real> &x) const {
325  unsigned dim = nworkingSet_.size();
326  typename std::set<unsigned>::iterator it = nworkingSet_.begin();
327  for (unsigned i = 0; i < dim; ++i) {
328  Gx[i] = std::abs(Bundle_U<Real>::GiGj(*it,*it))*x[i]; it++;
329  }
330 }
331 
332 template<typename Real>
333 void Bundle_U_AS<Real>::computeResidualUpdate(std::vector<Real> &r, std::vector<Real> &g) const {
334  unsigned n = g.size();
335  std::vector<Real> Gg(n,0);
336  Real y(0), ytmp(0), yprt(0), yerr(0);
337  applyPreconditioner(g,r);
338  applyG(Gg,g);
339  // Compute multiplier using Kahan's compensated sum
340  for (unsigned i = 0; i < n; ++i) {
341  //y += (r[i] - Gg[i]);
342  yprt = (r[i] - Gg[i]) - yerr;
343  ytmp = y + yprt;
344  yerr = (ytmp - y) - yprt;
345  y = ytmp;
346  }
347  y /= (Real)n;
348  for (unsigned i = 0; i < n; ++i) {
349  r[i] -= y;
350  }
351  applyPreconditioner(g,r);
352 }
353 
354 template<typename Real>
355 void Bundle_U_AS<Real>::applyFullMatrix(std::vector<Real> &Hx, const std::vector<Real> &x) const {
356  const Real one(1);
357  gx_->zero(); eG_->zero();
358  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
359  // Compute Gx using Kahan's compensated sum
360  //gx_->axpy(x[i],Bundle_U<Real>::subgradient(i));
361  yG_->set(Bundle_U<Real>::subgradient(i)); yG_->scale(x[i]); yG_->axpy(-one,*eG_);
362  tG_->set(*gx_); tG_->plus(*yG_);
363  eG_->set(*tG_); eG_->axpy(-one,*gx_); eG_->axpy(-one,*yG_);
364  gx_->set(*tG_);
365  }
366  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
367  // Compute < g_i, Gx >
368  Hx[i] = Bundle_U<Real>::dotGi(i,*gx_);
369  }
370 }
371 
372 template<typename Real>
373 void Bundle_U_AS<Real>::applyMatrix(std::vector<Real> &Hx, const std::vector<Real> &x) const {
374  const Real one(1);
375  gx_->zero(); eG_->zero();
376  unsigned n = nworkingSet_.size();
377  typename std::set<unsigned>::iterator it = nworkingSet_.begin();
378  for (unsigned i = 0; i < n; ++i) {
379  // Compute Gx using Kahan's compensated sum
380  //gx_->axpy(x[i],Bundle_U<Real>::subgradient(*it));
381  yG_->set(Bundle_U<Real>::subgradient(*it)); yG_->scale(x[i]); yG_->axpy(-one,*eG_);
382  tG_->set(*gx_); tG_->plus(*yG_);
383  eG_->set(*tG_); eG_->axpy(-one,*gx_); eG_->axpy(-one,*yG_);
384  gx_->set(*tG_);
385  it++;
386  }
387  it = nworkingSet_.begin();
388  for (unsigned i = 0; i < n; ++i) {
389  // Compute < g_i, Gx >
390  Hx[i] = Bundle_U<Real>::dotGi(*it,*gx_); it++;
391  }
392 }
393 
394 template<typename Real>
395 unsigned Bundle_U_AS<Real>::projectedCG(std::vector<Real> &x, Real &mu, const std::vector<Real> &b, const Real tol) const {
396  const Real one(1), zero(0);
397  unsigned n = nworkingSet_.size();
398  std::vector<Real> r(n,0), r0(n,0), g(n,0), d(n,0), Ad(n,0);
399  // Compute residual Hx + g = g with x = 0
400  x.assign(n,0);
401  scale(r,one,b);
402  r0.assign(r.begin(),r.end());
403  // Precondition residual
404  computeResidualUpdate(r,g);
405  Real rg = dot(r,g), rg0(0);
406  // Get search direction
407  scale(d,-one,g);
408  Real alpha(0), kappa(0), beta(0), TOL(1.e-2);
409  Real CGtol = std::min(tol,TOL*rg);
410  unsigned cnt = 0;
411  while (rg > CGtol && cnt < 2*n+1) {
412  applyMatrix(Ad,d);
413  kappa = dot(d,Ad);
414  alpha = rg/kappa;
415  axpy(alpha,d,x);
416  axpy(alpha,Ad,r);
417  axpy(alpha,Ad,r0);
418  computeResidualUpdate(r,g);
419  rg0 = rg;
420  rg = dot(r,g);
421  beta = rg/rg0;
422  scale(d,beta);
423  axpy(-one,g,d);
424  cnt++;
425  }
426  // Compute multiplier for equality constraint using Kahan's compensated sum
427  mu = zero;
428  Real err(0), tmp(0), y(0);
429  for (unsigned i = 0; i < n; ++i) {
430  //mu += r0[i];
431  y = r0[i] - err;
432  tmp = mu + y;
433  err = (tmp - mu) - y;
434  mu = tmp;
435  }
436  mu /= static_cast<Real>(n);
437  // Return iteration count
438  return cnt;
439 }
440 
441 template<typename Real>
442 Real Bundle_U_AS<Real>::dot(const std::vector<Real> &x, const std::vector<Real> &y) const {
443  // Compute dot product of two vectors using Kahan's compensated sum
444  Real val(0), err(0), tmp(0), y0(0);
445  unsigned n = std::min(x.size(),y.size());
446  for (unsigned i = 0; i < n; ++i) {
447  //val += x[i]*y[i];
448  y0 = x[i]*y[i] - err;
449  tmp = val + y0;
450  err = (tmp - val) - y0;
451  val = tmp;
452  }
453  return val;
454 }
455 
456 template<typename Real>
457 Real Bundle_U_AS<Real>::norm(const std::vector<Real> &x) const {
458  return std::sqrt(dot(x,x));
459 }
460 
461 template<typename Real>
462 void Bundle_U_AS<Real>::axpy(const Real a, const std::vector<Real> &x, std::vector<Real> &y) const {
463  unsigned n = std::min(y.size(),x.size());
464  for (unsigned i = 0; i < n; ++i) {
465  y[i] += a*x[i];
466  }
467 }
468 
469 template<typename Real>
470 void Bundle_U_AS<Real>::scale(std::vector<Real> &x, const Real a) const {
471  for (unsigned i = 0; i < x.size(); ++i) {
472  x[i] *= a;
473  }
474 }
475 
476 template<typename Real>
477 void Bundle_U_AS<Real>::scale(std::vector<Real> &x, const Real a, const std::vector<Real> &y) const {
478  unsigned n = std::min(x.size(),y.size());
479  for (unsigned i = 0; i < n; ++i) {
480  x[i] = a*y[i];
481  }
482 }
483 
484 template<typename Real>
485 unsigned Bundle_U_AS<Real>::solveDual_arbitrary(const Real t, const unsigned maxit, const Real tol) {
486  const Real zero(0), one(1);
487  initializeDualSolver();
488  bool nonneg = false;
489  unsigned ind = 0, i = 0, CGiter = 0;
490  Real snorm(0), alpha(0), mu(0);
491  std::vector<Real> s(Bundle_U<Real>::size(),0), Hs(Bundle_U<Real>::size(),0);
492  std::vector<Real> g(Bundle_U<Real>::size(),0), lam(Bundle_U<Real>::size()+1,0);
493  std::vector<Real> dualVariables(Bundle_U<Real>::size(),0);
494  for (unsigned j = 0; j < Bundle_U<Real>::size(); ++j) {
495  dualVariables[j] = Bundle_U<Real>::getDualVariable(j);
496  }
497  //Real val = Bundle_U<Real>::evaluateObjective(g,dualVariables,t);
498  Bundle_U<Real>::evaluateObjective(g,dualVariables,t);
499  for (i = 0; i < maxit; ++i) {
500  CGiter += solveEQPsubproblem(s,mu,g,tol);
501  snorm = norm(s);
502  if ( snorm < ROL_EPSILON<Real>() ) {
503  computeLagMult(lam,mu,g);
504  nonneg = isNonnegative(ind,lam);
505  if ( nonneg ) {
506  break;
507  }
508  else {
509  alpha = one;
510  if ( ind < Bundle_U<Real>::size() ) {
511  workingSet_.erase(ind);
512  nworkingSet_.insert(ind);
513  }
514  }
515  }
516  else {
517  alpha = computeStepSize(ind,dualVariables,s);
518  if ( alpha > zero ) {
519  axpy(alpha,s,dualVariables);
520  applyFullMatrix(Hs,s);
521  axpy(alpha,Hs,g);
522  }
523  if (ind < Bundle_U<Real>::size()) {
524  workingSet_.insert(ind);
525  nworkingSet_.erase(ind);
526  }
527  }
528  //std::cout << "iter = " << i << " snorm = " << snorm << " alpha = " << alpha << "\n";
529  }
530  //Real crit = computeCriticality(g,dualVariables);
531  //std::cout << "Criticality Measure: " << crit << "\n";
532  //std::cout << "dim = " << Bundle_U<Real>::size() << " iter = " << i << " CGiter = " << CGiter << " CONVERGED!\n";
533  for (unsigned j = 0; j < Bundle_U<Real>::size(); ++j) {
534  Bundle_U<Real>::setDualVariable(j,dualVariables[j]);
535  }
536  return i;
537 }
538 
539 template<typename Real>
540 void Bundle_U_AS<Real>::project(std::vector<Real> &x, const std::vector<Real> &v) const {
541  const Real zero(0), one(1);
542  std::vector<Real> vsort(Bundle_U<Real>::size(),0);
543  vsort.assign(v.begin(),v.end());
544  std::sort(vsort.begin(),vsort.end());
545  Real sum(-1), lam(0);
546  for (unsigned i = Bundle_U<Real>::size()-1; i > 0; i--) {
547  sum += vsort[i];
548  if ( sum >= static_cast<Real>(Bundle_U<Real>::size()-i)*vsort[i-1] ) {
549  lam = sum/static_cast<Real>(Bundle_U<Real>::size()-i);
550  break;
551  }
552  }
553  if (lam == zero) {
554  lam = (sum+vsort[0])/static_cast<Real>(Bundle_U<Real>::size());
555  }
556  for (unsigned i = 0; i < Bundle_U<Real>::size(); ++i) {
557  x[i] = std::max(zero,v[i] - lam);
558  }
559 }
560 
561 template<typename Real>
562 Real Bundle_U_AS<Real>::computeCriticality(const std::vector<Real> &g, const std::vector<Real> &sol) const {
563  const Real zero(0), one(1);
564  std::vector<Real> x(Bundle_U<Real>::size(),0), Px(Bundle_U<Real>::size(),0);
565  axpy(one,sol,x);
566  axpy(-one,g,x);
567  project(Px,x);
568  scale(x,zero);
569  axpy(one,sol,x);
570  axpy(-one,Px,x);
571  return norm(x);
572 }
573 
574 } // namespace ROL
575 
576 #endif
bool isNonnegative(unsigned &ind, const std::vector< Real > &x) const
Real norm(const std::vector< Real > &x) const
unsigned solveDual_dim1(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void scale(std::vector< Real > &x, const Real a) const
void applyPreconditioner(std::vector< Real > &Px, const std::vector< Real > &x) const
void setDualVariable(const unsigned i, const Real val)
unsigned solveEQPsubproblem(std::vector< Real > &s, Real &mu, const std::vector< Real > &g, const Real tol) const
const Real dotGi(const unsigned i, const Vector< Real > &x) const
void applyPreconditioner_Jacobi(std::vector< Real > &Px, const std::vector< Real > &x) const
const Real GiGj(const unsigned i, const unsigned j) const
Real dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void applyG_Identity(std::vector< Real > &Gx, const std::vector< Real > &x) const
Provides the interface for and implements a bundle.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
virtual void initialize(const Vector< Real > &g)
void applyPreconditioner_SymGS(std::vector< Real > &Px, const std::vector< Real > &x) const
void applyMatrix(std::vector< Real > &Hx, const std::vector< Real > &x) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
unsigned size(void) const
Real computeCriticality(const std::vector< Real > &g, const std::vector< Real > &sol) const
Real evaluateObjective(std::vector< Real > &g, const std::vector< Real > &x, const Real t) const
unsigned projectedCG(std::vector< Real > &x, Real &mu, const std::vector< Real > &b, const Real tol) const
unsigned solveDual_arbitrary(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
unsigned solveDual(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
unsigned solveDual_dim2(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
void computeResidualUpdate(std::vector< Real > &r, std::vector< Real > &g) const
void applyG(std::vector< Real > &Gx, const std::vector< Real > &x) const
void initialize(const Vector< Real > &g)
Real computeStepSize(unsigned &ind, const std::vector< Real > &x, const std::vector< Real > &p) const
void addGi(const unsigned i, const Real a, Vector< Real > &x) const
void applyG_Jacobi(std::vector< Real > &Gx, const std::vector< Real > &x) const
void axpy(const Real a, const std::vector< Real > &x, std::vector< Real > &y) const
void applyPreconditioner_Identity(std::vector< Real > &Px, const std::vector< Real > &x) const
void initializeDualSolver(void)
void applyFullMatrix(std::vector< Real > &Hx, const std::vector< Real > &x) const
const Real getDualVariable(const unsigned i) const
constexpr auto dim
void computeLagMult(std::vector< Real > &lam, const Real mu, const std::vector< Real > &g) const
void project(std::vector< Real > &x, const std::vector< Real > &v) const
Bundle_U_AS(const unsigned maxSize=10, const Real coeff=0.0, const Real omega=2.0, const unsigned remSize=2)
void applyG_SymGS(std::vector< Real > &Gx, const std::vector< Real > &x) const