本文整理汇总了C++中BitSet::add方法的典型用法代码示例。如果您正苦于以下问题:C++ BitSet::add方法的具体用法?C++ BitSet::add怎么用?C++ BitSet::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitSet
的用法示例。
在下文中一共展示了BitSet::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
BitSet BitSet::operator<<(const int shift)
{
BitSet result;
for (int i = 0; i < shift; ++i) {
result.add(false);
}
for (int i = 0; i < this->length(); ++i) {
result.add((*this)[i]);
}
return result;
}
示例2: propagate_no_ub
/*
* Restricted propagation procedure. Used when a direction is solved, but no new q-intersection is found.
* Same as propagate, except that upper bounds are not recorded (because we did not find a curr_qinter to work with).
*/
void propagate_no_ub(const Array<IntervalVector>& boxes, IntStack ***dirboxes, int dimension, bool left, IntervalVector& hull_qinter, vector<BitSet *>& nogoods) {
unsigned int n = hull_qinter.size();
unsigned int p = boxes.size();
IntervalVector b(n);
/* Create the new nogood */
BitSet *newNogood = new BitSet(0,p-1,BitSet::empt);
/* We iterate through the boxes to propagate bounds */
/* This does not seem to be optimal ; maybe we should study directly the directions' lists ? */
for (int i=0; i<p; i++) {
b = boxes[i];
/* Check if the box can be added to the new nogood */
if ((left && (b[dimension].lb() < hull_qinter[dimension].lb())) || (!left && (b[dimension].ub() > hull_qinter[dimension].ub()))) {
newNogood->add(i);
}
/* Check if the box is strictly outside our current q-inter hull */
if ((left && (b[dimension].ub() < hull_qinter[dimension].lb())) || (!left && (b[dimension].lb() > hull_qinter[dimension].ub()))) {
for (int k=dimension+1; k<n; k++) {
if (dirboxes[k][0]->contain(i)) dirboxes[k][0]->remove(i);
if (dirboxes[k][1]->contain(i)) dirboxes[k][1]->remove(i);
}
continue;
}
}
nogoods.push_back(newNogood);
}
示例3: propagate
/*
* Bound propagation and nogood recording. Assumes that dimensions are processed in the ascending order and left side first.
*/
void propagate(const Array<IntervalVector>& boxes, IntStack ***dirboxes, int dimension, bool left, IntervalVector& curr_qinter, vector<BitSet *>& nogoods) {
unsigned int n = curr_qinter.size();
unsigned int p = boxes.size();
IntervalVector b(n);
/* Create the new nogood */
BitSet *newNogood = new BitSet(0,p-1,BitSet::empt);
/* We iterate through the boxes to propagate bounds */
/* This does not seem to be optimal ; maybe we should study directly the directions' lists ? */
for (int i=0; i<p; i++) {
b = boxes[i];
/* Check if the box can be added to the new nogood */
if ((left && (b[dimension].lb() < curr_qinter[dimension].lb())) || (!left && (b[dimension].ub() > curr_qinter[dimension].ub()))) {
newNogood->add(i);
}
/* First check : the q-inter is a valid upper bound for the opposite direction */
if (left && (b[dimension].ub() <= curr_qinter[dimension].ub())) {
if (dirboxes[dimension][1]->contain(i)) dirboxes[dimension][1]->remove(i);
}
/* Second check : check if the box is strictly outside our current q-inter hull */
if ((left && (b[dimension].ub() < curr_qinter[dimension].lb())) || (!left && (b[dimension].lb() > curr_qinter[dimension].ub()))) {
for (int k=dimension+1; k<n; k++) {
if (dirboxes[k][0]->contain(i)) dirboxes[k][0]->remove(i);
if (dirboxes[k][1]->contain(i)) dirboxes[k][1]->remove(i);
}
continue;
}
/* Third check : the q-intersection provides a valid upper bound for the orthogonal dimensions. */
for (int j=dimension+1; j<n; j++) {
if (b[j].lb() >= curr_qinter[j].lb()) {
if (dirboxes[j][0]->contain(i)) dirboxes[j][0]->remove(i);
}
if (b[j].ub() <= curr_qinter[j].ub()) {
if (dirboxes[j][1]->contain(i)) dirboxes[j][1]->remove(i);
}
}
}
nogoods.push_back(newNogood);
}
示例4: BitSet
BitSet *gen(BasicBlock *bb) {
BitSet *result = new BitSet(size);
result->add(bb->number());
return result;
}