10 #ifndef ROL_COLEMANLIMODEL_HPP
11 #define ROL_COLEMANLIMODEL_HPP
41 Elementwise::Multiply<Real>
mult_;
42 Elementwise::Divide<Real>
div_;
68 Cmat_->set(gc->dual());
69 Cmat_->applyUnary(Elementwise::Sign<Real>());
71 class NegGradInfU :
public Elementwise::BinaryFunction<Real> {
74 Real
apply(
const Real &x,
const Real &y)
const {
75 const Real
zero(0), one(1), INF(ROL_INF<Real>());
76 return (x <
zero && y == INF) ?
zero : one;
79 prim_->set(gc->dual());
80 prim_->applyBinary(NegGradInfU(), *u);
83 class PosGradNinfL :
public Elementwise::BinaryFunction<Real> {
86 Real
apply(
const Real &x,
const Real &y)
const {
87 const Real
zero(0), one(1), NINF(ROL_NINF<Real>());
88 return (x >=
zero && y == NINF) ?
zero : one;
91 prim_->set(gc->dual());
92 prim_->applyBinary(PosGradNinfL(), *l);
103 const Real
zero(0), one(1), INF(ROL_INF<Real>()), NINF(ROL_NINF<Real>());
104 const int LESS_THAN = 0;
105 const int EQUAL_TO = 1;
106 const int GREATER_THAN = 2;
111 reflectStep_->applyBinary(Elementwise::ValueSet<Real>(
zero, LESS_THAN),gc->dual());
113 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(INF, LESS_THAN),*u);
125 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(INF, EQUAL_TO),*u);
130 prim_->applyUnary(Elementwise::Fill<Real>(-one));
138 reflectStep_->applyUnary(Elementwise::Shift<Real>(one));
140 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(NINF, GREATER_THAN),*l);
152 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(NINF, EQUAL_TO),*l);
157 prim_->applyUnary(Elementwise::Fill<Real>(one));
166 Dmat_->applyUnary(Elementwise::AbsoluteValue<Real>());
167 Dmat_->applyUnary(Elementwise::SquareRoot<Real>());
191 const Real stepBackMax = 0.9999,
const Real stepBackScale = 1.0,
192 const bool singleReflect =
true,
194 const bool useSecantPrecond =
false,
const bool useSecantHessVec =
false)
222 hv_->scale(static_cast<Real>(0.5));
256 Real tol = std::sqrt(ROL_EPSILON<Real>());
263 Real lowerBoundV(ROL_NINF<Real>()), upperBoundV(ROL_INF<Real>());
267 Real valueV =
minimize1D(tauV, lowerBoundV, upperBoundV, v);
285 Real lowerBoundR(ROL_NINF<Real>()), upperBoundR(ROL_INF<Real>());
295 bool useCauchyPoint = (valueG < valueV);
296 if (useCauchyPoint) {
309 bool useReflectStep = (valueR < VALUE);
310 if (useReflectStep) {
324 Real snorm =
step_->norm();
356 Real pnorm = p.
norm();
359 class PruneNegative :
public Elementwise::BinaryFunction<Real> {
363 PruneNegative(
const Real val ) : val_(val) {}
364 Real
apply(
const Real &x,
const Real &y)
const {
365 return (y < static_cast<Real>(0)) ? x/y : val_;
368 class PrunePositive :
public Elementwise::BinaryFunction<Real> {
372 PrunePositive(
const Real val ) : val_(val) {}
373 Real
apply(
const Real &x,
const Real &y)
const {
374 return (y > static_cast<Real>(0)) ? x/y : val_;
380 prim_->applyBinary(PrunePositive(ROL_NINF<Real>()),p);
381 Real lowerBound1 =
prim_->reduce(Elementwise::ReductionMax<Real>());
384 prim_->applyBinary(PruneNegative(ROL_NINF<Real>()),p);
385 Real lowerBound2 =
prim_->reduce(Elementwise::ReductionMax<Real>());
387 Real lowerBound3 = std::max(lowerBound1, lowerBound2);
391 prim_->applyBinary(PrunePositive(ROL_INF<Real>()),p);
392 Real upperBound1 =
prim_->reduce(Elementwise::ReductionMin<Real>());
395 prim_->applyBinary(PruneNegative(ROL_INF<Real>()),p);
396 Real upperBound2 =
prim_->reduce(Elementwise::ReductionMin<Real>());
398 Real upperBound3 = std::min(upperBound1, upperBound2);
401 lowerBound = std::max(lowerBound3, -
TRradius_/pnorm);
402 upperBound = std::min(upperBound3,
TRradius_/pnorm);
407 Real tol = std::sqrt(ROL_EPSILON<Real>());
411 Real c2 =
static_cast<Real
>(0.5) *
hv_->dot(p.
dual());
413 Real c1 =
prim_->dot(p);
416 Real lval = (c2 * lowerBound + c1) * lowerBound;
417 Real rval = (c2 * upperBound + c1) * upperBound;
418 tau = (lval < rval) ? lowerBound : upperBound;
419 if (c2 > static_cast<Real>(0)) {
420 Real uncMin =
static_cast<Real
>(-0.5) * c1/c2;
421 tau = (uncMin > lowerBound && uncMin < upperBound) ? uncMin : tau;
425 return (c2 * tau + c1) * tau;
438 Real lowerBound(ROL_NINF<Real>()), upperBound(ROL_INF<Real>());
442 Real tau(1),
value(0);
456 class LowerBound :
public Elementwise::BinaryFunction<Real> {
458 Real
apply(
const Real &x,
const Real &y )
const {
459 return (x == y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
466 class UpperBound :
public Elementwise::BinaryFunction<Real> {
468 Real
apply(
const Real &x,
const Real &y )
const {
469 return (x == y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
481 class LowerBound :
public Elementwise::BinaryFunction<Real> {
483 Real
apply(
const Real &x,
const Real &y )
const {
484 return (x < y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
491 class UpperBound :
public Elementwise::BinaryFunction<Real> {
493 Real
apply(
const Real &x,
const Real &y )
const {
494 return (x > y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
507 class SafeDivide :
public Elementwise::BinaryFunction<Real> {
511 SafeDivide(
const Real val ) : val_(val) {}
512 Real
apply(
const Real &x,
const Real &y)
const {
514 return (y == zero) ? val_ : x/y;
520 lx_->axpy(-one, *xc);
521 lx_->applyBinary(SafeDivide(ROL_INF<Real>()), d);
525 ux_->axpy(-one, *xc);
526 ux_->applyBinary(SafeDivide(ROL_INF<Real>()), d);
529 lx_->applyBinary(Elementwise::Max<Real>(),*
ux_);
532 return lx_->reduce(Elementwise::ReductionMin<Real>());
538 class Greater :
public Elementwise::BinaryFunction<Real> {
541 Real
apply(
const Real &x,
const Real &y)
const {
542 return (x > y) ?
static_cast<Real
>(1) : static_cast<Real>(0);
547 Real lowerFeasible =
prim_->reduce(Elementwise::ReductionMin<Real>());
549 class Lesser :
public Elementwise::BinaryFunction<Real> {
552 Real
apply(
const Real &x,
const Real &y)
const {
553 return (x < y) ?
static_cast<Real
>(1) : static_cast<Real>(0);
558 Real upperFeasible =
prim_->reduce(Elementwise::ReductionMin<Real>());
560 return (upperFeasible * lowerFeasible > 0);
567 #endif // ROL_COLEMANLIMODEL_HPP
Provides the interface to evaluate objective functions.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Ptr< Vector< Real > > lx_
const Real stepBackScale_
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void plus(const Vector &x)=0
Compute , where .
void computeFullReflectiveStep(Vector< Real > &Rv, const Vector< Real > &v, const Vector< Real > &Dv)
Ptr< Vector< Real > > dual_
Ptr< Vector< Real > > prim_
Ptr< Vector< Real > > cauchyScal_
void initialize(const Vector< Real > &x, const Vector< Real > &g)
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
void gradient(Vector< Real > &g, const Vector< Real > &s, Real &tol)
Compute gradient.
void dualTransform(Vector< Real > &tv, const Vector< Real > &v)
void setRadius(const Real del)
void updatePredictedReduction(Real &pred, const Vector< Real > &s)
void updateActualReduction(Real &ared, const Vector< Real > &s)
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &s, Real &tol)
Apply Hessian approximation to vector.
virtual void update(Objective< Real > &obj, BoundConstraint< Real > &bnd, const Vector< Real > &x, const Vector< Real > &g, const Ptr< Secant< Real >> &secant=nullPtr)
void primalTransform(Vector< Real > &tiv, const Vector< Real > &v)
Ptr< Vector< Real > > Cmat_
Ptr< Vector< Real > > Dmat_
Provides the interface to evaluate trust-region model functions.
Defines the linear algebra or vector space interface.
virtual const Ptr< const Vector< Real > > getGradient(void) const
Elementwise::Divide< Real > div_
Elementwise::Multiply< Real > mult_
void update(Objective< Real > &obj, BoundConstraint< Real > &bnd, const Vector< Real > &x, const Vector< Real > &g, const Ptr< Secant< Real >> &secant=nullPtr)
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
void applyD(Vector< Real > &Dv, const Vector< Real > &v)
bool isStrictlyFeasibleStep(const Vector< Real > &d) const
ColemanLiModel(Objective< Real > &obj, BoundConstraint< Real > &bnd, const Vector< Real > &x, const Vector< Real > &g, const Real stepBackMax=0.9999, const Real stepBackScale=1.0, const bool singleReflect=true, const Ptr< Secant< Real >> &secant=nullPtr, const bool useSecantPrecond=false, const bool useSecantHessVec=false)
void applyHessian(Vector< Real > &hv, const Vector< Real > &v, Real &tol)
Ptr< Vector< Real > > cauchyStep_
Ptr< Vector< Real > > ux_
const bool singleReflect_
Real minimize1D(Real &tau, const Real lowerBound, const Real upperBound, const Vector< Real > &p)
Real value(const Vector< Real > &s, Real &tol)
Compute value.
Provides interface for and implements limited-memory secant operators.
Real computeCauchyPoint(void)
void applyInverseD(Vector< Real > &Dv, const Vector< Real > &v)
void applyC(Vector< Real > &Cv, const Vector< Real > &v)
Ptr< Vector< Real > > hv_
Provides the interface to evaluate interior trust-region model functions from the Coleman-Li bound co...
void getScalarBounds(Real &lowerBound, Real &upperBound, const Vector< Real > &p)
Real computeAlpha(const Vector< Real > &d)
Provides the interface to apply upper and lower bound constraints.
Ptr< Vector< Real > > reflectScal_
void constructInverseD(void)
ROL::DiagonalOperator apply
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
Ptr< Vector< Real > > step_
virtual const Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
Ptr< Vector< Real > > reflectStep_
void computeReflectiveStep(Vector< Real > &Rv, const Vector< Real > &v, const Vector< Real > &Dv)
virtual const Ptr< const Vector< Real > > getIterate(void) const