10 #ifndef ROL_CONSTRAINT_MANAGER_H
11 #define ROL_CONSTRAINT_MANAGER_H
29 ROL::Ptr<Constraint<Real> >
con_;
30 ROL::Ptr<Vector<Real> >
l_;
31 ROL::Ptr<Vector<Real> >
x_;
32 ROL::Ptr<BoundConstraint<Real> >
bnd_;
34 std::vector<ROL::Ptr<Constraint<Real> > >
cvec_;
35 std::vector<ROL::Ptr<Vector<Real> > >
lvec_;
36 std::vector<ROL::Ptr<Vector<Real> > >
svec_;
37 std::vector<ROL::Ptr<BoundConstraint<Real> > >
sbnd_;
49 Real tol = std::sqrt(ROL_EPSILON<Real>());
50 con->value(*s,*x,tol);
60 int size =
static_cast<int>(cvec.size());
61 if ( size != static_cast<int>(lvec.size()) ) {
64 if ( size != static_cast<int>(bvec.size()) ) {
65 throw Exception::NotImplemented(
">>> ROL::ConstraintManager: Constraint and BoundConstraint vectors are different sizes!");
68 ROL::Ptr<BoundConstraint<Real> > bnd0;
69 if ( bnd == ROL::nullPtr ) {
70 bnd0 = ROL::makePtr<BoundConstraint<Real>>(*x);
80 int cnt = 1, cnt_con = 0;
83 for (
int i = 0; i < size; ++i) {
84 ROL::Ptr<Constraint<Real> > con = cvec[i];
85 ROL::Ptr<Vector<Real> > l = lvec[i];
86 ROL::Ptr<BoundConstraint<Real> > cbnd = bvec[i];
87 if (con != ROL::nullPtr) {
88 if ( con->isActivated() ) {
94 if (cbnd != ROL::nullPtr) {
95 if ( cbnd->isActivated() ) {
99 svec_.push_back(l->dual().clone());
102 sbnd_.push_back(cbnd);
117 l_ = ROL::makePtr<PartitionedVector<Real>>(
lvec_);
130 x_ = ROL::makePtr<PartitionedVector<Real>>(
svec_);
131 bnd_ = ROL::makePtr<BoundConstraint_Partitioned<Real>>(
sbnd_,
svec_);
156 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(cvec.size(),ROL::nullPtr);
166 std::vector<ROL::Ptr<Constraint<Real> > > cvec(1,con);
167 std::vector<ROL::Ptr<Vector<Real> > > lvec(1,l);
168 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(1,cbnd);
177 std::vector<ROL::Ptr<Constraint<Real> > > cvec(1,con);
178 std::vector<ROL::Ptr<Vector<Real> > > lvec(1,l);
179 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(1,ROL::nullPtr);
209 int size =
static_cast<int>(
cvec_.size());
211 for (
int i = 0; i < size; ++i) {
ConstraintManager(const std::vector< ROL::Ptr< Constraint< Real > > > &cvec, const std::vector< ROL::Ptr< Vector< Real > > > &lvec, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< BoundConstraint< Real > > &bnd=ROL::nullPtr)
std::vector< ROL::Ptr< Vector< Real > > > lvec_
ROL::Ptr< Vector< Real > > l_
std::vector< ROL::Ptr< Vector< Real > > > svec_
virtual ~ConstraintManager(void)
void initializeSlackVariable(const ROL::Ptr< Constraint< Real > > &con, const ROL::Ptr< BoundConstraint< Real > > &cbnd, const ROL::Ptr< Vector< Real > > &s, const ROL::Ptr< Vector< Real > > &x) const
const ROL::Ptr< Vector< Real > > getMultiplier(void) const
Defines the linear algebra or vector space interface.
const ROL::Ptr< Vector< Real > > getOptVector(void) const
void resetSlackVariables(void)
const ROL::Ptr< Constraint< Real > > getConstraint(void) const
ROL::Ptr< BoundConstraint< Real > > bnd_
ROL::Ptr< Constraint< Real > > con_
ConstraintManager(const ROL::Ptr< Constraint< Real > > &con, const ROL::Ptr< Vector< Real > > &l, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< BoundConstraint< Real > > &bnd=ROL::nullPtr)
Provides a wrapper for multiple constraints.
void initialize(const std::vector< ROL::Ptr< Constraint< Real > > > &cvec, const std::vector< ROL::Ptr< Vector< Real > > > &lvec, const std::vector< ROL::Ptr< BoundConstraint< Real > > > &bvec, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< BoundConstraint< Real > > &bnd)
const ROL::Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
Provides the interface to apply upper and lower bound constraints.
std::vector< ROL::Ptr< Constraint< Real > > > cvec_
std::vector< ROL::Ptr< BoundConstraint< Real > > > sbnd_
ConstraintManager(const ROL::Ptr< Constraint< Real > > &con, const ROL::Ptr< Vector< Real > > &l, const ROL::Ptr< BoundConstraint< Real > > &cbnd, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< BoundConstraint< Real > > &bnd=ROL::nullPtr)
ConstraintManager(const std::vector< ROL::Ptr< Constraint< Real > > > &cvec, const std::vector< ROL::Ptr< Vector< Real > > > &lvec, const std::vector< ROL::Ptr< BoundConstraint< Real > > > &bvec, const ROL::Ptr< Vector< Real > > &x, const ROL::Ptr< BoundConstraint< Real > > &bnd=ROL::nullPtr)
Defines the general constraint operator interface.
bool hasInequality(void) const
std::vector< bool > isInequality_
ROL::Ptr< Vector< Real > > x_