本文整理汇总了C++中BitSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ BitSet::end方法的具体用法?C++ BitSet::end怎么用?C++ BitSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitSet
的用法示例。
在下文中一共展示了BitSet::end方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// populates el (assumed to be pre-allocated adequately by caller)
// with list of members in bitset bs.
static SB_INLINE void bitset_get_list_here(BitSet& bs, uint32_t *el) {
int j = 0;
BitSet::iterator i;
for(i = bs.begin(); i != bs.end(); i++) {
el[j] = *i;
j++;
}
}
示例2: int
static SB_INLINE void bitset_iter(BitSet& bs, int (*app)(uint32_t e, void* stuff1), void* stuff2) {
BitSet::iterator i;
for(i = bs.begin(); i != bs.end(); i++) {
if((app(*i, stuff2)) != 0) {
break;
}
}
}
示例3: sys
FncKhunTucker::FncKhunTucker(const NormalizedSystem& sys, Function& _df, Function** _dg, const IntervalVector& current_box, const BitSet& active) :
Fnc(1,1), nb_mult(0), // **tmp**
n(sys.nb_var), sys(sys), df(_df), dg(active.size()), active(active),
eq(BitSet::empty(sys.f_ctrs.image_dim())),
ineq(BitSet::empty(sys.f_ctrs.image_dim())),
bound_left(BitSet::empty(sys.nb_var)),
bound_right(BitSet::empty(sys.nb_var)) {
int l=1; // lambda0
if (_dg==NULL && !active.empty()) {
ibex_error("[FncKhunTucker] an unconstrained system cannot have active constraints");
}
unsigned int i=0; // index of a constraint in the active set
for (BitSet::const_iterator c=active.begin(); c!=active.end(); ++c, ++i) {
dg.set_ref(i,*_dg[c]);
if (sys.ops[c]==EQ) eq.add(i);
else ineq.add(i);
//cout << " constraint n°" << c << " active\n";
}
l+=active.size();
for (int j=0; j<sys.box.size(); j++) {
if (current_box[j].lb() <= sys.box[j].lb()) {
bound_left.add(j);
//cout << " left bound n°" << j << " active\n";
l++;
}
if (current_box[j].ub() >= sys.box[j].ub()) {
bound_right.add(j);
//cout << " right bound n°" << j << " active\n";
l++;
}
}
(int&) nb_mult = l;
(int&) _nb_var = n + l;
assert(_nb_var == sys.nb_var + eq.size() + ineq.size() + bound_left.size() + bound_right.size() + 1);
(Dim&) _image_dim = Dim(_nb_var, 1);
}
示例4: return
// returns TRUE if bs contains member, FALSE otherwise
static SB_INLINE bool bitset_member(BitSet& bs, uint32_t member) {
return (bs.find(member) == bs.end());
}
示例5: linearize
int LinearizerDuality::linearize(const IntervalVector& box, LPSolver& lp_solver, BoxProperties& prop) {
// ========= get active constraints ===========
/* Using system cache seems not interesting. */
//BxpSystemCache* cache=(BxpSystemCache*) prop[BxpSystemCache::get_id(sys)];
BxpSystemCache* cache=NULL;
//--------------------------------------------------------------------------
BitSet* active;
if (cache!=NULL) {
active = &cache->active_ctrs();
} else {
active = new BitSet(sys.active_ctrs(box));
}
// ============================================
size_t n = sys.nb_var;
size_t m = sys.f_ctrs.image_dim();
size_t n_total = n + m*n;
int nb_ctr=0; // number of inequalities added in the LP solver
// BxpLinearRelaxArgMin* argmin=(BxpLinearRelaxArgMin*) prop[BxpLinearRelaxArgMin::get_id(sys)];
//
// if (argmin && argmin->argmin()) {
// pt=*argmin->argmin();
// } else
pt=box.mid();
if (!active->empty()) {
//IntervalMatrix J=cache? cache->active_ctrs_jacobian() : sys.f_ctrs.jacobian(box,active);
//IntervalMatrix J=sys.f_ctrs.jacobian(box,*active);
IntervalMatrix J(active->size(),n); // derivatives over the box
sys.f_ctrs.hansen_matrix(box,pt,J,*active);
if (J.is_empty()) {
if (cache==NULL) delete active;
return -1;
}
// the evaluation of the constraints in the point
IntervalVector gx(sys.f_ctrs.eval_vector(pt,*active));
if (gx.is_empty()) {
if (cache==NULL) delete active;
return 0;
}
int i=0; // counter of active constraints
for (BitSet::iterator c=active->begin(); c!=active->end(); ++c, i++) {
if (!sys.f_ctrs.deriv_calculator().is_linear[c]) {
for (size_t j=0; j<n; j++) {
Vector row(n_total,0.0);
row[j]=1;
row[n + c*n +j]=1;
double rhs = pt[j] - lp_solver.get_epsilon();
lp_solver.add_constraint(row, LEQ, rhs);
nb_ctr++;
}
}
Vector row(n_total,0.0);
row.put(0,J[i].lb());
IntervalVector gl(J[i].lb());
Vector diam_correctly_rounded = (IntervalVector(J[i].ub())-gl).lb();
for (size_t j=0; j<n; j++) {
if (diam_correctly_rounded[j]<0)
ibex_error("negative diameter");
}
row.put(n + c*n,-diam_correctly_rounded);
double rhs = (-gx[i] + (gl*pt)).lb()- lp_solver.get_epsilon();
lp_solver.add_constraint(row, LEQ, rhs);
nb_ctr++;
}
}
if (cache==NULL) delete active;
return nb_ctr;
}