44 #ifndef ROL_BINARY_CONSTRAINT_H 45 #define ROL_BINARY_CONSTRAINT_H 63 template <
typename T>
using RCP = Teuchos::RCP<T>;
81 class BoundsCheck :
public Elementwise::BinaryFunction<Real> {
91 Real
apply(
const Real &dl,
const Real &du )
const {
93 if( dl < ROL_INF<Real>() ) {
94 if( du < ROL_INF<Real>() ) {
96 case 0:
return dl*du;
break;
97 case 1:
return du-dl;
break;
98 case 2:
return -2.0;
break;
99 default:
return 0.0;
break;
104 case 0:
return dl;
break;
105 case 1:
return 1.0;
break;
106 case 2:
return 0.0;
break;
107 default:
return 0.0;
break;
112 if( du <ROL_INF<Real>() ) {
114 case 0:
return du;
break;
115 case 1:
return -1.0;
break;
116 case 2:
return 0.0;
break;
117 default:
return 0.0;
break;
131 lo_( lo ), up_( up ), d_( lo_->clone() ), gamma_( gamma ) {}
134 BinaryConstraint( bnd.getLowerVectorRCP(), bnd.getUpperVectorRCP(), gamma ) {}
137 BinaryConstraint( bnd->getLowerVectorRCP(), bnd->getUpperVectorRCP(), gamma ) {}
152 c.
axpy( -1.0, *lo_ );
176 Elementwise::Multiply<Real> mult;
179 jv.
axpy( -1.0, *lo_ );
203 Elementwise::Multiply<Real> mult;
206 ahuv.
axpy( -1.0, *lo_ );
215 ahuv.
scale( gamma_ );
228 #endif // ROL_BINARY_CONSTRAINT_H virtual void scale(const Real alpha)=0
Compute where .
Implements an equality constraint function that evaluates to zero on the surface of a bounded paralle...
void setPenalty(Real gamma)
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
void applyAdjointJacobian(V &ajv, const V &v, const V &x, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
Defines the linear algebra or vector space interface.
BinaryConstraint(const RCP< const BoundConstraint< Real >> &bnd, Real gamma)
Defines the equality constraint operator interface.
void value(V &c, const V &x, Real &tol)
Evaluate constraint .
Provides the interface to apply upper and lower bound constraints.
void applyAdjointHessian(V &ahuv, const V &u, const V &v, const V &x, Real &tol)
virtual void set(const Vector &x)
Set where .
void applyJacobian(V &jv, const V &v, const V &x, Real &tol)
BinaryConstraint(const BoundConstraint< Real > &bnd, Real gamma)
Real apply(const Real &dl, const Real &du) const
BinaryConstraint(const RCP< const V > &lo, const RCP< const V > &up, Real gamma)