pow.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, 2012
*
* 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.
*
*/
#include <gecode/int/rel.hh>
#include <climits>
#include <algorithm>
namespace Gecode { namespace Int { namespace Arithmetic {
/*
* Positive bounds consistent power
*
*/
template<class VA, class VB, class Ops>
inline ExecStatus
prop_pow_plus_bnd(Space& home, VA x0, VB x1, const Ops& ops) {
bool mod;
do {
mod = false;
{
ModEvent me = x0.lq(home,ops.fnroot(x1.max()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x0.gq(home,ops.cnroot(x1.min()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x1.lq(home,ops.pow(x0.max()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
{
ModEvent me = x1.gq(home,ops.pow(x0.min()));
if (me_failed(me)) return ES_FAILED;
mod |= me_modified(me);
}
} while (mod);
return ES_OK;
}
template<class VA, class VB, class Ops>
forceinline
PowPlusBnd<VA,VB,Ops>::PowPlusBnd(Home home, VA x0, VB x1, const Ops& o)
: MixBinaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND>(home,x0,x1),
ops(o) {}
template<class VA, class VB, class Ops>
forceinline ExecStatus
PowPlusBnd<VA,VB,Ops>::post(Home home, VA x0, VB x1, Ops ops) {
GECODE_ME_CHECK(x0.gq(home,0));
GECODE_ME_CHECK(x1.gq(home,0));
GECODE_ES_CHECK(prop_pow_plus_bnd(home,x0,x1,ops));
if (!x0.assigned()) {
assert(!x1.assigned());
(void) new (home) PowPlusBnd<VA,VB,Ops>(home,x0,x1,ops);
}
return ES_OK;
}
template<class VA, class VB, class Ops>
forceinline
PowPlusBnd<VA,VB,Ops>::PowPlusBnd(Space& home, PowPlusBnd<VA,VB,Ops>& p)
: MixBinaryPropagator<VA,PC_INT_BND,VB,PC_INT_BND>(home,p),
ops(p.ops) {}
template<class VA, class VB, class Ops>
Actor*
PowPlusBnd<VA,VB,Ops>::copy(Space& home) {
return new (home) PowPlusBnd<VA,VB,Ops>(home,*this);
}
template<class VA, class VB, class Ops>
ExecStatus
PowPlusBnd<VA,VB,Ops>::propagate(Space& home, const ModEventDelta&) {
GECODE_ES_CHECK(prop_pow_plus_bnd(home,x0,x1,ops));
return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
/*
* Bounds consistent power
*
*/
template<class Ops>
inline ExecStatus
prop_pow_bnd(Space& home, IntView x0, IntView x1, const Ops& ops) {
assert((x0.min() < 0) && (0 < x0.max()));
if (ops.even()) {
assert(x1.min() >= 0);
int u = ops.fnroot(x1.max());
GECODE_ME_CHECK(x0.lq(home,u));
GECODE_ME_CHECK(x0.gq(home,-u));
GECODE_ME_CHECK(x1.lq(home,std::max(ops.pow(x0.max()),
ops.pow(-x0.min()))));
} else {
assert((x1.min() < 0) && (0 < x1.max()));
GECODE_ME_CHECK(x0.lq(home,ops.fnroot(x1.max())));
GECODE_ME_CHECK(x0.gq(home,-ops.fnroot(-x1.min())));
GECODE_ME_CHECK(x1.lq(home,ops.pow(x0.max())));
GECODE_ME_CHECK(x1.gq(home,ops.pow(x0.min())));
}
return ES_OK;
}
template<class Ops>
forceinline
PowBnd<Ops>::PowBnd(Home home, IntView x0, IntView x1, const Ops& o)
: BinaryPropagator<IntView,PC_INT_BND>(home,x0,x1),
ops(o) {}
template<class Ops>
inline ExecStatus
PowBnd<Ops>::post(Home home, IntView x0, IntView x1, Ops ops) {
if (static_cast<unsigned int>(ops.exp()) >= sizeof(int) * CHAR_BIT) {
// The integer limits allow only -1, 0, 1 for x0
GECODE_ME_CHECK(x0.lq(home,1));
GECODE_ME_CHECK(x0.gq(home,-1));
// Just rewrite to values that can be handeled without overflow
ops.exp(ops.even() ? 2 : 1);
}
if (ops.exp() == 0) {
GECODE_ME_CHECK(x1.eq(home,1));
return ES_OK;
} else if (ops.exp() == 1) {
return Rel::EqBnd<IntView,IntView>::post(home,x0,x1);
}
if (x0 == x1) {
assert(ops.exp() != 0);
GECODE_ME_CHECK(x0.lq(home,1));
GECODE_ME_CHECK(x0.gq(home,ops.even() ? 0 : -1));
return ES_OK;
}
// Limits values such that no overflow can occur
assert(Limits::max == -Limits::min);
{
int l = ops.fnroot(Limits::max);
GECODE_ME_CHECK(x0.lq(home,l));
GECODE_ME_CHECK(x0.gq(home,-l));
}
if ((x0.min() >= 0) || ((x1.min() >= 0) && !ops.even()))
return PowPlusBnd<IntView,IntView,Ops>::post(home,x0,x1,ops);
if (ops.even() && (x0.max() <= 0))
return PowPlusBnd<MinusView,IntView,Ops>
::post(home,MinusView(x0),x1,ops);
if (!ops.even() && ((x0.max() <= 0) || (x1.max() <= 0)))
return PowPlusBnd<MinusView,MinusView,Ops>
::post(home,MinusView(x0),MinusView(x1),ops);
if (ops.even())
GECODE_ME_CHECK(x1.gq(home,0));
assert((x0.min() < 0) && (x0.max() > 0));
if (ops.even()) {
GECODE_ME_CHECK(x1.lq(home,std::max(ops.pow(x0.min()),
ops.pow(x0.max()))));
} else {
GECODE_ME_CHECK(x1.lq(home,ops.pow(x0.max())));
GECODE_ME_CHECK(x1.gq(home,ops.pow(x0.min())));
}
(void) new (home) PowBnd<Ops>(home,x0,x1,ops);
return ES_OK;
}
template<class Ops>
forceinline
PowBnd<Ops>::PowBnd(Space& home, PowBnd<Ops>& p)
: BinaryPropagator<IntView,PC_INT_BND>(home,p),
ops(p.ops) {}
template<class Ops>
Actor*
PowBnd<Ops>::copy(Space& home) {
return new (home) PowBnd<Ops>(home,*this);
}
template<class Ops>
ExecStatus
PowBnd<Ops>::propagate(Space& home, const ModEventDelta&) {
if ((x0.min() >= 0) || ((x1.min() >= 0) && !ops.even()))
GECODE_REWRITE(*this,(PowPlusBnd<IntView,IntView,Ops>
::post(home(*this),x0,x1,ops)));
if (ops.even() && (x0.max() <= 0))
GECODE_REWRITE(*this,(PowPlusBnd<MinusView,IntView,Ops>
::post(home(*this),MinusView(x0),x1,ops)));
if (!ops.even() && ((x0.max() <= 0) || (x1.max() <= 0)))
GECODE_REWRITE(*this,(PowPlusBnd<MinusView,MinusView,Ops>
::post(home(*this),MinusView(x0),
MinusView(x1),ops)));
GECODE_ES_CHECK(prop_pow_bnd<Ops>(home,x0,x1,ops));
if (x0.assigned() && x1.assigned())
return (ops.pow(x0.val()) == x1.val()) ?
home.ES_SUBSUMED(*this) : ES_FAILED;
return ES_NOFIX;
}
/*
* Value mappings for power and nroot
*
*/
template<class Ops>
class ValuesMapPow {
protected:
Ops ops;
public:
forceinline ValuesMapPow(const Ops& o) : ops(o) {}
forceinline int val(int x) const {
return ops.pow(x);
}
};
template<class Ops>
class ValuesMapNroot {
protected:
Ops ops;
public:
forceinline ValuesMapNroot(const Ops& o) : ops(o) {}
forceinline int val(int x) const {
return ops.fnroot(x);
}
};
template<class Ops>
class ValuesMapNrootSigned {
protected:
Ops ops;
public:
forceinline ValuesMapNrootSigned(const Ops& o) : ops(o) {}
forceinline int val(int x) const {
if (x < 0)
return -ops.fnroot(-x);
else
return ops.fnroot(x);
}
};
/*
* Positive domain consistent power
*
*/
template<class VA, class VB, class Ops>
forceinline
PowPlusDom<VA,VB,Ops>::PowPlusDom(Home home, VA x0, VB x1, const Ops& o)
: MixBinaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM>(home,x0,x1),
ops(o) {}
template<class VA, class VB, class Ops>
forceinline ExecStatus
PowPlusDom<VA,VB,Ops>::post(Home home, VA x0, VB x1, Ops ops) {
GECODE_ME_CHECK(x0.gq(home,0));
GECODE_ME_CHECK(x1.gq(home,0));
GECODE_ES_CHECK(prop_pow_plus_bnd(home,x0,x1,ops));
if (!x0.assigned()) {
assert(!x1.assigned());
(void) new (home) PowPlusDom<VA,VB,Ops>(home,x0,x1,ops);
}
return ES_OK;
}
template<class VA, class VB, class Ops>
forceinline
PowPlusDom<VA,VB,Ops>::PowPlusDom(Space& home, PowPlusDom<VA,VB,Ops>& p)
: MixBinaryPropagator<VA,PC_INT_DOM,VB,PC_INT_DOM>(home,p),
ops(p.ops) {}
template<class VA, class VB, class Ops>
Actor*
PowPlusDom<VA,VB,Ops>::copy(Space& home) {
return new (home) PowPlusDom<VA,VB,Ops>(home,*this);
}
template<class VA, class VB, class Ops>
PropCost
PowPlusDom<VA,VB,Ops>::cost(const Space&, const ModEventDelta& med) const {
if (VA::me(med) == ME_INT_VAL)
return PropCost::unary(PropCost::LO);
else if (VA::me(med) == ME_INT_DOM)
return PropCost::binary(PropCost::HI);
else
return PropCost::binary(PropCost::LO);
}
template<class VA, class VB, class Ops>
ExecStatus
PowPlusDom<VA,VB,Ops>::propagate(Space& home, const ModEventDelta& med) {
if (VA::me(med) != ME_INT_DOM) {
GECODE_ES_CHECK(prop_pow_plus_bnd(home,x0,x1,ops));
return x0.assigned() ?
home.ES_SUBSUMED(*this)
: home.ES_NOFIX_PARTIAL(*this,VA::med(ME_INT_DOM));
}
{
ViewValues<VA> v0(x0);
ValuesMapPow<Ops> vmp(ops);
Iter::Values::Map<ViewValues<VA>,ValuesMapPow<Ops> > s0(v0,vmp);
GECODE_ME_CHECK(x1.inter_v(home,s0,false));
}
{
ViewValues<VB> v1(x1);
ValuesMapNroot<Ops> vmn(ops);
Iter::Values::Map<ViewValues<VB>,ValuesMapNroot<Ops> > s1(v1,vmn);
GECODE_ME_CHECK(x0.inter_v(home,s1,false));
}
return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
/*
* Domain consistent power
*
*/
template<class Ops>
forceinline
PowDom<Ops>::PowDom(Home home, IntView x0, IntView x1, const Ops& o)
: BinaryPropagator<IntView,PC_INT_DOM>(home,x0,x1), ops(o) {}
template<class Ops>
inline ExecStatus
PowDom<Ops>::post(Home home, IntView x0, IntView x1, Ops ops) {
if (static_cast<unsigned int>(ops.exp()) >= sizeof(int) * CHAR_BIT) {
// The integer limits allow only -1, 0, 1 for x0
GECODE_ME_CHECK(x0.lq(home,1));
GECODE_ME_CHECK(x0.gq(home,-1));
// Just rewrite to values that can be handeled without overflow
ops.exp(ops.even() ? 2 : 1);
}
if (ops.exp() == 0) {
GECODE_ME_CHECK(x1.eq(home,1));
return ES_OK;
} else if (ops.exp() == 1) {
return Rel::EqDom<IntView,IntView>::post(home,x0,x1);
}
if (x0 == x1) {
assert(ops.exp() != 0);
GECODE_ME_CHECK(x0.lq(home,1));
GECODE_ME_CHECK(x0.gq(home,ops.even() ? 0 : -1));
return ES_OK;
}
// Limits values such that no overflow can occur
assert(Limits::max == -Limits::min);
{
int l = ops.fnroot(Limits::max);
GECODE_ME_CHECK(x0.lq(home,l));
GECODE_ME_CHECK(x0.gq(home,-l));
}
if ((x0.min() >= 0) || ((x1.min() >= 0) && !ops.even()))
return PowPlusDom<IntView,IntView,Ops>::post(home,x0,x1,ops);
if (ops.even() && (x0.max() <= 0))
return PowPlusDom<MinusView,IntView,Ops>
::post(home,MinusView(x0),x1,ops);
if (!ops.even() && ((x0.max() <= 0) || (x1.max() <= 0)))
return PowPlusDom<MinusView,MinusView,Ops>
::post(home,MinusView(x0),MinusView(x1),ops);
if (ops.even())
GECODE_ME_CHECK(x1.gq(home,0));
assert((x0.min() < 0) && (x0.max() > 0));
if (ops.even()) {
GECODE_ME_CHECK(x1.lq(home,std::max(ops.pow(x0.min()),
ops.pow(x0.max()))));
} else {
GECODE_ME_CHECK(x1.lq(home,ops.pow(x0.max())));
GECODE_ME_CHECK(x1.gq(home,ops.pow(x0.min())));
}
(void) new (home) PowDom<Ops>(home,x0,x1,ops);
return ES_OK;
}
template<class Ops>
forceinline
PowDom<Ops>::PowDom(Space& home, PowDom<Ops>& p)
: BinaryPropagator<IntView,PC_INT_DOM>(home,p),
ops(p.ops) {}
template<class Ops>
Actor*
PowDom<Ops>::copy(Space& home) {
return new (home) PowDom<Ops>(home,*this);
}
template<class Ops>
PropCost
PowDom<Ops>::cost(const Space&, const ModEventDelta& med) const {
if (IntView::me(med) == ME_INT_VAL)
return PropCost::unary(PropCost::LO);
else if (IntView::me(med) == ME_INT_DOM)
return PropCost::binary(PropCost::HI);
else
return PropCost::binary(PropCost::LO);
}
template<class Ops>
ExecStatus
PowDom<Ops>::propagate(Space& home, const ModEventDelta& med) {
if ((x0.min() >= 0) || ((x1.min() >= 0) && !ops.even()))
GECODE_REWRITE(*this,(PowPlusDom<IntView,IntView,Ops>
::post(home(*this),x0,x1,ops)));
if (ops.even() && (x0.max() <= 0))
GECODE_REWRITE(*this,(PowPlusDom<MinusView,IntView,Ops>
::post(home(*this),MinusView(x0),x1,ops)));
if (!ops.even() && ((x0.max() <= 0) || (x1.max() <= 0)))
GECODE_REWRITE(*this,(PowPlusDom<MinusView,MinusView,Ops>
::post(home(*this),MinusView(x0),
MinusView(x1),ops)));
if (IntView::me(med) != ME_INT_DOM) {
GECODE_ES_CHECK(prop_pow_bnd<Ops>(home,x0,x1,ops));
if (x0.assigned() && x1.assigned())
return (ops.pow(x0.val()) == x1.val()) ?
home.ES_SUBSUMED(*this) : ES_FAILED;
return home.ES_NOFIX_PARTIAL(*this,IntView::med(ME_INT_DOM));
}
Region r;
if (ops.even()) {
ViewValues<IntView> i(x0), j(x0);
using namespace Iter::Values;
Positive<ViewValues<IntView> > pos(i);
Negative<ViewValues<IntView> > neg(j);
Minus m(r,neg);
ValuesMapPow<Ops> vmp(ops);
Map<Positive<ViewValues<IntView> >,ValuesMapPow<Ops>,true> sp(pos,vmp);
Map<Minus,ValuesMapPow<Ops>,true> sm(m,vmp);
Union<Map<Positive<ViewValues<IntView> >,ValuesMapPow<Ops>,true>,
Map<Minus,ValuesMapPow<Ops>,true> > u(sp,sm);
GECODE_ME_CHECK(x1.inter_v(home,u,false));
} else {
ViewValues<IntView> v0(x0);
ValuesMapPow<Ops> vmp(ops);
Iter::Values::Map<ViewValues<IntView>,ValuesMapPow<Ops> > s0(v0,vmp);
GECODE_ME_CHECK(x1.inter_v(home,s0,false));
}
if (ops.even()) {
ViewValues<IntView> i(x1), j(x1);
using namespace Iter::Values;
ValuesMapNroot<Ops> vmn(ops);
Map<ViewValues<IntView>,ValuesMapNroot<Ops>,true> si(i,vmn), sj(j,vmn);
Minus mi(r,si);
Union<Minus,
Map<ViewValues<IntView>,ValuesMapNroot<Ops>,true> > u(mi,sj);
GECODE_ME_CHECK(x0.inter_v(home,u,false));
} else {
ViewValues<IntView> v1(x1);
ValuesMapNrootSigned<Ops> vmn(ops);
Iter::Values::Map<ViewValues<IntView>,ValuesMapNrootSigned<Ops> >
s1(v1,vmn);
GECODE_ME_CHECK(x0.inter_v(home,s1,false));
}
return x0.assigned() ? home.ES_SUBSUMED(*this) : ES_FIX;
}
}}}
// STATISTICS: int-prop
Gecode::Actor
Base-class for both propagators and branchers.
Definition core.hpp:628
Gecode::BinaryPropagator< IntView, PC_INT_BND >::x0
IntView x0
Definition pattern.hpp:87
Gecode::BinaryPropagator< IntView, PC_INT_BND >::BinaryPropagator
BinaryPropagator(Space &home, BinaryPropagator &p)
Gecode::BinaryPropagator< IntView, PC_INT_BND >::x1
IntView x1
Definition pattern.hpp:87
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::Arithmetic::PowBnd::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition pow.hpp:216
Gecode::Int::Arithmetic::PowBnd::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition pow.hpp:222
Gecode::Int::Arithmetic::PowBnd::post
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
Definition pow.hpp:149
Gecode::Int::Arithmetic::PowBnd::ops
Ops ops
Operations.
Definition arithmetic.hh:400
Gecode::Int::Arithmetic::PowBnd::PowBnd
PowBnd(Space &home, PowBnd &p)
Constructor for cloning p.
Definition pow.hpp:210
Gecode::Int::Arithmetic::PowDom::post
static ExecStatus post(Home home, IntView x0, IntView x1, Ops ops)
Post propagator.
Definition pow.hpp:386
Gecode::Int::Arithmetic::PowDom::ops
Ops ops
Operations.
Definition arithmetic.hh:459
Gecode::Int::Arithmetic::PowDom::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition pow.hpp:453
Gecode::Int::Arithmetic::PowDom::PowDom
PowDom(Space &home, PowDom< Ops > &p)
Constructor for cloning p.
Definition pow.hpp:447
Gecode::Int::Arithmetic::PowDom::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition pow.hpp:459
Gecode::Int::Arithmetic::PowDom::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition pow.hpp:470
Gecode::Int::Arithmetic::PowPlusBnd
Bounds consistent positive power propagator.
Definition arithmetic.hh:369
Gecode::Int::Arithmetic::PowPlusBnd::post
static ExecStatus post(Home home, VA x0, VB x1, Ops ops)
Post propagator.
Definition pow.hpp:83
Gecode::Int::Arithmetic::PowPlusBnd::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition pow.hpp:108
Gecode::Int::Arithmetic::PowPlusBnd::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition pow.hpp:102
Gecode::Int::Arithmetic::PowPlusBnd::ops
Ops ops
Operations.
Definition arithmetic.hh:374
Gecode::Int::Arithmetic::PowPlusBnd::PowPlusBnd
PowPlusBnd(Home home, VA x0, VB x1, const Ops &ops)
Constructor for posting.
Definition pow.hpp:77
Gecode::Int::Arithmetic::PowPlusDom
Domain consistent positive power propagator.
Definition arithmetic.hh:420
Gecode::Int::Arithmetic::PowPlusDom::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition pow.hpp:337
Gecode::Int::Arithmetic::PowPlusDom::ops
Ops ops
Operations.
Definition arithmetic.hh:425
Gecode::Int::Arithmetic::PowPlusDom::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition pow.hpp:348
Gecode::Int::Arithmetic::PowPlusDom::post
static ExecStatus post(Home home, VA x0, VB x1, Ops ops)
Post propagator.
Definition pow.hpp:312
Gecode::Int::Arithmetic::PowPlusDom::PowPlusDom
PowPlusDom(Home home, VA x0, VB x1, const Ops &ops)
Constructor for posting.
Definition pow.hpp:306
Gecode::Int::Arithmetic::PowPlusDom::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition pow.hpp:331
Gecode::Int::Arithmetic::ValuesMapNrootSigned
Mapping integer (must be an n-th power) to n-th root (signed).
Definition pow.hpp:283
Gecode::Int::Arithmetic::ValuesMapNrootSigned::ValuesMapNrootSigned
ValuesMapNrootSigned(const Ops &o)
Initialize with operations o.
Definition pow.hpp:289
Gecode::Int::Arithmetic::ValuesMapNrootSigned::ops
Ops ops
Operations.
Definition pow.hpp:286
Gecode::Int::Arithmetic::ValuesMapNrootSigned::val
int val(int x) const
Perform mapping.
Definition pow.hpp:291
Gecode::Int::Arithmetic::ValuesMapNroot
Mapping integer (must be an n-th power) to n-th root.
Definition pow.hpp:268
Gecode::Int::Arithmetic::ValuesMapNroot::val
int val(int x) const
Perform mapping.
Definition pow.hpp:276
Gecode::Int::Arithmetic::ValuesMapNroot::ValuesMapNroot
ValuesMapNroot(const Ops &o)
Initialize with operations o.
Definition pow.hpp:274
Gecode::Int::Arithmetic::ValuesMapNroot::ops
Ops ops
Operations.
Definition pow.hpp:271
Gecode::Int::Arithmetic::ValuesMapPow
Mapping integer to power.
Definition pow.hpp:253
Gecode::Int::Arithmetic::ValuesMapPow::ops
Ops ops
Operations.
Definition pow.hpp:256
Gecode::Int::Arithmetic::ValuesMapPow::ValuesMapPow
ValuesMapPow(const Ops &o)
Initialize with operations o.
Definition pow.hpp:259
Gecode::Int::Arithmetic::ValuesMapPow::val
int val(int x) const
Perform mapping.
Definition pow.hpp:261
Gecode::Int::IntView
Integer view for integer variables.
Definition view.hpp:129
Gecode::Int::IntView::min
int min(void) const
Return minimum of domain.
Definition int.hpp:58
Gecode::Int::IntView::lq
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition int.hpp:121
Gecode::Int::IntView::med
int med(void) const
Return median of domain (greatest element not greater than the median).
Definition int.hpp:66
Gecode::Int::IntView::gq
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition int.hpp:139
Gecode::Int::IntView::max
int max(void) const
Return maximum of domain.
Definition int.hpp:62
Gecode::Int::MinusView
Minus integer view.
Definition view.hpp:282
Gecode::Int::Rel::EqBnd::post
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition eq.hpp:108
Gecode::Int::Rel::EqDom::post
static ExecStatus post(Home home, View0 x0, View1 x1)
Post domain consistent propagator .
Definition eq.hpp:176
Gecode::Int::ViewValues
Value iterator for integer views.
Definition view.hpp:94
Gecode::Iter::Values::Map
Value iterator for mapping values of a value iterator.
Definition values-map.hpp:45
Gecode::MixBinaryPropagator< VA, PC_INT_BND, VB, PC_INT_BND >::x1
VB x1
Definition pattern.hpp:209
Gecode::MixBinaryPropagator< VA, PC_INT_BND, VB, PC_INT_BND >::MixBinaryPropagator
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
Definition pattern.hpp:597
Gecode::MixBinaryPropagator< VA, PC_INT_BND, VB, PC_INT_BND >::x0
VA x0
Definition pattern.hpp:207
Gecode::PropCost
Propagation cost.
Definition core.hpp:486
Gecode::PropCost::unary
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Definition core.hpp:4813
Gecode::PropCost::binary
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Definition core.hpp:4809
Gecode::PropCost::LO
@ LO
Cheap.
Definition core.hpp:513
Gecode::PropCost::HI
@ HI
Expensive.
Definition core.hpp:514
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::Region
Handle to region.
Definition region.hpp:55
Gecode::Set::RelOp::Union
Propagator for ternary union
Definition rel-op.hh:154
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarImpView< IntVar >::me
static ModEvent me(const ModEventDelta &med)
Definition view.hpp:552
Gecode::Space::ES_NOFIX_PARTIAL
ExecStatus ES_NOFIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has not computed partial fixpoint
Definition core.hpp:3576
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_REWRITE
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Definition macros.hpp:116
Gecode::me_failed
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition modevent.hpp:54
GECODE_ES_CHECK
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Definition macros.hpp:91
Gecode::me_modified
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition modevent.hpp:59
rel.hh
Gecode::Int::Arithmetic
Numerical (arithmetic) propagators.
Gecode::Int::Arithmetic::pos
bool pos(const View &x)
Test whether x is postive.
Definition mult.hpp:70
Gecode::Int::Arithmetic::prop_pow_plus_bnd
ExecStatus prop_pow_plus_bnd(Space &home, VA x0, VB x1, const Ops &ops)
Definition pow.hpp:47
Gecode::Int::Arithmetic::prop_pow_bnd
ExecStatus prop_pow_bnd(Space &home, IntView x0, IntView x1, const Ops &ops)
Definition pow.hpp:122
Gecode::Int::Arithmetic::neg
bool neg(const View &x)
Test whether x is negative.
Definition mult.hpp:76
Gecode::Int::Limits::min
const int min
Smallest allowed integer value.
Definition int.hh:118
Gecode::Int::Limits::max
const int max
Largest allowed integer value.
Definition int.hh:116
Gecode::Int
Finite domain integers.
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::PC_INT_DOM
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode::Int::ME_INT_VAL
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable).
Definition var-type.hpp:56
Gecode::Int::ME_INT_DOM
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
Definition var-type.hpp:72
Gecode::Iter::Values
Value iterators.
Definition iter.hh:45
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