44 #ifndef ROL_INTERIORPOINTPENALTY_H 45 #define ROL_INTERIORPOINTPENALTY_H 72 const Teuchos::RCP<OBJ>
obj_;
73 const Teuchos::RCP<BND>
bnd_;
74 const Teuchos::RCP<V>
lo_;
75 const Teuchos::RCP<V>
up_;
104 return (x>0) ? std::log(x) : Real(0.0);
113 return (x>0) ? 1.0/x : Real(0.0);
122 Real
apply(
const Real &x,
const Real &y )
const {
123 return (x>0) ? y/x : Real(0.0);
131 class Mask :
public Elementwise::BinaryFunction<Real> {
135 Mask(
bool complement ) : complement_(complement) {}
136 Real
apply(
const Real &x,
const Real &y )
const {
137 return ( complement_ ^ (y !=0) ) ? 0 : x;
148 Teuchos::ParameterList &parlist ) :
149 obj_(obj), bnd_(con), lo_( con->getLowerVectorRCP() ), up_( con->getUpperVectorRCP() ) {
155 ValueSet isBoundedBelow( ROL_NINF<Real>(), ValueSet::GREATER_THAN, one, zero );
156 ValueSet isBoundedAbove( ROL_INF<Real>(), ValueSet::LESS_THAN, one, zero );
158 maskL_ = lo_->clone();
159 maskU_ = up_->clone();
161 maskL_->applyBinary(isBoundedBelow,*lo_);
162 maskU_->applyBinary(isBoundedAbove,*up_);
164 Teuchos::ParameterList &iplist = parlist.sublist(
"Step").sublist(
"Primal Dual Interior Point");
165 Teuchos::ParameterList &lblist = iplist.sublist(
"Barrier Objective");
167 useLinearDamping_ = lblist.get(
"Use Linear Damping",
true);
168 kappaD_ = lblist.get(
"Linear Damping Coefficient",1.e-4);
169 mu_ = lblist.get(
"Initial Barrier Parameter",0.1);
174 g_ = lo_->dual().clone();
176 if( useLinearDamping_ ) {
213 obj_->update(x,flag,iter);
214 bnd_->update(x,flag,iter);
231 Elementwise::ReductionSum<Real> sum;
232 Elementwise::Multiply<Real> mult;
235 fval_ = obj_->value(x,tol);
239 Real linearTerm = 0.0;
244 if( useLinearDamping_ ) {
248 c_->applyBinary(
Mask(
true),*maskU_);
250 c_->applyBinary(mult,*a_);
253 linearTerm += c_->reduce(sum);
256 a_->applyUnary(mlog);
258 Real aval = a_->dot(*maskL_);
263 if( useLinearDamping_ ) {
267 c_->applyBinary(
Mask(
true),*maskL_);
269 c_->applyBinary(mult,*b_);
273 linearTerm += c_->reduce(sum);
277 b_->applyUnary(mlog);
279 Real bval = b_->dot(*maskU_);
282 fval -= mu_*(aval+bval);
283 fval += kappaD_*mu_*linearTerm;
299 obj_->gradient(*g_,x,tol);
309 a_->applyUnary(mrec);
310 a_->applyBinary(
Mask(
true),*maskL_);
314 b_->applyUnary(mrec);
315 b_->applyBinary(
Mask(
true),*maskU_);
320 if( useLinearDamping_ ) {
323 a_->applyBinary(
Mask(
true),*maskU_);
326 b_->applyBinary(
Mask(
true),*maskL_);
328 g.
axpy(-mu_*kappaD_,*a_);
329 g.
axpy( mu_*kappaD_,*b_);
346 Elementwise::Multiply<Real> mult;
347 Elementwise::Power<Real> square(2.0);
349 obj_->hessVec(hv,v,x,tol);
353 a_->applyUnary(mrec);
354 a_->applyBinary(
Mask(
true),*maskL_);
355 a_->applyUnary(square);
357 a_->applyBinary(mult,v);
361 b_->applyUnary(mrec);
362 b_->applyBinary(
Mask(
true),*maskU_);
363 b_->applyUnary(square);
365 b_->applyBinary(mult,v);
382 #endif // ROL_INTERIORPOINTPENALTY_H Provides the interface to evaluate objective functions.
const Teuchos::RCP< V > lo_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update the interior point penalized objective.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Defines the linear algebra or vector space interface.
int getNumberGradientEvaluations(void) const
const Teuchos::RCP< OBJ > obj_
Real apply(const Real &x, const Real &y) const
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Compute action of Hessian on vector.
Real getObjectiveValue(void) const
Provides the interface to evaluate the Interior Pointy log barrier penalty function with upper and lo...
BoundConstraint< Real > BND
Real apply(const Real &x, const Real &y) const
Teuchos::RCP< const Vector< Real > > getLowerMask(void) const
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
Teuchos::RCP< Vector< Real > > getGradient(void) const
const Teuchos::RCP< BND > bnd_
Provides the interface to apply upper and lower bound constraints.
int getNumberFunctionEvaluations(void) const
const Teuchos::RCP< V > up_
virtual void set(const Vector &x)
Set where .
Real apply(const Real &x) const
Teuchos::RCP< const Vector< Real > > getUpperMask(void) const
Real apply(const Real &x) const
Elementwise::ValueSet< Real > ValueSet
InteriorPointPenalty(const Teuchos::RCP< Objective< Real > > &obj, const Teuchos::RCP< BoundConstraint< Real > > &con, Teuchos::ParameterList &parlist)
const Teuchos::RCP< BND > getBoundConstraint(void)
const Teuchos::RCP< OBJ > getObjective(void)