本文整理汇总了C++中Space::ES_SUBSUMED方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::ES_SUBSUMED方法的具体用法?C++ Space::ES_SUBSUMED怎么用?C++ Space::ES_SUBSUMED使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::ES_SUBSUMED方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
ExecStatus
Card<View>::propagate(Space& home, const ModEventDelta&) {
int x1min, x1max;
do {
x1min = x1.min();
x1max = x1.max();
GECODE_ME_CHECK(x0.cardMin(home,static_cast<unsigned int>(x1min)));
GECODE_ME_CHECK(x0.cardMax(home,static_cast<unsigned int>(x1max)));
GECODE_ME_CHECK(x1.gq(home,static_cast<int>(x0.cardMin())));
GECODE_ME_CHECK(x1.lq(home,static_cast<int>(x0.cardMax())));
} while (x1.min() > x1min || x1.max() < x1max);
if (x1.assigned())
return home.ES_SUBSUMED(*this);
return ES_FIX;
}
示例2: assert
ExecStatus
NaryEq<View>::propagate(Space& home, const ModEventDelta& med) {
assert(x.size() > 2);
if (View::me(med) == ME_FLOAT_VAL) {
// One of the variables is assigned
for (int i = 0; ; i++)
if (x[i].assigned()) {
FloatVal n = x[i].val();
x.move_lst(i);
for (int j = x.size(); j--; )
GECODE_ME_CHECK(x[j].eq(home,n));
return home.ES_SUBSUMED(*this);
}
GECODE_NEVER;
}
FloatNum mn = x[0].min();
restart_min:
for (int i = x.size(); i--; ) {
GECODE_ME_CHECK(x[i].gq(home,mn));
if (mn < x[i].min()) {
mn = x[i].min();
goto restart_min;
}
}
FloatNum mx = x[0].max();
restart_max:
for (int i = x.size(); i--; ) {
GECODE_ME_CHECK(x[i].lq(home,mx));
if (mx > x[i].max()) {
mx = x[i].max();
goto restart_max;
}
}
return x[0].assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
示例3: vsr
ExecStatus
Prop<View>::propagate(Space& home, const ModEventDelta& med) {
// Add assigned views to value set
if (View::me(med) == ME_INT_VAL)
add(home,vs,x);
// Eliminate views from x
eliminate(home);
if (x.size() == 0) {
// y must have values in the value set
ValSet::Ranges vsr(vs);
GECODE_ME_CHECK(y.inter_r(home,vsr,false));
return home.ES_SUBSUMED(*this);
}
// Constrain y to union of x and value set
Region r(home);
assert(x.size() > 0);
ValSet::Ranges vsr(vs);
ViewRanges<View> xsr(x[x.size()-1]);
Iter::Ranges::NaryUnion u(r,vsr,xsr);
for (int i=x.size()-1; i--; ) {
ViewRanges<View> xir(x[i]);
u |= xir;
}
GECODE_ME_CHECK(y.inter_r(home,u,false));
// Check whether all values in y are already in the value set
if (vs.subset(y))
return home.ES_SUBSUMED(*this);
return ES_FIX;
}
示例4: all_in_valset
ExecStatus
LqInt<VY>::propagate(Space& home, const ModEventDelta& med) {
// Add assigned views to value set
if (IntView::me(med) == ME_INT_VAL)
add(home);
GECODE_ME_CHECK(y.gq(home, vs.size()));
if (x.size() == 0)
return home.ES_SUBSUMED(*this);
// All values must be in the value set
if (y.max() == vs.size())
return all_in_valset(home);
if (x.size() + vs.size() <= y.min())
return home.ES_SUBSUMED(*this);
// Compute positions of disjoint views
Region r(home);
int* dis; int n_dis;
disjoint(home,r,dis,n_dis);
// Some views might have been eliminated as they are subsumed
if (x.size() == 0)
return home.ES_SUBSUMED(*this);
// No lower bound pruning possible
if (n_dis == 0)
return ES_NOFIX;
// Do lower bound-based pruning
GECODE_ES_CHECK(prune_lower(home,dis,n_dis));
return ES_NOFIX;
}
示例5: zi
ExecStatus
ChannelBool<View>::propagate(Space& home, const ModEventDelta&) {
running = true;
if (zeros.size() > 0) {
BndSetRanges zi(zeros);
GECODE_ME_CHECK(y.excludeI(home, zi));
zeros.init(home);
}
if (ones.size() > 0) {
BndSetRanges oi(ones);
GECODE_ME_CHECK(y.includeI(home, oi));
ones.init(home);
}
running = false;
if (delta.glbMin() != 1 || delta.glbMax() != 0) {
if (!delta.glbAny()) {
for (int i=delta.glbMin(); i<=delta.glbMax(); i++)
GECODE_ME_CHECK(x[i].one(home));
} else {
GlbRanges<View> glb(y);
for (Iter::Ranges::ToValues<GlbRanges<View> > gv(glb); gv(); ++gv) {
GECODE_ME_CHECK(x[gv.val()].one(home));
}
}
}
if (delta.lubMin() != 1 || delta.lubMax() != 0) {
if (!delta.lubAny()) {
for (int i=delta.lubMin(); i<=delta.lubMax(); i++)
GECODE_ME_CHECK(x[i].zero(home));
} else {
int cur = 0;
for (LubRanges<View> lub(y); lub(); ++lub) {
for (; cur < lub.min(); cur++) {
GECODE_ME_CHECK(x[cur].zero(home));
}
cur = lub.max() + 1;
}
for (; cur < x.size(); cur++) {
GECODE_ME_CHECK(x[cur].zero(home));
}
}
}
new (&delta) SetDelta();
return y.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
示例6: return
ExecStatus
Mult<A,B,C>::propagate(Space& home, const ModEventDelta&) {
GECODE_ME_CHECK(x2.eq(home,x0.domain() * x1.domain()));
if ( x2.assigned() && (x2.val() == 0) )
{
if (x0.zero_in() || x1.zero_in())
{
return ES_FIX;
} else {
return ES_FAILED;
}
}
if (!x1.assigned() || (x1.val() != 0)) GECODE_ME_CHECK(x0.eq(home,x2.domain() / x1.domain()));
if (!x0.assigned() || (x0.val() != 0)) GECODE_ME_CHECK(x1.eq(home,x2.domain() / x0.domain()));
return (x0.assigned() && x1.assigned()) ? home.ES_SUBSUMED(*this) : ES_FIX;
}
示例7:
ExecStatus
ReEq<View0,View1>::propagate(Space& home, const ModEventDelta&) {
if (b.one())
GECODE_REWRITE(*this,(Eq<View0,View1>::post(home(*this),x0,x1)));
if (b.zero())
GECODE_REWRITE(*this,(Distinct<View0,View1>::post(home(*this),x0,x1)));
if (x0.assigned() && x1.assigned()) {
// directly test x0==x1
GlbRanges<View0> x0lb(x0);
GlbRanges<View1> x1lb(x1);
for (; x0lb() && x1lb(); ++x0lb, ++x1lb) {
if (x0lb.min() != x1lb.min() ||
x0lb.max() != x1lb.max()) {
GECODE_ME_CHECK(b.zero_none(home));
return home.ES_SUBSUMED(*this);
}
}
if (!x0lb() && !x1lb()) {
GECODE_ME_CHECK(b.one_none(home));
return home.ES_SUBSUMED(*this);
} else {
GECODE_ME_CHECK(b.zero_none(home));
return home.ES_SUBSUMED(*this);
}
}
// check whether cardinalities still allow equality
if (x0.cardMin() > x1.cardMax() ||
x1.cardMin() > x0.cardMax()) {
GECODE_ME_CHECK(b.zero_none(home));
return home.ES_SUBSUMED(*this);
}
// check glb(x0) subset lub(x1)
GlbRanges<View0> x0lb(x0);
LubRanges<View1> x1ub(x1);
Iter::Ranges::Diff<GlbRanges<View0>, LubRanges<View1> > diff1(x0lb, x1ub);
if ( diff1() ) {
GECODE_ME_CHECK(b.zero_none(home));
return home.ES_SUBSUMED(*this);
}
// check glb(x1) subset lub(x0)
GlbRanges<View1> x1lb(x1);
LubRanges<View0> x0ub(x0);
Iter::Ranges::Diff<GlbRanges<View1>, LubRanges<View0> > diff2(x1lb, x0ub);
if ( diff2() ) {
GECODE_ME_CHECK(b.zero_none(home));
return home.ES_SUBSUMED(*this);
}
return ES_FIX;
}
示例8: if
ExecStatus
purge(Space& home, Propagator& p, TaskArray<OptTask>& t, Cap c) {
int n=t.size();
for (int i=n; i--; )
if (t[i].excluded()) {
t[i].cancel(home,p,PL::pc); t[i]=t[--n];
}
t.size(n);
if (t.size() == 1) {
if (t[0].mandatory())
GECODE_ME_CHECK(c.gq(home, t[0].c()));
else if (c.min() < t[0].c())
return ES_OK;
}
return (t.size() < 2) ? home.ES_SUBSUMED(p) : ES_OK;
}
示例9: if
ExecStatus
LinkSingle::propagate(Space& home, const ModEventDelta&) {
if (x0.zero()) {
GECODE_ME_CHECK(x1.eq(home,0));
} else if (x0.one()) {
GECODE_ME_CHECK(x1.eq(home,1));
} else {
assert(x0.none() && x1.assigned());
if (x1.val() == 0) {
GECODE_ME_CHECK(x0.zero_none(home));
} else {
assert(x1.val() == 1);
GECODE_ME_CHECK(x0.one_none(home));
}
}
return home.ES_SUBSUMED(*this);
}
示例10: r
ExecStatus
Eq<View0,View1>::propagate(Space& home, const ModEventDelta& med) {
ModEvent me0 = View0::me(med);
ModEvent me1 = View1::me(med);
Region r(home);
if (testSetEventLB(me0,me1)) {
GlbRanges<View0> x0lb(x0);
GlbRanges<View1> x1lb(x1);
Iter::Ranges::Union<GlbRanges<View0>,GlbRanges<View1> > lbu(x0lb,x1lb);
Iter::Ranges::Cache<Iter::Ranges::Union
<GlbRanges<View0>, GlbRanges<View1> > > lbuc(r,lbu);
GECODE_ME_CHECK(x0.includeI(home,lbuc));
lbuc.reset();
GECODE_ME_CHECK(x1.includeI(home,lbuc));
}
if (testSetEventUB(me0,me1)) {
LubRanges<View0> x0ub(x0);
LubRanges<View1> x1ub(x1);
Iter::Ranges::Inter<LubRanges<View0>,LubRanges<View1> > ubi(x0ub,x1ub);
Iter::Ranges::Cache<Iter::Ranges::Inter
<LubRanges<View0>,LubRanges<View1> > > ubic(r,ubi);
GECODE_ME_CHECK(x0.intersectI(home,ubic));
ubic.reset();
GECODE_ME_CHECK(x1.intersectI(home,ubic));
}
if (testSetEventCard(me0,me1) ) {
unsigned int max = std::min(x0.cardMax(),x1.cardMax());
unsigned int min = std::max(x0.cardMin(),x1.cardMin());
GECODE_ME_CHECK ( x0.cardMax(home,max) );
GECODE_ME_CHECK ( x1.cardMax(home,max) );
GECODE_ME_CHECK ( x0.cardMin(home,min) );
GECODE_ME_CHECK ( x1.cardMin(home,min) );
}
if (x0.assigned()) {
assert (x1.assigned());
return home.ES_SUBSUMED(*this);
}
return shared(x0,x1) ? ES_NOFIX : ES_FIX;
}
示例11: r
forceinline ExecStatus
prop_mult_dom(Space& home, Propagator& p, View x0, View x1, View x2) {
Region r(home);
SupportValues<View,Region> s0(r,x0), s1(r,x1), s2(r,x2);
while (s0()) {
while (s1()) {
if (s2.support(mll(s0.val(),s1.val()))) {
s0.support(); s1.support();
}
++s1;
}
s1.reset(); ++s0;
}
GECODE_ME_CHECK(s0.tell(home));
GECODE_ME_CHECK(s1.tell(home));
GECODE_ME_CHECK(s2.tell(home));
return x0.assigned() && x1.assigned() ? home.ES_SUBSUMED(p) : ES_FIX;
}
示例12: xsv
ExecStatus
ChannelInt<View>::propagate(Space& home, const ModEventDelta&) {
int assigned = 0;
for (int v=xs.size(); v--;) {
if (xs[v].assigned()) {
assigned += 1;
for (int i=ys.size(); i--;) {
if (i==xs[v].val()) {
GECODE_ME_CHECK(ys[i].include(home, v));
}
else {
GECODE_ME_CHECK(ys[i].exclude(home, v));
}
}
} else {
for (int i=ys.size(); i--;) {
if (ys[i].notContains(v)) {
GECODE_ME_CHECK(xs[v].nq(home, i));
}
if (ys[i].contains(v)) {
GECODE_ME_CHECK(xs[v].eq(home, i));
}
}
Gecode::Int::ViewRanges<Gecode::Int::IntView> xsv(xs[v]);
int min = 0;
for (; xsv(); ++xsv) {
for (int i=min; i<xsv.min(); i++) {
GECODE_ME_CHECK(ys[i].exclude(home, v));
}
min = xsv.max() + 1;
}
for (int i=min; i<ys.size(); i++) {
GECODE_ME_CHECK(ys[i].exclude(home, v));
}
}
}
return (assigned==xs.size()) ? home.ES_SUBSUMED(*this) : ES_NOFIX;
}
示例13: if
ExecStatus
Pow<A,B>::propagate(Space& home, const ModEventDelta&) {
GECODE_ME_CHECK(x1.eq(home,pow(x0.domain(),m_n)));
if ((m_n % 2) == 0)
{
if (x0.min() >= 0)
GECODE_ME_CHECK(x0.eq(home,nth_root(x1.domain(),m_n)));
else if (x0.max() <= 0)
GECODE_ME_CHECK(x0.eq(home,-nth_root(x1.domain(),m_n)));
else
GECODE_ME_CHECK(x0.eq(home,
hull(
nth_root(x1.domain(),m_n),
-nth_root(x1.domain(),m_n)
)
));
} else
GECODE_ME_CHECK(x0.eq(home,nth_root(x1.domain(),m_n)));
return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
示例14: if
ExecStatus
Eq<View0,View1>::propagate(Space& home, const ModEventDelta&) {
if (x0.assigned()) {
GECODE_ME_CHECK(x1.eq(home,x0.val()));
} else if (x1.assigned()) {
GECODE_ME_CHECK(x0.eq(home,x1.val()));
} else {
do {
GECODE_ME_CHECK(x0.gq(home,x1.min()));
GECODE_ME_CHECK(x1.gq(home,x0.min()));
} while (x0.min() != x1.min());
do {
GECODE_ME_CHECK(x0.lq(home,x1.max()));
GECODE_ME_CHECK(x1.lq(home,x0.max()));
} while (x0.max() != x1.max());
if (!x0.assigned())
return ES_FIX;
}
assert(x0.assigned() && x1.assigned());
return home.ES_SUBSUMED(*this);
}
示例15: assert
forceinline ExecStatus
prop_mult_plus_bnd(Space& home, Propagator& p, VA x0, VB x1, VC x2) {
assert(pos(x0) && pos(x1) && pos(x2));
bool mod;
do {
mod = false;
{
ModEvent me = x2.lq(home,mll(x0.max(),x1.max()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x2.gq(home,mll(x0.min(),x1.min()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x0.lq(home,floor_div_pp(x2.max(),x1.min()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x0.gq(home,ceil_div_pp(x2.min(),x1.max()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x1.lq(home,floor_div_pp(x2.max(),x0.min()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x1.gq(home,ceil_div_pp(x2.min(),x0.max()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
} while (mod);
return x0.assigned() && x1.assigned() ?
home.ES_SUBSUMED(p) : ES_FIX;
}