44 #ifndef ROL_COLEMANLIMODEL_HPP
45 #define ROL_COLEMANLIMODEL_HPP
75 Elementwise::Multiply<Real>
mult_;
76 Elementwise::Divide<Real>
div_;
102 Cmat_->set(gc->dual());
103 Cmat_->applyUnary(Elementwise::Sign<Real>());
105 class NegGradInfU :
public Elementwise::BinaryFunction<Real> {
108 Real
apply(
const Real &x,
const Real &y)
const {
109 const Real
zero(0), one(1), INF(ROL_INF<Real>());
110 return (x <
zero && y == INF) ?
zero : one;
113 prim_->set(gc->dual());
114 prim_->applyBinary(NegGradInfU(), *u);
117 class PosGradNinfL :
public Elementwise::BinaryFunction<Real> {
119 PosGradNinfL(
void) {}
120 Real
apply(
const Real &x,
const Real &y)
const {
121 const Real
zero(0), one(1), NINF(ROL_NINF<Real>());
122 return (x >=
zero && y == NINF) ?
zero : one;
125 prim_->set(gc->dual());
126 prim_->applyBinary(PosGradNinfL(), *l);
137 const Real
zero(0), one(1), INF(ROL_INF<Real>()), NINF(ROL_NINF<Real>());
138 const int LESS_THAN = 0;
139 const int EQUAL_TO = 1;
140 const int GREATER_THAN = 2;
145 reflectStep_->applyBinary(Elementwise::ValueSet<Real>(
zero, LESS_THAN),gc->dual());
147 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(INF, LESS_THAN),*u);
159 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(INF, EQUAL_TO),*u);
164 prim_->applyUnary(Elementwise::Fill<Real>(-one));
172 reflectStep_->applyUnary(Elementwise::Shift<Real>(one));
174 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(NINF, GREATER_THAN),*l);
186 reflectScal_->applyBinary(Elementwise::ValueSet<Real>(NINF, EQUAL_TO),*l);
191 prim_->applyUnary(Elementwise::Fill<Real>(one));
200 Dmat_->applyUnary(Elementwise::AbsoluteValue<Real>());
201 Dmat_->applyUnary(Elementwise::SquareRoot<Real>());
225 const Real stepBackMax = 0.9999,
const Real stepBackScale = 1.0,
226 const bool singleReflect =
true,
228 const bool useSecantPrecond =
false,
const bool useSecantHessVec =
false)
256 hv_->scale(static_cast<Real>(0.5));
290 Real tol = std::sqrt(ROL_EPSILON<Real>());
297 Real lowerBoundV(ROL_NINF<Real>()), upperBoundV(ROL_INF<Real>());
301 Real valueV =
minimize1D(tauV, lowerBoundV, upperBoundV, v);
319 Real lowerBoundR(ROL_NINF<Real>()), upperBoundR(ROL_INF<Real>());
329 bool useCauchyPoint = (valueG < valueV);
330 if (useCauchyPoint) {
343 bool useReflectStep = (valueR < VALUE);
344 if (useReflectStep) {
358 Real snorm =
step_->norm();
390 Real pnorm = p.
norm();
393 class PruneNegative :
public Elementwise::BinaryFunction<Real> {
397 PruneNegative(
const Real val ) : val_(val) {}
398 Real
apply(
const Real &x,
const Real &y)
const {
399 return (y < static_cast<Real>(0)) ? x/y : val_;
402 class PrunePositive :
public Elementwise::BinaryFunction<Real> {
406 PrunePositive(
const Real val ) : val_(val) {}
407 Real
apply(
const Real &x,
const Real &y)
const {
408 return (y > static_cast<Real>(0)) ? x/y : val_;
414 prim_->applyBinary(PrunePositive(ROL_NINF<Real>()),p);
415 Real lowerBound1 =
prim_->reduce(Elementwise::ReductionMax<Real>());
418 prim_->applyBinary(PruneNegative(ROL_NINF<Real>()),p);
419 Real lowerBound2 =
prim_->reduce(Elementwise::ReductionMax<Real>());
421 Real lowerBound3 = std::max(lowerBound1, lowerBound2);
425 prim_->applyBinary(PrunePositive(ROL_INF<Real>()),p);
426 Real upperBound1 =
prim_->reduce(Elementwise::ReductionMin<Real>());
429 prim_->applyBinary(PruneNegative(ROL_INF<Real>()),p);
430 Real upperBound2 =
prim_->reduce(Elementwise::ReductionMin<Real>());
432 Real upperBound3 = std::min(upperBound1, upperBound2);
435 lowerBound = std::max(lowerBound3, -
TRradius_/pnorm);
436 upperBound = std::min(upperBound3,
TRradius_/pnorm);
441 Real tol = std::sqrt(ROL_EPSILON<Real>());
445 Real c2 =
static_cast<Real
>(0.5) *
hv_->dot(p.
dual());
447 Real c1 =
prim_->dot(p);
450 Real lval = (c2 * lowerBound + c1) * lowerBound;
451 Real rval = (c2 * upperBound + c1) * upperBound;
452 tau = (lval < rval) ? lowerBound : upperBound;
453 if (c2 > static_cast<Real>(0)) {
454 Real uncMin =
static_cast<Real
>(-0.5) * c1/c2;
455 tau = (uncMin > lowerBound && uncMin < upperBound) ? uncMin : tau;
459 return (c2 * tau + c1) * tau;
472 Real lowerBound(ROL_NINF<Real>()), upperBound(ROL_INF<Real>());
476 Real tau(1),
value(0);
490 class LowerBound :
public Elementwise::BinaryFunction<Real> {
492 Real
apply(
const Real &x,
const Real &y )
const {
493 return (x == y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
500 class UpperBound :
public Elementwise::BinaryFunction<Real> {
502 Real
apply(
const Real &x,
const Real &y )
const {
503 return (x == y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
515 class LowerBound :
public Elementwise::BinaryFunction<Real> {
517 Real
apply(
const Real &x,
const Real &y )
const {
518 return (x < y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
525 class UpperBound :
public Elementwise::BinaryFunction<Real> {
527 Real
apply(
const Real &x,
const Real &y )
const {
528 return (x > y) ?
static_cast<Real
>(-1) : static_cast<Real>(1);
541 class SafeDivide :
public Elementwise::BinaryFunction<Real> {
545 SafeDivide(
const Real val ) : val_(val) {}
546 Real
apply(
const Real &x,
const Real &y)
const {
548 return (y == zero) ? val_ : x/y;
554 lx_->axpy(-one, *xc);
555 lx_->applyBinary(SafeDivide(ROL_INF<Real>()), d);
559 ux_->axpy(-one, *xc);
560 ux_->applyBinary(SafeDivide(ROL_INF<Real>()), d);
563 lx_->applyBinary(Elementwise::Max<Real>(),*
ux_);
566 return lx_->reduce(Elementwise::ReductionMin<Real>());
572 class Greater :
public Elementwise::BinaryFunction<Real> {
575 Real
apply(
const Real &x,
const Real &y)
const {
576 return (x > y) ?
static_cast<Real
>(1) : static_cast<Real>(0);
581 Real lowerFeasible =
prim_->reduce(Elementwise::ReductionMin<Real>());
583 class Lesser :
public Elementwise::BinaryFunction<Real> {
586 Real
apply(
const Real &x,
const Real &y)
const {
587 return (x < y) ?
static_cast<Real
>(1) : static_cast<Real>(0);
592 Real upperFeasible =
prim_->reduce(Elementwise::ReductionMin<Real>());
594 return (upperFeasible * lowerFeasible > 0);
601 #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