49 #ifndef ROL_STDBOUNDCONSTRAINT_HPP 50 #define ROL_STDBOUNDCONSTRAINT_HPP 69 for (
int i = 0; i <
dim_; i++ ) {
81 Teuchos::RCP<const std::vector<Real> > ex =
85 for (
int i = 0; i < this->
dim_; i++ ) {
86 if ( (*ex)[i] >= this->x_lo_[i] && (*ex)[i] <= this->x_up_[i] ) { cnt *= 1; }
89 if ( cnt == 0 ) { val =
false; }
94 Teuchos::RCP<std::vector<Real> > ex =
95 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(x)).getVector());
96 for (
int i = 0; i < this->
dim_; i++ ) {
97 (*ex)[i] = std::max(this->x_lo_[i],std::min(this->x_up_[i],(*ex)[i]));
102 Teuchos::RCP<const std::vector<Real> > ex =
104 Teuchos::RCP<std::vector<Real> > ev =
105 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
106 Real epsn = std::min(
scale_*eps,this->min_diff_);
107 for (
int i = 0; i < this->
dim_; i++ ) {
108 if ( ((*ex)[i] <= this->x_lo_[i]+epsn) ) {
115 Teuchos::RCP<const std::vector<Real> > ex =
117 Teuchos::RCP<std::vector<Real> > ev =
118 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
119 Real epsn = std::min(
scale_*eps,this->min_diff_);
120 for (
int i = 0; i < this->
dim_; i++ ) {
121 if ( ((*ex)[i] >= this->x_up_[i]-epsn) ) {
128 Teuchos::RCP<const std::vector<Real> > ex =
130 Teuchos::RCP<std::vector<Real> > ev =
131 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
132 Real epsn = std::min(
scale_*eps,this->min_diff_);
133 for (
int i = 0; i < this->
dim_; i++ ) {
134 if ( ((*ex)[i] <= this->x_lo_[i]+epsn) ||
135 ((*ex)[i] >= this->x_up_[i]-epsn) ) {
142 Teuchos::RCP<const std::vector<Real> > ex =
144 Teuchos::RCP<const std::vector<Real> > eg =
146 Teuchos::RCP<std::vector<Real> > ev =
147 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
148 Real epsn = std::min(
scale_*eps,this->min_diff_);
149 for (
int i = 0; i < this->
dim_; i++ ) {
150 if ( ((*ex)[i] <= this->x_lo_[i]+epsn && (*eg)[i] > 0.0) ) {
157 Teuchos::RCP<const std::vector<Real> > ex =
159 Teuchos::RCP<const std::vector<Real> > eg =
161 Teuchos::RCP<std::vector<Real> > ev =
162 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
163 Real epsn = std::min(
scale_*eps,this->min_diff_);
164 for (
int i = 0; i < this->
dim_; i++ ) {
165 if ( ((*ex)[i] >= this->x_up_[i]-epsn && (*eg)[i] < 0.0) ) {
172 Teuchos::RCP<const std::vector<Real> > ex =
174 Teuchos::RCP<const std::vector<Real> > eg =
176 Teuchos::RCP<std::vector<Real> > ev =
177 Teuchos::rcp_const_cast<std::vector<Real> >((Teuchos::dyn_cast<
StdVector<Real> >(v)).getVector());
178 Real epsn = std::min(
scale_*eps,this->min_diff_);
179 for (
int i = 0; i < this->
dim_; i++ ) {
180 if ( ((*ex)[i] <= this->x_lo_[i]+epsn && (*eg)[i] > 0.0) ||
181 ((*ex)[i] >= this->x_up_[i]-epsn && (*eg)[i] < 0.0) ) {
188 Teuchos::RCP<std::vector<Real> > us = Teuchos::rcp(
new std::vector<Real>(this->dim_,0.0) );
189 us->assign(this->x_up_.begin(),this->x_up_.end());
195 Teuchos::RCP<std::vector<Real> > ls = Teuchos::rcp(
new std::vector<Real>(this->dim_,0.0) );
196 ls->assign(this->x_lo_.begin(),this->x_lo_.end());
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the upper -binding set.
void pruneActive(Vector< Real > &v, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the -active set.
std::vector< Real > x_lo_
Defines the linear algebra or vector space interface.
StdBoundConstraint(std::vector< Real > &l, std::vector< Real > &u, Real scale=1.0)
void setVectorToLowerBound(ROL::Vector< Real > &l)
Set the input vector to the lower bound.
void project(Vector< Real > &x)
Project optimization variables onto the bounds.
void pruneUpperActive(Vector< Real > &v, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the upper -active set.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the lower -active set.
void pruneActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the -binding set.
void setVectorToUpperBound(ROL::Vector< Real > &u)
Set the input vector to the upper bound.
Provides the interface to apply upper and lower bound constraints.
void pruneLowerActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x, Real eps)
Set variables to zero if they correspond to the lower -binding set.
bool isFeasible(const Vector< Real > &x)
Check if the vector, v, is feasible.
virtual void set(const Vector &x)
Set where .
std::vector< Real > x_up_