44 #ifndef ROL_BUNDLE_STEP_H
45 #define ROL_BUNDLE_STEP_H
56 #include "ROL_ParameterList.hpp"
57 #include "ROL_Ptr.hpp"
82 ROL::Ptr<Vector<Real> >
y_;
128 Real
zero(0), two(2), oem3(1.e-3), oem6(1.e-6), oem8(1.e-8), p1(0.1), p2(0.2), p9(0.9), oe3(1.e3), oe8(1.e8);
130 state->searchSize = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Initial Trust-Region Parameter", oe3);
131 T_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Maximum Trust-Region Parameter", oe8);
132 tol_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Epsilon Solution Tolerance", oem6);
133 m1_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Upper Threshold for Serious Step", p1);
134 m2_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Lower Threshold for Serious Step", p2);
135 m3_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Upper Threshold for Null Step", p9);
136 nu_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Tolerance for Trust-Region Parameter", oem3);
139 Real coeff = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Distance Measure Coefficient",
zero);
140 Real omega = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Locality Measure Coefficient", two);
141 unsigned maxSize = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Maximum Bundle Size", 200);
142 unsigned remSize = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Removal Size for Bundle Update", 2);
143 if ( parlist.sublist(
"Step").sublist(
"Bundle").get(
"Cutting Plane Solver",0) == 1 ) {
144 bundle_ = ROL::makePtr<Bundle_TT<Real>>(maxSize,coeff,omega,remSize);
148 bundle_ = ROL::makePtr<Bundle_AS<Real>>(maxSize,coeff,omega,remSize);
153 QPtol_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Cutting Plane Tolerance", oem8);
154 QPmaxit_ = parlist.sublist(
"Step").sublist(
"Bundle").get(
"Cutting Plane Iteration Limit", 1000);
158 = parlist.sublist(
"Step").sublist(
"Line Search").get(
"Maximum Number of Function Evaluations",20);
164 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity", 0);
172 Real searchSize = state->searchSize;
174 state->searchSize = searchSize;
176 bundle_->initialize(*(state->gradientVec));
193 Real v(0), l(0), u =
T_, gd(0);
194 Real
zero(0), two(2), half(0.5);
204 std::cout << std::endl;
205 std::cout <<
" Computation of aggregrate quantities" << std::endl;
207 std::cout <<
" Aggregate linearization error: " <<
aggLinErrNew_ << std::endl;
208 std::cout <<
" Aggregate distance measure: " <<
aggDistMeasNew_ << std::endl;
217 std::cout << std::endl;
218 std::cout <<
" Solve cutting plan subproblem" << std::endl;
219 std::cout <<
" Cutting plan objective value: " << v << std::endl;
220 std::cout <<
" Norm of computed step: " << algo_state.
snorm << std::endl;
221 std::cout <<
" 'Trust-region' radius: " << state->searchSize << std::endl;
231 algo_state.
flag =
true;
240 algo_state.
flag =
true;
244 y_->set(x);
y_->plus(s);
251 gd = s.
dot(state->gradientVec->dual());
254 Real eps =
static_cast<Real
>(10)*ROL_EPSILON<Real>();
255 Real del = eps*std::max(static_cast<Real>(1),std::abs(algo_state.
value));
259 if (std::abs(Df) < eps && std::abs(Dm) < eps) {
270 std::cout << std::endl;
271 std::cout <<
" Check for serious/null step" << std::endl;
272 std::cout <<
" Serious step test SS(i): " << SS1 << std::endl;
273 std::cout <<
" -> Left hand side: " <<
valueNew_-algo_state.
value << std::endl;
274 std::cout <<
" -> Right hand side: " <<
m1_*v << std::endl;
275 std::cout <<
" Null step test NS(iia): " << NS2a << std::endl;
278 std::cout <<
" Null step test NS(iib): " << NS2b << std::endl;
279 std::cout <<
" -> Left hand side: " << std::abs(algo_state.
value-
valueNew_) << std::endl;
285 bool SS2 = (gd >=
m2_*v || state->searchSize >=
T_-
nu_);
287 std::cout <<
" Serious step test SS(iia): " << (gd >=
m2_*v) << std::endl;
288 std::cout <<
" -> Left hand side: " << gd << std::endl;
289 std::cout <<
" -> Right hand side: " <<
m2_*v << std::endl;
290 std::cout <<
" Serious step test SS(iia): " << (state->searchSize >=
T_-
nu_) << std::endl;
291 std::cout <<
" -> Left hand side: " << state->searchSize << std::endl;
292 std::cout <<
" -> Right hand side: " <<
T_-
nu_ << std::endl;
298 std::cout <<
" Serious step taken" << std::endl;
303 l = state->searchSize;
304 state->searchSize = half*(u+l);
306 std::cout <<
" Increase 'trust-region' radius: " << state->searchSize << std::endl;
311 if ( NS2a || NS2b ) {
316 std::cout <<
" Null step taken" << std::endl;
321 u = state->searchSize;
322 state->searchSize = half*(u+l);
324 std::cout <<
" Decrease 'trust-region' radius: " << state->searchSize << std::endl;
333 std::cout <<
" Null step test NS(iii): " << NS3 << std::endl;
334 std::cout <<
" -> Left hand side: " << gd -
bundle_->computeAlpha(algo_state.
snorm,
linErrNew_) << std::endl;
335 std::cout <<
" -> Right hand side: " <<
m2_*v << std::endl;
343 if ( NS2a || NS2b ) {
353 int ls_nfval = 0, ls_ngrad = 0;
369 u = state->searchSize;
370 state->searchSize = half*(u+l);
375 u = state->searchSize;
376 state->searchSize = half*(u+l);
395 if ( !algo_state.
flag ) {
406 Real valueOld = algo_state.
value;
419 algo_state.
gnorm = (state->gradientVec)->norm();
426 std::stringstream hist;
428 hist << std::setw(6) << std::left <<
"iter";
429 hist << std::setw(15) << std::left <<
"value";
430 hist << std::setw(15) << std::left <<
"gnorm";
431 hist << std::setw(15) << std::left <<
"snorm";
432 hist << std::setw(10) << std::left <<
"#fval";
433 hist << std::setw(10) << std::left <<
"#grad";
434 hist << std::setw(15) << std::left <<
"znorm";
435 hist << std::setw(15) << std::left <<
"alpha";
436 hist << std::setw(15) << std::left <<
"TRparam";
437 hist << std::setw(10) << std::left <<
"QPiter";
443 std::stringstream hist;
444 hist <<
"\n" <<
"Bundle Trust-Region Algorithm \n";
450 std::stringstream hist;
451 hist << std::scientific << std::setprecision(6);
454 if ( print_header ) {
458 hist << std::setw(6) << std::left << algo_state.
iter;
459 hist << std::setw(15) << std::left << algo_state.
value;
460 hist << std::setw(15) << std::left << algo_state.
gnorm;
464 if ( print_header ) {
469 hist << std::setw(6) << std::left << algo_state.
iter;
470 hist << std::setw(15) << std::left << algo_state.
value;
471 hist << std::setw(15) << std::left << algo_state.
gnorm;
472 hist << std::setw(15) << std::left << algo_state.
snorm;
473 hist << std::setw(10) << std::left << algo_state.
nfval;
474 hist << std::setw(10) << std::left << algo_state.
ngrad;
477 hist << std::setw(15) << std::left << state->searchSize;
478 hist << std::setw(10) << std::left <<
QPiter_;
Provides the interface to evaluate objective functions.
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL::Ptr< Vector< Real > > y_
virtual void plus(const Vector &x)=0
Compute , where .
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
Real aggregateGradientNorm
Contains definitions of custom data types in ROL.
BundleStep(ROL::ParameterList &parlist)
std::string printName(void) const
Print step name.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
ROL::Ptr< StepState< Real > > getState(void)
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with bound constraint.
ROL::Ptr< Vector< Real > > iterateVec
std::string printHeader(void) const
Print iterate header.
Provides the interface to apply upper and lower bound constraints.
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step.
Provides the interface to compute bundle trust-region steps.
ROL::Ptr< Vector< Real > > aggSubGradNew_
virtual void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step with bound constraint.
virtual void set(const Vector &x)
Set where .
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
ROL::Ptr< Bundle< Real > > bundle_
ROL::Ptr< LineSearch< Real > > lineSearch_
const ROL::Ptr< const StepState< Real > > getStepState(void) const
Get state for step object.