44#ifndef ROL_CONSTRAINT_ASSEMBLER_DEF_H
45#define ROL_CONSTRAINT_ASSEMBLER_DEF_H
49template<
typename Real>
56 con->value(*s,*x,tol);
60template<
typename Real>
66 Ptr<BoundConstraint<Real>> bnd0;
67 if ( bnd == nullPtr ) {
68 bnd0 = makePtr<BoundConstraint<Real>>(*xprim);
80 int cnt = 1, cnt_con = 0;
83 for (
auto it = input_con.begin(); it != input_con.end(); ++it) {
84 Ptr<Constraint<Real>> con = it->second.constraint;
85 Ptr<Vector<Real>> l = it->second.multiplier;
86 Ptr<Vector<Real>> r = it->second.residual;
87 Ptr<BoundConstraint<Real>> cbnd = it->second.bounds;
89 if ( con->isActivated() ) {
96 if (cbnd != nullPtr) {
97 if ( cbnd->isActivated() ) {
101 psvec_.push_back(r->clone());
102 dsvec_.push_back(l->clone());
105 sbnd_.push_back(cbnd);
120 mul_ = makePtr<PartitionedVector<Real>>(
lvec_);
121 res_ = makePtr<PartitionedVector<Real>>(
rvec_);
147template<
typename Real>
154 Ptr<BoundConstraint<Real>> bnd0;
155 if ( bnd == nullPtr ) {
156 bnd0 = makePtr<BoundConstraint<Real>>(*xprim);
169 int cnt = 1, cnt_con = 0, cnt_lcon = 0;
172 for (
auto it = input_con.begin(); it != input_con.end(); ++it) {
173 Ptr<Constraint<Real>> con = it->second.constraint;
174 Ptr<Vector<Real>> l = it->second.multiplier;
175 Ptr<Vector<Real>> r = it->second.residual;
176 Ptr<BoundConstraint<Real>> cbnd = it->second.bounds;
177 if (con != nullPtr) {
178 if ( con->isActivated() ) {
182 cvec_.push_back(con);
185 if (cbnd != nullPtr) {
186 if ( cbnd->isActivated() ) {
190 psvec_.push_back(r->clone());
191 dsvec_.push_back(l->clone());
194 sbnd_.push_back(cbnd);
205 for (
auto it = input_lcon.begin(); it != input_lcon.end(); ++it) {
206 Ptr<Constraint<Real>> con = it->second.constraint;
207 Ptr<Vector<Real>> l = it->second.multiplier;
208 Ptr<Vector<Real>> r = it->second.residual;
209 Ptr<BoundConstraint<Real>> cbnd = it->second.bounds;
210 if (con != nullPtr) {
211 if ( con->isActivated() ) {
218 if (cbnd != nullPtr) {
219 if ( cbnd->isActivated() ) {
223 psvec_.push_back(r->clone());
224 dsvec_.push_back(l->clone());
227 sbnd_.push_back(cbnd);
242 mul_ = makePtr<PartitionedVector<Real>>(
lvec_);
243 res_ = makePtr<PartitionedVector<Real>>(
rvec_);
282template<
typename Real>
291template<
typename Real>
301template<
typename Real>
306template<
typename Real>
311template<
typename Real>
316template<
typename Real>
321template<
typename Real>
326template<
typename Real>
331template<
typename Real>
336template<
typename Real>
341template<
typename Real>
346template<
typename Real>
351template<
typename Real>
356template<
typename Real>
359 int size =
static_cast<int>(
cvec_.size());
361 for (
int i = 0; i < size; ++i) {
368 size =
static_cast<int>(
lcvec_.size());
369 for (
int i = 0; i < size; ++i) {
Provides the interface to apply upper and lower bound constraints.
std::vector< Ptr< Vector< Real > > > lvec_
void initializeSlackVariable(const Ptr< Constraint< Real > > &con, const Ptr< BoundConstraint< Real > > &cbnd, const Ptr< Vector< Real > > &s, const Ptr< Vector< Real > > &x) const
const Ptr< Constraint< Real > > & getLinearConstraint() const
std::vector< bool > isInequality_
void initialize(const std::unordered_map< std::string, ConstraintData< Real > > &input_con, const Ptr< Vector< Real > > &xprim, const Ptr< Vector< Real > > &xdual, const Ptr< BoundConstraint< Real > > &bnd)
ConstraintAssembler(const std::unordered_map< std::string, ConstraintData< Real > > &con, const Ptr< Vector< Real > > &xprim, const Ptr< Vector< Real > > &xdual, const Ptr< BoundConstraint< Real > > &bnd=nullPtr)
Ptr< Constraint< Real > > con_
Ptr< BoundConstraint< Real > > bnd_
void resetSlackVariables()
std::vector< Ptr< Vector< Real > > > psvec_
std::vector< Ptr< Constraint< Real > > > cvec_
Ptr< Vector< Real > > mul_
Ptr< Constraint< Real > > linear_con_
const Ptr< Vector< Real > > & getMultiplier() const
std::vector< Ptr< Vector< Real > > > dsvec_
std::vector< bool > isLinearInequality_
const Ptr< Vector< Real > > & getLinearResidual() const
const Ptr< Vector< Real > > & getDualOptVector() const
Ptr< Vector< Real > > linear_mul_
std::vector< Ptr< Vector< Real > > > rvec_
Ptr< Vector< Real > > xdual_
const Ptr< BoundConstraint< Real > > & getBoundConstraint() const
std::vector< Ptr< Vector< Real > > > llvec_
Ptr< Vector< Real > > linear_res_
Ptr< Vector< Real > > xprim_
std::vector< Ptr< BoundConstraint< Real > > > sbnd_
const Ptr< Constraint< Real > > & getConstraint() const
const Ptr< Vector< Real > > & getLinearMultiplier() const
Ptr< Vector< Real > > res_
std::vector< Ptr< Vector< Real > > > lrvec_
const Ptr< Vector< Real > > & getOptVector() const
bool hasInequality() const
std::vector< Ptr< Constraint< Real > > > lcvec_
const Ptr< Vector< Real > > & getResidual() const
Defines the general constraint operator interface.
Defines the linear algebra or vector space interface.
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.