bool-scale.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2006
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Int { namespace Linear {
/*
* Array of scale Boolean views
*
*/
forceinline
ScaleBoolArray::ScaleBoolArray(void) {}
forceinline
ScaleBoolArray::ScaleBoolArray(Space& home, int n) {
if (n > 0) {
_fst = home.alloc<ScaleBool>(n);
_lst = _fst+n;
} else {
_fst = _lst = NULL;
}
}
forceinline void
ScaleBoolArray::subscribe(Space& home, Propagator& p) {
for (ScaleBool* f = _fst; f < _lst; f++)
f->x.subscribe(home,p,PC_BOOL_VAL);
}
forceinline void
ScaleBoolArray::cancel(Space& home, Propagator& p) {
for (ScaleBool* f = _fst; f < _lst; f++)
f->x.cancel(home,p,PC_BOOL_VAL);
}
forceinline void
ScaleBoolArray::reschedule(Space& home, Propagator& p) {
for (ScaleBool* f = _fst; f < _lst; f++)
f->x.reschedule(home,p,PC_BOOL_VAL);
}
forceinline void
ScaleBoolArray::update(Space& home, ScaleBoolArray& sba) {
int n = static_cast<int>(sba._lst - sba._fst);
if (n > 0) {
_fst = home.alloc<ScaleBool>(n);
_lst = _fst+n;
for (int i=0; i<n; i++) {
_fst[i].a = sba._fst[i].a;
_fst[i].x.update(home,sba._fst[i].x);
}
} else {
_fst = _lst = NULL;
}
}
forceinline ScaleBool*
ScaleBoolArray::fst(void) const {
return _fst;
}
forceinline ScaleBool*
ScaleBoolArray::lst(void) const {
return _lst;
}
forceinline void
ScaleBoolArray::fst(ScaleBool* f) {
_fst = f;
}
forceinline void
ScaleBoolArray::lst(ScaleBool* l) {
_lst = l;
}
forceinline bool
ScaleBoolArray::empty(void) const {
return _fst == _lst;
}
forceinline int
ScaleBoolArray::size(void) const {
return static_cast<int>(_lst - _fst);
}
forceinline bool
ScaleBoolArray::ScaleDec::operator ()(const ScaleBool& x,
const ScaleBool& y) {
return x.a > y.a;
}
inline void
ScaleBoolArray::sort(void) {
ScaleDec scale_dec;
Support::quicksort<ScaleBool,ScaleDec>(fst(), size(), scale_dec);
}
/*
* Empty array of scale Boolean views
*
*/
forceinline
EmptyScaleBoolArray::EmptyScaleBoolArray(void) {}
forceinline
EmptyScaleBoolArray::EmptyScaleBoolArray(Space&, int) {}
forceinline void
EmptyScaleBoolArray::subscribe(Space&, Propagator&) {}
forceinline void
EmptyScaleBoolArray::cancel(Space&, Propagator&) {}
forceinline void
EmptyScaleBoolArray::reschedule(Space&, Propagator&) {}
forceinline void
EmptyScaleBoolArray::update(Space&, EmptyScaleBoolArray&) {}
forceinline ScaleBool*
EmptyScaleBoolArray::fst(void) const { return NULL; }
forceinline ScaleBool*
EmptyScaleBoolArray::lst(void) const { return NULL; }
forceinline void
EmptyScaleBoolArray::fst(ScaleBool*) {}
forceinline void
EmptyScaleBoolArray::lst(ScaleBool*) {}
forceinline bool
EmptyScaleBoolArray::empty(void) const { return true; }
forceinline int
EmptyScaleBoolArray::size(void) const { return 0; }
forceinline void
EmptyScaleBoolArray::sort(void) {}
/*
* Base-class for Boolean constraints with coefficients
*
*/
template<class SBAP, class SBAN, class VX, PropCond pcx>
forceinline
LinBoolScale<SBAP,SBAN,VX,pcx>::LinBoolScale(Home home,
SBAP& p0, SBAN& n0,
VX x0, int c0)
: Propagator(home), p(p0), n(n0), x(x0), c(c0) {
x.subscribe(home,*this,pcx);
p.subscribe(home,*this);
n.subscribe(home,*this);
}
template<class SBAP, class SBAN, class VX, PropCond pcx>
PropCost
LinBoolScale<SBAP,SBAN,VX,pcx>::cost(const Space&,
const ModEventDelta&) const {
return PropCost::linear(PropCost::LO, p.size() + n.size());
}
template<class SBAP, class SBAN, class VX, PropCond pcx>
void
LinBoolScale<SBAP,SBAN,VX,pcx>::reschedule(Space& home) {
x.reschedule(home,*this,pcx);
p.reschedule(home,*this);
n.reschedule(home,*this);
}
template<class SBAP, class SBAN, class VX, PropCond pcx>
forceinline size_t
LinBoolScale<SBAP,SBAN,VX,pcx>::dispose(Space& home) {
x.cancel(home,*this,pcx);
p.cancel(home,*this);
n.cancel(home,*this);
(void) Propagator::dispose(home);
return sizeof(*this);
}
template<class SBAP, class SBAN, class VX, PropCond pcx>
forceinline
LinBoolScale<SBAP,SBAN,VX,pcx>::LinBoolScale(Space& home,
Propagator& pr,
SBAP& p0, SBAN& n0,
VX x0, int c0)
: Propagator(home,pr), c(c0) {
x.update(home,x0);
p.update(home,p0);
n.update(home,n0);
}
/*
* Boolean equality with coefficients
*
*/
template<class SBAP, class SBAN, class VX>
forceinline
EqBoolScale<SBAP,SBAN,VX>::EqBoolScale(Home home,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
forceinline
EqBoolScale<SBAP,SBAN,VX>::EqBoolScale(Space& home,
Propagator& pr,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,pr,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
Actor*
EqBoolScale<SBAP,SBAN,VX>::copy(Space& home) {
if (p.empty()) {
EmptyScaleBoolArray ep;
if (x.assigned()) {
ZeroIntView z;
return new (home) EqBoolScale<EmptyScaleBoolArray,SBAN,ZeroIntView>
(home,*this,ep,n,z,c+x.val());
} else {
return new (home) EqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,*this,ep,n,x,c);
}
} else if (n.empty()) {
EmptyScaleBoolArray en;
if (x.assigned()) {
ZeroIntView z;
return new (home) EqBoolScale<SBAP,EmptyScaleBoolArray,ZeroIntView>
(home,*this,p,en,z,c+x.val());
} else {
return new (home) EqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,*this,p,en,x,c);
}
} else {
return new (home) EqBoolScale<SBAP,SBAN,VX>(home,*this,p,n,x,c);
}
}
template<class SBAP, class SBAN, class VX>
ExecStatus
EqBoolScale<SBAP,SBAN,VX>::propagate(Space& home, const ModEventDelta& med) {
int sl_p = 0; // Lower bound, computed positive
int su_n = 0; // Upper bound, computed negative
if (BoolView::me(med) == ME_BOOL_VAL) {
// Eliminate assigned positive views while keeping order
{
// Skip not assigned views
ScaleBool* f = p.fst();
ScaleBool* l = p.lst();
while ((f < l) && f->x.none()) {
su_n += f->a; f++;
}
// Copy unassigned views to t
ScaleBool* t = f;
while (f < l) {
if (f->x.one()) {
c -= f->a;
} else if (f->x.none()) {
su_n += f->a; *t = *f; t++;
}
f++;
}
p.lst(t);
}
// Eliminate assigned negative views while keeping order
{
// Skip not assigned views
ScaleBool* f = n.fst();
ScaleBool* l = n.lst();
while ((f < l) && f->x.none()) {
sl_p += f->a; f++;
}
// Copy unassigned views to t
ScaleBool* t = f;
while (f < l) {
if (f->x.one()) {
c += f->a;
} else if (f->x.none()) {
sl_p += f->a; *t = *f; t++;
}
f++;
}
n.lst(t);
}
} else {
for (ScaleBool* f=p.fst(); f<p.lst(); f++)
su_n += f->a;
for (ScaleBool* f=n.fst(); f<n.lst(); f++)
sl_p += f->a;
}
if (p.empty() && n.empty()) {
GECODE_ME_CHECK(x.eq(home,-c));
return home.ES_SUBSUMED(*this);
}
sl_p += x.max() + c;
su_n -= x.min() + c;
const int MOD_SL = 1 << 0;
const int MOD_SU = 1 << 1;
int mod = MOD_SL | MOD_SU;
do {
if ((mod & MOD_SL) != 0) {
mod -= MOD_SL;
// Propagate lower bound for positive Boolean views
{
ScaleBool* f=p.fst();
for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl_p); f++) {
GECODE_ME_CHECK(f->x.zero_none(home));
su_n -= f->a;
}
if (f > p.fst()) {
p.fst(f); mod |= MOD_SU;
}
}
// Propagate lower bound for negative Boolean views
{
ScaleBool* f=n.fst();
for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl_p); f++) {
GECODE_ME_CHECK(f->x.one_none(home)); c += f->a;
su_n -= f->a;
}
if (f > n.fst()) {
n.fst(f); mod |= MOD_SU;
}
}
// Propagate lower bound for integer view
{
const int x_min = x.min();
ModEvent me = x.gq(home,x.max() - sl_p);
if (me_failed(me))
return ES_FAILED;
if (me_modified(me)) {
su_n -= x.min() - x_min;
mod |= MOD_SU;
}
}
}
if ((mod & MOD_SU) != 0) {
mod -= MOD_SU;
// Propagate upper bound for positive Boolean views
{
ScaleBool* f=p.fst();
for (ScaleBool* l=p.lst(); (f < l) && (f->a > su_n); f++) {
GECODE_ME_CHECK(f->x.one_none(home)); c -= f->a;
sl_p -= f->a;
}
if (f > p.fst()) {
p.fst(f); mod |= MOD_SL;;
}
}
// Propagate upper bound for negative Boolean views
{
ScaleBool* f=n.fst();
for (ScaleBool* l=n.lst(); (f < l) && (f->a > su_n); f++) {
GECODE_ME_CHECK(f->x.zero_none(home));
sl_p -= f->a;
}
if (f > n.fst()) {
n.fst(f); mod |= MOD_SL;;
}
}
// Propagate upper bound for integer view
{
const int x_max = x.max();
ModEvent me = x.lq(home,x.min() + su_n);
if (me_failed(me))
return ES_FAILED;
if (me_modified(me)) {
sl_p += x.max() - x_max;
mod |= MOD_SL;;
}
}
}
} while (mod != 0);
return (sl_p == -su_n) ? home.ES_SUBSUMED(*this) : ES_FIX;
}
template<class SBAP, class SBAN, class VX>
ExecStatus
EqBoolScale<SBAP,SBAN,VX>::post(Home home,
SBAP& p, SBAN& n, VX x, int c) {
p.sort(); n.sort();
if (p.empty()) {
EmptyScaleBoolArray ep;
(void) new (home) EqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,ep,n,x,c);
} else if (n.empty()) {
EmptyScaleBoolArray en;
(void) new (home) EqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,p,en,x,c);
} else {
(void) new (home) EqBoolScale<SBAP,SBAN,VX>
(home,p,n,x,c);
}
return ES_OK;
}
/*
* Boolean inequality with coefficients
*
*/
template<class SBAP, class SBAN, class VX>
forceinline
LqBoolScale<SBAP,SBAN,VX>::LqBoolScale(Home home,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
forceinline
LqBoolScale<SBAP,SBAN,VX>::LqBoolScale(Space& home,
Propagator& pr,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_BND>(home,pr,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
Actor*
LqBoolScale<SBAP,SBAN,VX>::copy(Space& home) {
if (p.empty()) {
EmptyScaleBoolArray ep;
if (x.assigned()) {
ZeroIntView z;
return new (home) LqBoolScale<EmptyScaleBoolArray,SBAN,ZeroIntView>
(home,*this,ep,n,z,c+x.val());
} else {
return new (home) LqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,*this,ep,n,x,c);
}
} else if (n.empty()) {
EmptyScaleBoolArray en;
if (x.assigned()) {
ZeroIntView z;
return new (home) LqBoolScale<SBAP,EmptyScaleBoolArray,ZeroIntView>
(home,*this,p,en,z,c+x.val());
} else {
return new (home) LqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,*this,p,en,x,c);
}
} else {
return new (home) LqBoolScale<SBAP,SBAN,VX>(home,*this,p,n,x,c);
}
}
template<class SBAP, class SBAN, class VX>
ExecStatus
LqBoolScale<SBAP,SBAN,VX>::propagate(Space& home, const ModEventDelta& med) {
int sl = 0;
if (BoolView::me(med) == ME_BOOL_VAL) {
// Eliminate assigned positive views while keeping order
{
// Skip not assigned views
ScaleBool* f = p.fst();
ScaleBool* l = p.lst();
while ((f < l) && f->x.none())
f++;
// Copy unassigned views to t
ScaleBool* t = f;
while (f < l) {
if (f->x.one()) {
c -= f->a;
} else if (f->x.none()) {
*t = *f; t++;
}
f++;
}
p.lst(t);
}
// Eliminate assigned negative views while keeping order
{
// Skip not assigned views
ScaleBool* f = n.fst();
ScaleBool* l = n.lst();
while ((f < l) && f->x.none()) {
sl += f->a; f++;
}
// Copy unassigned views to t
ScaleBool* t = f;
while (f < l) {
if (f->x.one()) {
c += f->a;
} else if (f->x.none()) {
sl += f->a; *t = *f; t++;
}
f++;
}
n.lst(t);
}
} else {
for (ScaleBool* f=n.fst(); f<n.lst(); f++)
sl += f->a;
}
sl += x.max() + c;
// Propagate upper bound for positive Boolean views
{
ScaleBool* f=p.fst();
for (ScaleBool* l=p.lst(); (f < l) && (f->a > sl); f++)
GECODE_ME_CHECK(f->x.zero_none(home));
p.fst(f);
}
// Propagate lower bound for negative Boolean views
{
ScaleBool* f=n.fst();
for (ScaleBool* l=n.lst(); (f < l) && (f->a > sl); f++) {
c += f->a;
GECODE_ME_CHECK(f->x.one_none(home));
}
n.fst(f);
}
ExecStatus es = ES_FIX;
// Propagate lower bound for integer view
{
const int slx = x.max() - sl;
ModEvent me = x.gq(home,slx);
if (me_failed(me))
return ES_FAILED;
if (me_modified(me) && (slx != x.min()))
es = ES_NOFIX;
}
if (p.empty() && n.empty())
return home.ES_SUBSUMED(*this);
return es;
}
template<class SBAP, class SBAN, class VX>
ExecStatus
LqBoolScale<SBAP,SBAN,VX>::post(Home home,
SBAP& p, SBAN& n, VX x, int c) {
p.sort(); n.sort();
if (p.empty()) {
EmptyScaleBoolArray ep;
(void) new (home) LqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,ep,n,x,c);
} else if (n.empty()) {
EmptyScaleBoolArray en;
(void) new (home) LqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,p,en,x,c);
} else {
(void) new (home) LqBoolScale<SBAP,SBAN,VX>
(home,p,n,x,c);
}
return ES_OK;
}
/*
* Boolean disequality with coefficients
*
*/
template<class SBAP, class SBAN, class VX>
forceinline
NqBoolScale<SBAP,SBAN,VX>::NqBoolScale(Home home,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
forceinline
NqBoolScale<SBAP,SBAN,VX>::NqBoolScale(Space& home,
Propagator& pr,
SBAP& p, SBAN& n,
VX x, int c)
: LinBoolScale<SBAP,SBAN,VX,PC_INT_VAL>(home,pr,p,n,x,c) {}
template<class SBAP, class SBAN, class VX>
Actor*
NqBoolScale<SBAP,SBAN,VX>::copy(Space& home) {
if (p.empty()) {
EmptyScaleBoolArray ep;
if (x.assigned()) {
ZeroIntView z;
return new (home) NqBoolScale<EmptyScaleBoolArray,SBAN,ZeroIntView>
(home,*this,ep,n,z,c+x.val());
} else {
return new (home) NqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,*this,ep,n,x,c);
}
} else if (n.empty()) {
EmptyScaleBoolArray en;
if (x.assigned()) {
ZeroIntView z;
return new (home) NqBoolScale<SBAP,EmptyScaleBoolArray,ZeroIntView>
(home,*this,p,en,z,c+x.val());
} else {
return new (home) NqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,*this,p,en,x,c);
}
} else {
return new (home) NqBoolScale<SBAP,SBAN,VX>(home,*this,p,n,x,c);
}
}
template<class SBAP, class SBAN, class VX>
ExecStatus
NqBoolScale<SBAP,SBAN,VX>::propagate(Space& home, const ModEventDelta& med) {
if (BoolView::me(med) == ME_BOOL_VAL) {
// Eliminate assigned positive views
{
ScaleBool* f = p.fst();
ScaleBool* t = f;
ScaleBool* l = p.lst();
while (f < l) {
if (f->x.one()) {
c -= f->a; *f = *(t++);
} else if (f->x.zero()) {
*f = *(t++);
}
f++;
}
p.fst(t);
}
// Eliminate assigned negative views
{
ScaleBool* f = n.fst();
ScaleBool* t = f;
ScaleBool* l = n.lst();
while (f < l) {
if (f->x.one()) {
c += f->a; *f = *(t++);
} else if (f->x.zero()) {
*f = *(t++);
}
f++;
}
n.fst(t);
}
}
if (p.empty() && n.empty()) {
GECODE_ME_CHECK(x.nq(home,-c));
return home.ES_SUBSUMED(*this);
}
if (x.assigned()) {
int r = x.val()+c;
if (p.empty() && (n.size() == 1)) {
if (r == -n.fst()->a) {
GECODE_ME_CHECK(n.fst()->x.zero_none(home));
} else if (r == 0) {
GECODE_ME_CHECK(n.fst()->x.one_none(home));
}
return home.ES_SUBSUMED(*this);
}
if ((p.size() == 1) && n.empty()) {
if (r == p.fst()->a) {
GECODE_ME_CHECK(p.fst()->x.zero_none(home));
} else if (r == 0) {
GECODE_ME_CHECK(p.fst()->x.one_none(home));
}
return home.ES_SUBSUMED(*this);
}
}
return ES_FIX;
}
template<class SBAP, class SBAN, class VX>
ExecStatus
NqBoolScale<SBAP,SBAN,VX>::post(Home home,
SBAP& p, SBAN& n, VX x, int c) {
if (p.empty()) {
EmptyScaleBoolArray ep;
(void) new (home) NqBoolScale<EmptyScaleBoolArray,SBAN,VX>
(home,ep,n,x,c);
} else if (n.empty()) {
EmptyScaleBoolArray en;
(void) new (home) NqBoolScale<SBAP,EmptyScaleBoolArray,VX>
(home,p,en,x,c);
} else {
(void) new (home) NqBoolScale<SBAP,SBAN,VX>
(home,p,n,x,c);
}
return ES_OK;
}
}}}
// STATISTICS: int-prop
Gecode::Actor
Base-class for both propagators and branchers.
Definition core.hpp:628
Gecode::Actor::dispose
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition core.hpp:3252
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::Linear::EmptyScaleBoolArray
Empty array of scale Boolean views.
Definition linear.hh:1184
Gecode::Int::Linear::EmptyScaleBoolArray::fst
ScaleBool * fst(void) const
Return pointer to first element.
Definition bool-scale.hpp:134
Gecode::Int::Linear::EmptyScaleBoolArray::sort
void sort(void)
Sort array in decreasing order of coefficients.
Definition bool-scale.hpp:146
Gecode::Int::Linear::EmptyScaleBoolArray::size
int size(void) const
Return number of elements.
Definition bool-scale.hpp:144
Gecode::Int::Linear::EmptyScaleBoolArray::reschedule
void reschedule(Space &home, Propagator &p)
Schedule propagator p.
Definition bool-scale.hpp:130
Gecode::Int::Linear::EmptyScaleBoolArray::update
void update(Space &home, EmptyScaleBoolArray &esba)
Update sba during copying.
Definition bool-scale.hpp:132
Gecode::Int::Linear::EmptyScaleBoolArray::cancel
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition bool-scale.hpp:128
Gecode::Int::Linear::EmptyScaleBoolArray::EmptyScaleBoolArray
EmptyScaleBoolArray(void)
Default constructor.
Definition bool-scale.hpp:122
Gecode::Int::Linear::EmptyScaleBoolArray::empty
bool empty(void) const
Test whether array is empty.
Definition bool-scale.hpp:142
Gecode::Int::Linear::EmptyScaleBoolArray::subscribe
void subscribe(Space &home, Propagator &p)
Subscribe propagator p.
Definition bool-scale.hpp:126
Gecode::Int::Linear::EmptyScaleBoolArray::lst
ScaleBool * lst(void) const
Return pointer after last element.
Definition bool-scale.hpp:136
Gecode::Int::Linear::EqBoolScale::post
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition bool-scale.hpp:398
Gecode::Int::Linear::EqBoolScale::copy
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition bool-scale.hpp:224
Gecode::Int::Linear::EqBoolScale::EqBoolScale
EqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition bool-scale.hpp:209
Gecode::Int::Linear::EqBoolScale::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition bool-scale.hpp:252
Gecode::Int::Linear::LinBoolScale::LinBoolScale
LinBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition bool-scale.hpp:156
Gecode::Int::Linear::LinBoolScale::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition bool-scale.hpp:182
Gecode::Int::Linear::LinBoolScale::p
SBAP p
Positive Boolean views with coefficients on left-hand side.
Definition linear.hh:1223
Gecode::Int::Linear::LinBoolScale::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear).
Definition bool-scale.hpp:167
Gecode::Int::Linear::LinBoolScale::x
VX x
Integer view on right-hand side.
Definition linear.hh:1227
Gecode::Int::Linear::LinBoolScale::c
int c
Integer constant on right-hand side.
Definition linear.hh:1229
Gecode::Int::Linear::LinBoolScale::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition bool-scale.hpp:174
Gecode::Int::Linear::LinBoolScale::n
SBAN n
Negative Boolean views with coefficients on left-hand side.
Definition linear.hh:1225
Gecode::Int::Linear::LqBoolScale::LqBoolScale
LqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition bool-scale.hpp:424
Gecode::Int::Linear::LqBoolScale::copy
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition bool-scale.hpp:439
Gecode::Int::Linear::LqBoolScale::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition bool-scale.hpp:467
Gecode::Int::Linear::LqBoolScale::post
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition bool-scale.hpp:553
Gecode::Int::Linear::NqBoolScale::copy
virtual Actor * copy(Space &home)
Create copy during cloning.
Definition bool-scale.hpp:593
Gecode::Int::Linear::NqBoolScale::post
static ExecStatus post(Home home, SBAP &p, SBAN &n, VX x, int c)
Post propagator.
Definition bool-scale.hpp:686
Gecode::Int::Linear::NqBoolScale::NqBoolScale
NqBoolScale(Home home, SBAP &p, SBAN &n, VX x, int c)
Constructor for creation.
Definition bool-scale.hpp:578
Gecode::Int::Linear::NqBoolScale::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition bool-scale.hpp:621
Gecode::Int::Linear::ScaleBoolArray::cancel
void cancel(Space &home, Propagator &p)
Cancel propagator p.
Definition bool-scale.hpp:57
Gecode::Int::Linear::ScaleBoolArray::sort
void sort(void)
Sort array in decreasing order of coefficients.
Definition bool-scale.hpp:111
Gecode::Int::Linear::ScaleBoolArray::reschedule
void reschedule(Space &home, Propagator &p)
Schedule propagator p.
Definition bool-scale.hpp:62
Gecode::Int::Linear::ScaleBoolArray::lst
ScaleBool * lst(void) const
Return pointer after last element.
Definition bool-scale.hpp:85
Gecode::Int::Linear::ScaleBoolArray::subscribe
void subscribe(Space &home, Propagator &p)
Subscribe propagator p.
Definition bool-scale.hpp:52
Gecode::Int::Linear::ScaleBoolArray::size
int size(void) const
Return number of elements.
Definition bool-scale.hpp:101
Gecode::Int::Linear::ScaleBoolArray::fst
ScaleBool * fst(void) const
Return pointer to first element.
Definition bool-scale.hpp:81
Gecode::Int::Linear::ScaleBoolArray::ScaleBoolArray
ScaleBoolArray(void)
Default constructor.
Definition bool-scale.hpp:41
Gecode::Int::Linear::ScaleBoolArray::empty
bool empty(void) const
Test whether array is empty.
Definition bool-scale.hpp:97
Gecode::Int::Linear::ScaleBoolArray::update
void update(Space &home, ScaleBoolArray &sba)
Update sba during copying.
Definition bool-scale.hpp:67
Gecode::Int::Linear::ScaleBool
Coefficient and Boolean view.
Definition linear.hh:1130
Gecode::Int::Linear::ScaleBool::a
int a
Integer coefficient.
Definition linear.hh:1133
Gecode::Int::Linear::ScaleBool::x
BoolView x
Boolean view.
Definition linear.hh:1135
Gecode::Int::ZeroIntView
Zero integer view.
Definition view.hpp:1014
Gecode::PropCost
Propagation cost.
Definition core.hpp:486
Gecode::PropCost::linear
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
Definition core.hpp:4796
Gecode::PropCost::LO
@ LO
Cheap.
Definition core.hpp:513
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Propagator::Space
friend class Space
Definition core.hpp:1066
Gecode::Propagator::med
ModEventDelta med
A set of modification events (used during propagation).
Definition core.hpp:1075
Gecode::Propagator::Propagator
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3498
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::Space::alloc
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition core.hpp:2837
Gecode::VarImpView< BoolVar >::me
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:552
Gecode::Space::ES_SUBSUMED
ExecStatus ES_SUBSUMED(Propagator &p)
Definition core.hpp:3563
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
GECODE_ME_CHECK
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition macros.hpp:52
Gecode::me_failed
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition modevent.hpp:54
Gecode::me_modified
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition modevent.hpp:59
Gecode::Int::Linear
Linear propagators
Gecode::Int
Finite domain integers.
Gecode::Int::PC_INT_VAL
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:82
Gecode::Int::PC_INT_BND
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:91
Gecode::Int::ME_BOOL_VAL
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable).
Definition var-type.hpp:116
Gecode::Int::PC_BOOL_VAL
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:126
Gecode::Support::quicksort
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Definition sort.hpp:130
Gecode
Gecode toplevel namespace
Gecode::mod
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl=IPL_DEF)
Post propagator for .
Definition arithmetic.cpp:360
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition core.hpp:476
Gecode::ES_FIX
@ ES_FIX
Propagation has computed fixpoint.
Definition core.hpp:477
Gecode::ES_FAILED
@ ES_FAILED
Execution has resulted in failure.
Definition core.hpp:474
Gecode::ES_NOFIX
@ ES_NOFIX
Propagation has not computed fixpoint.
Definition core.hpp:475
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62
forceinline
#define forceinline
Definition config.hpp:187