44 #ifndef ROL_CONSTRAINTS_H 45 #define ROL_CONSTRAINTS_H 60 std::vector<Teuchos::RCP<BoundConstraint<Real> > >
ic_;
61 std::vector<Teuchos::RCP<EqualityConstraint<Real> > >
ec_;
108 for (
unsigned i=0; i<this->ic_.size(); i++) {
110 this->ic_[i]->update(x, flag, iter);
119 for (
unsigned i=0; i<this->ic_.size(); i++) {
121 this->ic_[i]->project(x);
126 for (
unsigned i=0; i<this->ic_.size(); i++) {
128 this->ic_[i]->pruneUpperActive(v, g, x, eps);
133 for (
unsigned i=0; i<this->ic_.size(); i++) {
135 this->ic_[i]->pruneLowerActive(v, g, x, eps);
140 for (
unsigned i=0; i<this->ic_.size(); i++) {
142 this->ic_[i]->pruneUpperActive(v, x, eps);
147 for (
unsigned i=0; i<this->ic_.size(); i++) {
149 this->ic_[i]->pruneLowerActive(v, x, eps);
155 this->ic_[0]->setVectorToUpperBound(u);
160 this->ic_[0]->setVectorToLowerBound(l);
171 for (
unsigned i=0; i<this->ic_.size(); i++) {
173 this->ic_[i]->pruneActive(v, g, x, eps);
184 for (
unsigned i=0; i<this->ic_.size(); i++) {
186 this->ic_[i]->pruneActive(v, x, eps);
195 for (
unsigned i=0; i<this->ic_.size(); i++) {
197 iFeas = iFeas && (this->ic_[i]->isFeasible(v));
210 for (
unsigned i=0; i<size(this->ec_.size()); i++) {
212 this->ec_[i]->value(*(c[i]), x, tol[i]);
217 for (
unsigned i=0; i<size(this->ic_.size()); i++) {
219 this->ic_[i]->value(*(c[i]), x, tol[i]);
235 std::vector<Real> &tol) {
237 for (
unsigned i=0; i<size(this->ec_.size()); i++) {
239 this->ec_[i]->applyJacobian(*(jv[i]), *(v[i]), x, adj, tol[i]);
244 for (
unsigned i=0; i<size(this->ic_.size()); i++) {
246 this->ic_[i]->applyJacobian(*(jv[i]), *(v[i]), x, adj, tol[i]);
262 std::vector<Real> &tol) {
264 for (
unsigned i=0; i<size(this->ec_.size()); i++) {
266 this->ec_[i]->maptoJacobianKernel(*(wv[i]), *(v[i]), x, tol[i]);
271 for (
unsigned i=0; i<size(this->ic_.size()); i++) {
273 this->ic_[i]->maptoJacobianKernel(*(wv[i]), *(v[i]), x, tol[i]);
289 std::vector<Real> &tol) {
291 for (
unsigned i=0; i<size(this->ec_.size()); i++) {
293 this->ec_[i]->applyHessian(*(huv[i]), *(u[i]), *(v[i]), x, tol[i]);
298 for (
unsigned i=0; i<size(this->ic_.size()); i++) {
300 this->ic_[i]->applyHessian(*(huv[i]), *(u[i]), *(v[i]), x, tol[i]);
314 Teuchos::RCP<Vector<Real> > tmp = x.
clone();
326 Teuchos::RCP<Vector<Real> > tmp = x.
clone();
337 Teuchos::RCP<Vector<Real> > tmp = g.
clone();
void value(std::vector< Teuchos::RCP< Vector< Real > > > &c, const Vector< Real > &x, const EConstraint &ctype, std::vector< Real > &tol)
Evaluate constraints: either for all activated equality constraints or for all activated inequality c...
std::vector< Teuchos::RCP< EqualityConstraint< Real > > > ec_
void pruneActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Remove active set variables that are also in the binding set. v is the vector to be pruned g is the g...
virtual void plus(const Vector &x)=0
Compute , where .
void computeProjectedStep(Vector< Real > &v, const Vector< Real > &x)
Compute projected step P(x+v)-x. v is the step vector x is the optimization variables.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Constraints(std::vector< Teuchos::RCP< BoundConstraint< Real > > > &ic)
void deactivate(void)
Turn off constraints.
Contains definitions of custom data types in ROL.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Constraints(Teuchos::RCP< BoundConstraint< Real > > &ic, std::vector< Teuchos::RCP< EqualityConstraint< Real > > > &ec)
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void computeProjectedGradient(Vector< Real > &g, const Vector< Real > &x)
Compute projected gradient. g is the gradient of the objective function at x x is the optimization va...
Defines the linear algebra or vector space interface.
std::vector< Teuchos::RCP< BoundConstraint< Real > > > ic_
void setVectorToLowerBound(Vector< Real > &l)
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Constraints(std::vector< Teuchos::RCP< EqualityConstraint< Real > > > &ec)
Constraints(std::vector< Teuchos::RCP< BoundConstraint< Real > > > &ic, std::vector< Teuchos::RCP< EqualityConstraint< Real > > > &ec)
Defines the equality constraint operator interface.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Remove active set variables. v is the vector to be pruned x is the optimization variable eps is the a...
void pruneInactive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
Remove the inactive set variables. v is the vector to be pruned x is the optimization variable eps is...
void project(Vector< Real > &x)
Project optimization variables onto constraint set. x is the optimization variable.
void applyJacobian(std::vector< Teuchos::RCP< Vector< Real > > > &jv, std::vector< Teuchos::RCP< const Vector< Real > > > &v, const Vector< Real > &x, const bool &adj, const EConstraint &ctype, std::vector< Real > &tol)
Apply constraint Jacobians or their adjoints: either for all activated equality constraints or for al...
bool isActivated(void)
Check if constraints are on.
Constraints(Teuchos::RCP< BoundConstraint< Real > > &ic, Teuchos::RCP< EqualityConstraint< Real > > &ec)
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps=0.0)
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Provides the interface to apply upper and lower bound constraints.
Constraints(Teuchos::RCP< BoundConstraint< Real > > &ic)
Constraints(Teuchos::RCP< EqualityConstraint< Real > > &ec)
void pruneInactive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps=0.0)
Remove the inactive set variables that are not in the binding set. v is the vector to be pruned g is ...
void setVectorToUpperBound(Vector< Real > &u)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update constraint functions. x is the optimization variable, flag = true if x is changed, iter is the outer algorithm iterations count.
Constraints(std::vector< Teuchos::RCP< BoundConstraint< Real > > > &ic, Teuchos::RCP< EqualityConstraint< Real > > &ec)
void maptoJacobianKernel(std::vector< Teuchos::RCP< Vector< Real > > > &wv, std::vector< Teuchos::RCP< const Vector< Real > > > &v, const Vector< Real > &x, const EConstraint &ctype, std::vector< Real > &tol)
Compute the action of the operators W that are onto the null space (kernel) of the contraint Jacobian...
void activate(void)
Turn on constraints.
EConstraint
Enumeration of constraint types.
bool isFeasible(const Vector< Real > &v)
Check if the vector, v, is feasible.
void applyHessian(std::vector< Teuchos::RCP< Vector< Real > > > &huv, std::vector< Teuchos::RCP< const Vector< Real > > > &u, std::vector< Teuchos::RCP< const Vector< Real > > > &v, const Vector< Real > &x, const EConstraint &ctype, std::vector< Real > &tol)
Apply constraint Hessians to (v,u), c''(x)(v,u) = (c''(x)u)v: either for all activated equality const...