rel.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Guido Tack <tack@gecode.org>
* Christian Schulte <schulte@gecode.org>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Guido Tack, 2004
* Christian Schulte, 2004
* Gabor Szokoli, 2004
*
* 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.
*
*/
#ifndef __GECODE_SET_REL_HH__
#define __GECODE_SET_REL_HH__
#include <gecode/set.hh>
namespace Gecode { namespace Set { namespace Rel {
template<class VX, class VY>
bool same(VX c, VY y);
template<class View0, class View1>
class Subset :
public MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB> {
protected:
using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x0;
using MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB>::x1;
Subset(Space& home, Subset& p);
Subset(Home home, View0 x0, View1 x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y);
};
template<class View0, class View1>
class NoSubset :
public MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB> {
protected:
using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x0;
using MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB>::x1;
NoSubset(Space& home, NoSubset& p);
NoSubset(Home home, View0 x0, View1 x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home,View0 x,View1 y);
};
template<class View0, class View1, class CtrlView, ReifyMode rm>
class ReSubset : public Propagator {
protected:
View0 x0;
View1 x1;
CtrlView b;
ReSubset(Space& home, ReSubset& p);
ReSubset(Home home, View0 x0, View1 x1, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual size_t dispose(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y,
CtrlView b);
};
template<class View0, class View1>
class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
protected:
using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
Eq(Space& home, Eq& p);
Eq(Home home, View0 x0, View1 x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y);
};
template<class View0, class View1, class CtrlView, ReifyMode rm>
class ReEq : public Propagator {
protected:
View0 x0;
View1 x1;
CtrlView b;
ReEq(Space& home, ReEq&);
ReEq(Home home, View0 x0, View1 x1, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual size_t dispose(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y,
CtrlView b);
};
template<class View0, class View1, bool strict=false>
class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
protected:
using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x0;
using MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY>::x1;
Lq(Space& home, Lq& p);
Lq(Home home, View0 x0, View1 x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y);
};
template<class View0, class View1, ReifyMode rm, bool strict=false>
class ReLq : public Propagator {
protected:
View0 x0;
View1 x1;
Gecode::Int::BoolView b;
ReLq(Space& home, ReLq& p);
ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual size_t dispose(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y,
Gecode::Int::BoolView b);
};
template<class View0, class View1>
class Distinct :
public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
protected:
using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x0;
using MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL>::x1;
Distinct(Space& home, Distinct& p);
Distinct(Home home, View0 x0, View1 x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, View1 y);
};
template<class View0>
class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
protected:
using UnaryPropagator<View0,PC_SET_ANY>::x0;
ConstSetView y;
DistinctDoit(Space& home, DistinctDoit&);
DistinctDoit(Home home, View0 x0, ConstSetView y);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x, ConstSetView y);
};
}}}
#include <gecode/set/rel/common.hpp>
#include <gecode/set/rel/subset.hpp>
#include <gecode/set/rel/nosubset.hpp>
#include <gecode/set/rel/re-subset.hpp>
#include <gecode/set/rel/eq.hpp>
#include <gecode/set/rel/re-eq.hpp>
#include <gecode/set/rel/nq.hpp>
#include <gecode/set/rel/lq.hpp>
#include <gecode/set/rel/re-lq.hpp>
#endif
// STATISTICS: set-prop
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::BoolView
Boolean view for Boolean variables.
Definition view.hpp:1380
Gecode::MixBinaryPropagator< View0, PC_SET_CGLB, View1, PC_SET_CLUB >::x1
View1 x1
Definition pattern.hpp:209
Gecode::MixBinaryPropagator< View0, PC_SET_CGLB, View1, PC_SET_CLUB >::MixBinaryPropagator
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
Definition pattern.hpp:597
Gecode::MixBinaryPropagator< View0, PC_SET_CGLB, View1, PC_SET_CLUB >::x0
View0 x0
Definition pattern.hpp:207
Gecode::PropCost
Propagation cost.
Definition core.hpp:486
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::Set::ConstSetView
Constant view.
Definition view.hpp:186
Gecode::Set::Rel::DistinctDoit::DistinctDoit
DistinctDoit(Space &home, DistinctDoit &)
Constructor for cloning p.
Definition nq.hpp:150
Gecode::Set::Rel::DistinctDoit::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:106
Gecode::Set::Rel::DistinctDoit::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:112
Gecode::Set::Rel::DistinctDoit::post
static ExecStatus post(Home home, View0 x, ConstSetView y)
Post propagator .
Definition nq.hpp:99
Gecode::Set::Rel::DistinctDoit::y
ConstSetView y
The view that is already assigned.
Definition rel.hh:300
Gecode::Set::Rel::Distinct::Distinct
Distinct(Space &home, Distinct &p)
Constructor for cloning p.
Definition nq.hpp:49
Gecode::Set::Rel::Distinct::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:76
Gecode::Set::Rel::Distinct::post
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition nq.hpp:55
Gecode::Set::Rel::Distinct::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:82
Gecode::Set::Rel::Eq::Eq
Eq(Space &home, Eq &p)
Constructor for cloning p.
Definition eq.hpp:49
Gecode::Set::Rel::Eq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:68
Gecode::Set::Rel::Eq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:62
Gecode::Set::Rel::Eq::post
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition eq.hpp:54
Gecode::Set::Rel::Lq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq.hpp:336
Gecode::Set::Rel::Lq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq.hpp:342
Gecode::Set::Rel::Lq::Lq
Lq(Space &home, Lq &p)
Constructor for cloning p.
Definition lq.hpp:320
Gecode::Set::Rel::Lq::post
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition lq.hpp:325
Gecode::Set::Rel::NoSubset::post
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition nosubset.hpp:59
Gecode::Set::Rel::NoSubset::NoSubset
NoSubset(Space &home, NoSubset &p)
Constructor for cloning p.
Definition nosubset.hpp:53
Gecode::Set::Rel::NoSubset::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nosubset.hpp:76
Gecode::Set::Rel::NoSubset::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nosubset.hpp:70
Gecode::Set::Rel::ReEq::post
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition re-eq.hpp:86
Gecode::Set::Rel::ReEq::b
CtrlView b
Definition rel.hh:178
Gecode::Set::Rel::ReEq::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO).
Definition re-eq.hpp:62
Gecode::Set::Rel::ReEq::ReEq
ReEq(Space &home, ReEq &)
Constructor for cloning p.
Definition re-eq.hpp:53
Gecode::Set::Rel::ReEq::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-eq.hpp:76
Gecode::Set::Rel::ReEq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-eq.hpp:104
Gecode::Set::Rel::ReEq::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition re-eq.hpp:68
Gecode::Set::Rel::ReEq::x0
View0 x0
Definition rel.hh:176
Gecode::Set::Rel::ReEq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-eq.hpp:98
Gecode::Set::Rel::ReEq::x1
View1 x1
Definition rel.hh:177
Gecode::Set::Rel::ReLq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-lq.hpp:108
Gecode::Set::Rel::ReLq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-lq.hpp:102
Gecode::Set::Rel::ReLq::b
Gecode::Int::BoolView b
Definition rel.hh:238
Gecode::Set::Rel::ReLq::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-lq.hpp:72
Gecode::Set::Rel::ReLq::x0
View0 x0
Definition rel.hh:236
Gecode::Set::Rel::ReLq::x1
View1 x1
Definition rel.hh:237
Gecode::Set::Rel::ReLq::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO).
Definition re-lq.hpp:57
Gecode::Set::Rel::ReLq::post
static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b)
Post propagator for .
Definition re-lq.hpp:82
Gecode::Set::Rel::ReLq::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition re-lq.hpp:64
Gecode::Set::Rel::ReLq::ReLq
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
Definition re-lq.hpp:48
Gecode::Set::Rel::ReSubset::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-subset.hpp:75
Gecode::Set::Rel::ReSubset::b
CtrlView b
Boolean control view.
Definition rel.hh:122
Gecode::Set::Rel::ReSubset::x0
View0 x0
Variable view.
Definition rel.hh:118
Gecode::Set::Rel::ReSubset::ReSubset
ReSubset(Space &home, ReSubset &p)
Constructor for cloning p.
Definition re-subset.hpp:50
Gecode::Set::Rel::ReSubset::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition re-subset.hpp:67
Gecode::Set::Rel::ReSubset::x1
View1 x1
Variable view.
Definition rel.hh:120
Gecode::Set::Rel::ReSubset::post
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition re-subset.hpp:85
Gecode::Set::Rel::ReSubset::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-subset.hpp:97
Gecode::Set::Rel::ReSubset::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as ternary low).
Definition re-subset.hpp:60
Gecode::Set::Rel::ReSubset::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-subset.hpp:103
Gecode::Set::Rel::Subset::Subset
Subset(Space &home, Subset &p)
Constructor for cloning p.
Definition subset.hpp:50
Gecode::Set::Rel::Subset::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition subset.hpp:63
Gecode::Set::Rel::Subset::post
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition subset.hpp:55
Gecode::Set::Rel::Subset::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition subset.hpp:69
Gecode::UnaryPropagator< View0, PC_SET_ANY >::x0
View0 x0
Definition pattern.hpp:58
Gecode::UnaryPropagator< View0, PC_SET_ANY >::UnaryPropagator
UnaryPropagator(Space &home, UnaryPropagator &p)
set.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::Int::Rel
Simple relation propagators.
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode::Set::PC_SET_CLUB
const Gecode::PropCond PC_SET_CLUB
Propagate when the cardinality or the least upper bound of a view changes.
Definition var-type.hpp:227
Gecode::Set::PC_SET_VAL
const Gecode::PropCond PC_SET_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:207
Gecode::Set::PC_SET_ANY
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition var-type.hpp:248
Gecode::Set::PC_SET_CGLB
const Gecode::PropCond PC_SET_CGLB
Propagate when the cardinality or the greatest lower bound of a view changes.
Definition var-type.hpp:238
Gecode
Gecode toplevel namespace
Gecode::same
bool same(VarArgArray< Var > x, VarArgArray< Var > y)
Definition array.hpp:1937
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
nosubset.hpp
re-eq.hpp
re-lq.hpp
re-subset.hpp
common.hpp
eq.hpp
lq.hpp
nq.hpp
subset.hpp