44 #ifndef ROL_CONSTRAINT_MANAGER_H
45 #define ROL_CONSTRAINT_MANAGER_H
63 ROL::Ptr<Constraint<Real> >
con_;
64 ROL::Ptr<Vector<Real> >
l_;
65 ROL::Ptr<Vector<Real> >
x_;
66 ROL::Ptr<BoundConstraint<Real> >
bnd_;
68 std::vector<ROL::Ptr<Constraint<Real> > >
cvec_;
69 std::vector<ROL::Ptr<Vector<Real> > >
lvec_;
70 std::vector<ROL::Ptr<Vector<Real> > >
svec_;
71 std::vector<ROL::Ptr<BoundConstraint<Real> > >
sbnd_;
83 Real tol = std::sqrt(ROL_EPSILON<Real>());
84 con->value(*s,*x,tol);
94 int size =
static_cast<int>(cvec.size());
95 if ( size != static_cast<int>(lvec.size()) ) {
98 if ( size != static_cast<int>(bvec.size()) ) {
99 throw Exception::NotImplemented(
">>> ROL::ConstraintManager: Constraint and BoundConstraint vectors are different sizes!");
102 ROL::Ptr<BoundConstraint<Real> > bnd0;
103 if ( bnd == ROL::nullPtr ) {
104 bnd0 = ROL::makePtr<BoundConstraint<Real>>(*x);
114 int cnt = 1, cnt_con = 0;
117 for (
int i = 0; i < size; ++i) {
118 ROL::Ptr<Constraint<Real> > con = cvec[i];
119 ROL::Ptr<Vector<Real> > l = lvec[i];
120 ROL::Ptr<BoundConstraint<Real> > cbnd = bvec[i];
121 if (con != ROL::nullPtr) {
122 if ( con->isActivated() ) {
126 cvec_.push_back(con);
128 if (cbnd != ROL::nullPtr) {
129 if ( cbnd->isActivated() ) {
133 svec_.push_back(l->dual().clone());
136 sbnd_.push_back(cbnd);
151 l_ = ROL::makePtr<PartitionedVector<Real>>(
lvec_);
164 x_ = ROL::makePtr<PartitionedVector<Real>>(
svec_);
165 bnd_ = ROL::makePtr<BoundConstraint_Partitioned<Real>>(
sbnd_,
svec_);
190 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(cvec.size(),ROL::nullPtr);
200 std::vector<ROL::Ptr<Constraint<Real> > > cvec(1,con);
201 std::vector<ROL::Ptr<Vector<Real> > > lvec(1,l);
202 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(1,cbnd);
211 std::vector<ROL::Ptr<Constraint<Real> > > cvec(1,con);
212 std::vector<ROL::Ptr<Vector<Real> > > lvec(1,l);
213 std::vector<ROL::Ptr<BoundConstraint<Real> > > bvec(1,ROL::nullPtr);
243 int size =
static_cast<int>(
cvec_.size());
245 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_