35 #ifndef ROL_OBJECTIVE_FROM_BOUND_CONSTRAINT_H 36 #define ROL_OBJECTIVE_FROM_BOUND_CONSTRAINT_H 41 #include "Teuchos_ParameterList.hpp" 56 typedef Elementwise::Axpy<Real>
Axpy;
57 typedef Elementwise::Aypx<Real>
Aypx;
58 typedef Elementwise::Scale<Real>
Scale;
60 typedef Elementwise::Power<Real>
Power;
66 typedef Elementwise::ReductionSum<Real>
Sum;
79 std::string retString;
82 retString =
"Logarithmic";
85 retString =
"Quadratic";
88 retString =
"Double Well";
91 retString =
"Last Type (Dummy)";
94 retString =
"Invalid EBarrierType";
116 const Teuchos::RCP<const V>
lo_;
117 const Teuchos::RCP<const V>
up_;
125 Teuchos::ParameterList &parlist ) :
126 lo_( bc.getLowerVectorRCP() ),
127 up_( bc.getUpperVectorRCP() ) {
132 std::string bfstring = parlist.sublist(
"Barrier Function").get(
"Type",
"Logarithmic");
137 lo_( bc.getLowerVectorRCP() ),
138 up_( bc.getUpperVectorRCP() )
147 Teuchos::RCP<UnaryFunction> func;
153 a_->applyBinary(
Aypx(-1.0),x);
155 a_->applyUnary(
Scale(-1.0));
158 b_->applyBinary(
Aypx(-1.0),*up_);
160 b_->applyUnary(
Scale(-1.0));
169 a_->applyBinary(
Aypx(-1.0),x);
171 a_->applyUnary(
Power(2.0));
174 b_->applyBinary(
Aypx(-1.0),x);
176 b_->applyUnary(
Power(2.0));
185 a_->applyBinary(
Aypx(-1.0),x);
186 a_->applyUnary(
Power(2.0));
189 b_->applyBinary(
Aypx(-1.0),*up_);
190 b_->applyUnary(
Power(2.0));
197 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
198 ">>>(ObjectiveFromBoundConstraint::value): Undefined barrier function type!");
203 Real result = b_->reduce(
Sum());
214 a_->applyBinary(
Aypx(-1.0),x);
216 a_->applyUnary(
Scale(-1.0));
219 b_->applyBinary(
Aypx(-1.0),*up_);
229 a_->applyBinary(
Aypx(-1.0),x);
233 b_->applyBinary(
Aypx(-1.0),x);
243 a_->applyBinary(
Aypx(-1.0),x);
246 b_->applyBinary(
Aypx(-1.0),*up_);
248 a_->applyBinary(
Aypx(-1.0),*b_);
249 a_->applyUnary(
Scale(2.0));
252 b_->applyBinary(
Aypx(-1.0),*up_);
258 b_->applyBinary(
Aypx(-1.0),x);
264 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
265 ">>>(ObjectiveFromBoundConstraint::gradient): Undefined barrier function type!");
280 a_->applyBinary(
Axpy(-1.0),x);
282 a_->applyUnary(
Power(2.0));
285 b_->applyBinary(
Axpy(-1.0),*up_);
287 b_->applyUnary(
Power(2.0));
296 a_->applyBinary(
Axpy(-1.0),x);
301 b_->applyBinary(
Axpy(-1.0),x);
311 a_->applyBinary(
Axpy(-1.0),x);
314 b_->applyBinary(
Axpy(-1.0),*up_);
317 b_->applyUnary(
Scale(-8.0));
319 a_->applyUnary(
Power(2.0));
320 a_->applyUnary(
Scale(2.0));
322 b_->applyBinary(
Axpy(1.0),*a_);
325 a_->applyBinary(
Axpy(-1.0),*up_);
326 a_->applyUnary(
Power(2.0));
327 a_->applyUnary(
Scale(2.0));
335 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
336 ">>>(ObjectiveFromBoundConstraint::hessVec): Undefined barrier function type!");
357 #endif // ROL_OBJECTIVE_FROM_BOUND_CONSTRAINT_H Provides the interface to evaluate objective functions.
const Teuchos::RCP< const V > up_
virtual void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector &x)
Elementwise::Multiply< Real > Multiply
std::string removeStringFormat(std::string s)
Elementwise::ThresholdUpper< Real > ThresholdUpper
Elementwise::Logarithm< Real > Logarithm
ObjectiveFromBoundConstraint(const BoundConstraint< Real > &bc)
Elementwise::Power< Real > Power
Defines the linear algebra or vector space interface.
Teuchos::RCP< Vector< Real > > getBarrierVector(void)
Elementwise::Scale< Real > Scale
Elementwise::ReductionSum< Real > Sum
enum ROL::ObjectiveFromBoundConstraint::EBarrierType eBarrierType_
std::string EBarrierToString(EBarrierType type)
ObjectiveFromBoundConstraint(const BoundConstraint< Real > &bc, Teuchos::ParameterList &parlist)
Elementwise::UnaryFunction< Real > UnaryFunction
Elementwise::Aypx< Real > Aypx
EBarrierType StringToEBarrierType(std::string s)
Elementwise::Reciprocal< Real > Reciprocal
Provides the interface to apply upper and lower bound constraints.
Elementwise::Heaviside< Real > Heaviside
Real value(const Vector< Real > &x, Real &tol)
Compute value.
Elementwise::Axpy< Real > Axpy
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual void set(const Vector &x)
Set where .
const Teuchos::RCP< const V > lo_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Elementwise::ThresholdLower< Real > ThresholdLower
Create a penalty objective from upper and lower bound vectors.