element.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>
*
* Copyright:
* Guido Tack, 2004
* Christian Schulte, 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_SELECT_HH__
#define __GECODE_SET_SELECT_HH__
#include <gecode/set.hh>
#include <gecode/int/idx-view.hh>
#include <gecode/int/element.hh>
#include <gecode/set/rel.hh>
#include <gecode/set/rel-op.hh>
namespace Gecode { namespace Int {
template<>
class ViewToVarArg<Gecode::Set::SetView> {
public:
typedef Gecode::SetVarArgs argtype;
};
template<>
class ViewToVarArg<Gecode::Set::SingletonView> {
public:
typedef Gecode::IntVarArgs argtype;
};
}}
namespace Gecode { namespace Set { namespace Element {
template<class View, class View0, class View1>
class ElementIntersection : public Propagator {
public:
typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
protected:
IntSet universe;
IdxViewArray iv;
View0 x0;
View1 x1;
ElementIntersection(Space& home, ElementIntersection& p);
ElementIntersection(Home home, IdxViewArray&,View0,View1,
const IntSet& universe);
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,IdxViewArray& x, View0 y,
View1 z, const IntSet& u);
};
template<class View, class View0, class View1>
class ElementUnion : public Propagator {
public:
typedef Gecode::Int::IdxViewArray<View> IdxViewArray;
protected:
IdxViewArray iv;
View0 x0;
View1 x1;
ElementUnion(Space& home, ElementUnion& p);
ElementUnion(Home home,IdxViewArray&,View0,View1);
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,IdxViewArray& x,View0 y, View1 z);
};
template<class SView, class RView>
class ElementUnionConst : public Propagator {
protected:
SView x0;
IntSet* iv;
int n_iv;
RView x1;
ElementUnionConst(Space& home, ElementUnionConst& p);
ElementUnionConst(Home home, SView, const IntSetArgs&, RView);
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,SView z,const IntSetArgs& x,RView y);
};
template<class SView, class RView>
class ElementDisjoint : public Propagator {
public:
typedef Gecode::Int::IdxViewArray<SView> IdxViewArray;
protected:
IdxViewArray iv;
RView x1;
ElementDisjoint(Space& home, ElementDisjoint& p);
ElementDisjoint(Home home,IdxViewArray&,RView);
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,IdxViewArray& x,RView y);
};
}}}
#include <gecode/set/element/inter.hpp>
#include <gecode/set/element/union.hpp>
#include <gecode/set/element/unionConst.hpp>
#include <gecode/set/element/disjoint.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::IntSet
Integer sets.
Definition int.hh:174
Gecode::IntVarArgs
Passing integer variables.
Definition int.hh:656
Gecode::Int::IdxViewArray
An array of IdxView pairs.
Definition idx-view.hh:67
Gecode::Int::ViewToVarArg< Gecode::Set::SetView >::argtype
Gecode::SetVarArgs argtype
Definition element.hh:52
Gecode::Int::ViewToVarArg< Gecode::Set::SingletonView >::argtype
Gecode::IntVarArgs argtype
Definition element.hh:59
Gecode::Int::ViewToVarArg
Class to map VarArg type to view.
Definition idx-view.hh:60
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::SetVarArgs
Passing set variables.
Definition set.hh:488
Gecode::Set::Element::ElementDisjoint::x1
RView x1
Definition element.hh:199
Gecode::Set::Element::ElementDisjoint::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition disjoint.hpp:74
Gecode::Set::Element::ElementDisjoint::IdxViewArray
Gecode::Int::IdxViewArray< SView > IdxViewArray
Definition element.hh:196
Gecode::Set::Element::ElementDisjoint::ElementDisjoint
ElementDisjoint(Space &home, ElementDisjoint &p)
Constructor for cloning p.
Definition disjoint.hpp:51
Gecode::Set::Element::ElementDisjoint::post
static ExecStatus post(Home home, IdxViewArray &x, RView y)
Post propagator for .
Definition disjoint.hpp:60
Gecode::Set::Element::ElementDisjoint::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition disjoint.hpp:96
Gecode::Set::Element::ElementDisjoint::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition disjoint.hpp:80
Gecode::Set::Element::ElementDisjoint::iv
IdxViewArray iv
Definition element.hh:198
Gecode::Set::Element::ElementDisjoint::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition disjoint.hpp:87
Gecode::Set::Element::ElementDisjoint::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition disjoint.hpp:102
Gecode::Set::Element::ElementIntersection::ElementIntersection
ElementIntersection(Space &home, ElementIntersection &p)
Constructor for cloning p.
Gecode::Set::Element::ElementIntersection::IdxViewArray
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition element.hh:80
Gecode::Set::Element::ElementIntersection::universe
IntSet universe
Definition element.hh:82
Gecode::Set::Element::ElementIntersection::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition inter.hpp:106
Gecode::Set::Element::ElementIntersection::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition inter.hpp:77
Gecode::Set::Element::ElementIntersection::x1
View1 x1
Definition element.hh:85
Gecode::Set::Element::ElementIntersection::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition inter.hpp:62
Gecode::Set::Element::ElementIntersection::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition inter.hpp:112
Gecode::Set::Element::ElementIntersection::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition inter.hpp:69
Gecode::Set::Element::ElementIntersection::iv
IdxViewArray iv
Definition element.hh:83
Gecode::Set::Element::ElementIntersection::x0
View0 x0
Definition element.hh:84
Gecode::Set::Element::ElementIntersection::post
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Definition inter.hpp:92
Gecode::Set::Element::ElementUnionConst::n_iv
int n_iv
Definition element.hh:161
Gecode::Set::Element::ElementUnionConst::ElementUnionConst
ElementUnionConst(Space &home, ElementUnionConst &p)
Constructor for cloning p.
Definition unionConst.hpp:56
Gecode::Set::Element::ElementUnionConst::post
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
Definition unionConst.hpp:95
Gecode::Set::Element::ElementUnionConst::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition unionConst.hpp:73
Gecode::Set::Element::ElementUnionConst::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition unionConst.hpp:80
Gecode::Set::Element::ElementUnionConst::x1
RView x1
Definition element.hh:162
Gecode::Set::Element::ElementUnionConst::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition unionConst.hpp:109
Gecode::Set::Element::ElementUnionConst::iv
IntSet * iv
Definition element.hh:160
Gecode::Set::Element::ElementUnionConst::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition unionConst.hpp:115
Gecode::Set::Element::ElementUnionConst::x0
SView x0
Definition element.hh:159
Gecode::Set::Element::ElementUnionConst::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition unionConst.hpp:67
Gecode::Set::Element::ElementUnion::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition union.hpp:68
Gecode::Set::Element::ElementUnion::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition union.hpp:109
Gecode::Set::Element::ElementUnion::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition union.hpp:76
Gecode::Set::Element::ElementUnion::post
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
Definition union.hpp:90
Gecode::Set::Element::ElementUnion::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition union.hpp:61
Gecode::Set::Element::ElementUnion::ElementUnion
ElementUnion(Space &home, ElementUnion &p)
Constructor for cloning p.
Gecode::Set::Element::ElementUnion::x1
View1 x1
Definition element.hh:125
Gecode::Set::Element::ElementUnion::IdxViewArray
Gecode::Int::IdxViewArray< View > IdxViewArray
Definition element.hh:121
Gecode::Set::Element::ElementUnion::iv
IdxViewArray iv
Definition element.hh:123
Gecode::Set::Element::ElementUnion::x0
View0 x0
Definition element.hh:124
Gecode::Set::Element::ElementUnion::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition union.hpp:103
Gecode::Set::SetView
Set view for set variables
Definition view.hpp:56
Gecode::Set::SingletonView
Singleton set view.
Definition view.hpp:594
disjoint.hpp
inter.hpp
union.hpp
set.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
idx-view.hh
element.hh
Gecode::Int::Element
Element propagators
Gecode::Int
Finite domain integers.
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode
Gecode toplevel namespace
Gecode::IntSetArgs
ArgArray< IntSet > IntSetArgs
Passing set arguments.
Definition int.hh:619
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
rel-op.hh
rel.hh
unionConst.hpp