extensional.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Linnea Ingmar <linnea.ingmar@hotmail.com>
* Mikael Lagerkvist <lagerkvist@gecode.org>
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Linnea Ingmar, 2017
* Mikael Lagerkvist, 2007
* 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_INT_EXTENSIONAL_HH__
#define __GECODE_INT_EXTENSIONAL_HH__
#include <gecode/int.hh>
#include <gecode/int/rel.hh>
namespace Gecode { namespace Int { namespace Extensional {
template<class View, class Val, class Degree, class StateIdx>
class LayeredGraph : public Propagator {
protected:
class State {
public:
Degree i_deg;
Degree o_deg;
void init(void);
};
class Edge {
public:
StateIdx i_state;
StateIdx o_state;
};
class Support {
public:
Val val;
Degree n_edges;
Edge* edges;
};
typedef typename Gecode::Support::IntTypeTraits<Val>::utype ValSize;
class Layer {
public:
View x;
StateIdx n_states;
ValSize size;
State* states;
Support* support;
};
class LayerValues {
private:
const Support* s1;
const Support* s2;
public:
LayerValues(void);
LayerValues(const Layer& l);
void init(const Layer& l);
bool operator ()(void) const;
void operator ++(void);
int val(void) const;
};
class Index : public Advisor {
public:
int i;
Index(Space& home, Propagator& p, Council<Index>& c, int i);
Index(Space& home, Index& a);
};
class IndexRange {
private:
int _fst;
int _lst;
public:
IndexRange(void);
void reset(void);
void add(int i);
void add(const IndexRange& ir);
void lshift(int n);
bool empty(void) const;
int fst(void) const;
int lst(void) const;
};
Council<Index> c;
int n;
Layer* layers;
StateIdx max_states;
unsigned int n_states;
unsigned int n_edges;
IndexRange i_ch;
IndexRange o_ch;
IndexRange a_ch;
State& i_state(int i, StateIdx is);
State& i_state(int i, const Edge& e);
bool i_dec(int i, const Edge& e);
State& o_state(int i, StateIdx os);
State& o_state(int i, const Edge& e);
bool o_dec(int i, const Edge& e);
void audit(void);
template<class Var>
ExecStatus initialize(Space& home,
const VarArgArray<Var>& x, const DFA& dfa);
LayeredGraph(Space& home, LayeredGraph<View,Val,Degree,StateIdx>& p);
public:
template<class Var>
LayeredGraph(Home home,
const VarArgArray<Var>& x, const DFA& dfa);
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual size_t dispose(Space& home);
template<class Var>
static ExecStatus post(Home home,
const VarArgArray<Var>& x, const DFA& dfa);
};
template<class Var>
ExecStatus post_lgp(Home home,
const VarArgArray<Var>& x, const DFA& dfa);
}}}
#include <gecode/int/extensional/layered-graph.hpp>
namespace Gecode { namespace Int { namespace Extensional {
typedef Gecode::Support::BitSetData BitSetData;
/*
* Forward declarations
*/
template<unsigned int size> class TinyBitSet;
template<class IndexType>
class BitSet {
template<class> friend class BitSet;
template<unsigned int> friend class TinyBitSet;
protected:
IndexType _limit;
IndexType* _index;
BitSetData* _bits;
void replace_and_decrease(IndexType i, BitSetData w);
public:
BitSet(Space& home, unsigned int n);
template<class OldIndexType>
BitSet(Space& home, const BitSet<OldIndexType>& bs);
BitSet(Space& home, const TinyBitSet<1U>& tbs);
BitSet(Space& home, const TinyBitSet<2U>& tbs);
BitSet(Space& home, const TinyBitSet<3U>& tbs);
BitSet(Space& home, const TinyBitSet<4U>& tbs);
unsigned int limit(void) const;
bool empty(void) const;
void flush(void);
unsigned int width(void) const;
void clear_mask(BitSetData* mask) const;
void add_to_mask(const BitSetData* b, BitSetData* mask) const;
template<bool sparse>
void intersect_with_mask(const BitSetData* mask);
void intersect_with_masks(const BitSetData* a, const BitSetData* b);
bool intersects(const BitSetData* b) const;
void nand_with_mask(const BitSetData* b);
unsigned long long int ones(void) const;
unsigned long long int ones(const BitSetData* b) const;
unsigned long long int bits(void) const;
unsigned int words(void) const;
unsigned int size(void) const;
};
}}}
#include <gecode/int/extensional/bit-set.hpp>
namespace Gecode { namespace Int { namespace Extensional {
template<unsigned int _size>
class TinyBitSet {
template<unsigned int> friend class TinyBitSet;
protected:
BitSetData _bits[_size];
public:
TinyBitSet(Space& home, unsigned int n);
template<unsigned int largersize>
TinyBitSet(Space& home, const TinyBitSet<largersize>& tbs);
template<class IndexType>
TinyBitSet(Space& home, const BitSet<IndexType>& bs);
int limit(void) const;
bool empty(void) const;
void flush(void);
unsigned int width(void) const;
void clear_mask(BitSetData* mask);
void add_to_mask(const BitSetData* b, BitSetData* mask) const;
template<bool sparse>
void intersect_with_mask(const BitSetData* mask);
void intersect_with_masks(const BitSetData* a, const BitSetData* b);
bool intersects(const BitSetData* b);
void nand_with_mask(const BitSetData* b);
void nand_with_masks(const BitSetData* a, const BitSetData* b);
unsigned long long int ones(void) const;
unsigned long long int ones(const BitSetData* b) const;
unsigned long long int bits(void) const;
unsigned int words(void) const;
unsigned int size(void) const;
};
}}}
#include <gecode/int/extensional/tiny-bit-set.hpp>
namespace Gecode { namespace Int { namespace Extensional {
typedef TupleSet::Tuple Tuple;
template<class View, bool pos>
class Compact : public Propagator {
protected:
typedef TupleSet::Range Range;
class CTAdvisor : public ViewAdvisor<View> {
public:
using ViewAdvisor<View>::view;
protected:
const Range* _fst;
const Range* _lst;
public:
CTAdvisor(Space& home, Propagator& p, Council<CTAdvisor>& c,
const TupleSet& ts, View x0, int i);
CTAdvisor(Space& home, CTAdvisor& a);
void adjust(void);
const Range* fst(void) const;
const Range* lst(void) const;
void dispose(Space& home, Council<CTAdvisor>& c);
};
class ValidSupports {
protected:
const unsigned int n_words;
int max;
ViewRanges<View> xr;
const Range* sr;
const Range* lst;
int n;
const BitSetData* s;
void find(void);
public:
ValidSupports(const Compact<View,pos>& p, CTAdvisor& a);
ValidSupports(const TupleSet& ts, int i, View x);
void operator ++(void);
bool operator ()(void) const;
const BitSetData* supports(void) const;
int val(void) const;
};
class LostSupports {
protected:
const unsigned int n_words;
const Range* r;
const Range* lst;
int l;
int h;
const BitSetData* s;
public:
LostSupports(const Compact<View,pos>& p, CTAdvisor& a,
int l, int h);
void operator ++(void);
bool operator ()(void) const;
const BitSetData* supports(void) const;
};
bool all(void) const;
bool atmostone(void) const;
protected:
const unsigned int n_words;
TupleSet ts;
Council<CTAdvisor> c;
Compact(Space& home, Compact& p);
Compact(Home home, const TupleSet& ts);
template<class Table>
void setup(Space& home, Table& table, ViewArray<View>& x);
template<class Table>
bool full(const Table& table) const;
const Range* range(CTAdvisor& a, int n);
const BitSetData* supports(CTAdvisor& a, int n);
public:
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
size_t dispose(Space& home);
};
template<class View, class Table>
class PosCompact : public Compact<View,true> {
public:
typedef typename Compact<View,true>::ValidSupports ValidSupports;
typedef typename Compact<View,true>::Range Range;
typedef typename Compact<View,true>::CTAdvisor CTAdvisor;
typedef typename Compact<View,true>::LostSupports LostSupports;
using Compact<View,true>::setup;
using Compact<View,true>::supports;
using Compact<View,true>::all;
using Compact<View,true>::atmostone;
using Compact<View,true>::c;
using Compact<View,true>::ts;
enum StatusType {
SINGLE = 0,
MULTIPLE = 1,
NONE = 2,
PROPAGATING = 3
};
class Status {
protected:
ptrdiff_t s;
public:
Status(StatusType t);
Status(const Status& s);
StatusType type(void) const;
bool single(CTAdvisor& a) const;
void touched(CTAdvisor& a);
void none(void);
void propagating(void);
};
Status status;
Table table;
bool empty(void) const;
template<class TableProp>
PosCompact(Space& home, TableProp& p);
PosCompact(Home home, ViewArray<View>& x, const TupleSet& ts);
public:
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual Actor* copy(Space& home);
static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts);
size_t dispose(Space& home);
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
};
template<class View>
ExecStatus postposcompact(Home home, ViewArray<View>& x, const TupleSet& ts);
template<class View, class Table>
class NegCompact : public Compact<View,false> {
public:
typedef typename Compact<View,false>::ValidSupports ValidSupports;
typedef typename Compact<View,false>::Range Range;
typedef typename Compact<View,false>::CTAdvisor CTAdvisor;
using Compact<View,false>::setup;
using Compact<View,false>::full;
using Compact<View,false>::supports;
using Compact<View,false>::atmostone;
using Compact<View,false>::c;
using Compact<View,false>::ts;
Table table;
template<class TableProp>
NegCompact(Space& home, TableProp& p);
NegCompact(Home home, ViewArray<View>& x, const TupleSet& ts);
public:
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual Actor* copy(Space& home);
static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts);
size_t dispose(Space& home);
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
};
template<class View>
ExecStatus postnegcompact(Home home, ViewArray<View>& x, const TupleSet& ts);
template<class View, class Table, class CtrlView, ReifyMode rm>
class ReCompact : public Compact<View,false> {
public:
typedef typename Compact<View,false>::ValidSupports ValidSupports;
typedef typename Compact<View,false>::Range Range;
typedef typename Compact<View,false>::CTAdvisor CTAdvisor;
using Compact<View,false>::setup;
using Compact<View,false>::full;
using Compact<View,false>::supports;
using Compact<View,false>::c;
using Compact<View,false>::ts;
Table table;
CtrlView b;
ViewArray<View> y;
template<class TableProp>
ReCompact(Space& home, TableProp& p);
ReCompact(Home home, ViewArray<View>& x, const TupleSet& ts, CtrlView b);
public:
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual Actor* copy(Space& home);
static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts,
CtrlView b);
size_t dispose(Space& home);
virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
};
template<class View, class CtrlView, ReifyMode rm>
ExecStatus postrecompact(Home home, ViewArray<View>& x, const TupleSet& ts,
CtrlView b);
}}}
#include <gecode/int/extensional/compact.hpp>
#endif
// STATISTICS: int-prop
bit-set.hpp
Gecode::ActorLink::init
void init(void)
Initialize links (self-linked).
Definition core.hpp:3154
Gecode::ActorLink::Space
friend class Space
Definition core.hpp:595
Gecode::ActorLink::Propagator
friend class Propagator
Definition core.hpp:591
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::Advisor::Advisor
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Definition core.hpp:3831
Gecode::Advisor::Council
friend class Council
Definition core.hpp:1294
Gecode::DFA
Deterministic finite automaton (DFA).
Definition int.hh:2049
Gecode::Delta
Generic domain change information to be supplied to advisors.
Definition core.hpp:204
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::Extensional::BitSet
Bit-set.
Definition extensional.hh:235
Gecode::Int::Extensional::BitSet::bits
unsigned long long int bits(void) const
Return an upper bound on the number of bits.
Definition bit-set.hpp:247
Gecode::Int::Extensional::BitSet::intersect_with_mask
void intersect_with_mask(const BitSetData *mask)
Intersect with mask, sparse mask if sparse is true.
Definition bit-set.hpp:168
Gecode::Int::Extensional::BitSet::width
unsigned int width(void) const
Return the highest active index.
Definition bit-set.hpp:66
Gecode::Int::Extensional::BitSet::replace_and_decrease
void replace_and_decrease(IndexType i, BitSetData w)
Replace the i th word with w, decrease limit if w is zero.
Definition bit-set.hpp:133
Gecode::Int::Extensional::BitSet::ones
unsigned long long int ones(void) const
Return the number of ones.
Definition bit-set.hpp:238
Gecode::Int::Extensional::BitSet::intersects
bool intersects(const BitSetData *b) const
Check if has a non-empty intersection with the set.
Definition bit-set.hpp:219
Gecode::Int::Extensional::BitSet::_limit
IndexType _limit
Limit.
Definition extensional.hh:240
Gecode::Int::Extensional::BitSet::intersect_with_masks
void intersect_with_masks(const BitSetData *a, const BitSetData *b)
Intersect with the "or" of and b.
Definition bit-set.hpp:191
Gecode::Int::Extensional::BitSet::_bits
BitSetData * _bits
Words.
Definition extensional.hh:244
Gecode::Int::Extensional::BitSet::add_to_mask
void add_to_mask(const BitSetData *b, BitSetData *mask) const
Add to mask.
Definition bit-set.hpp:159
Gecode::Int::Extensional::BitSet::_index
IndexType * _index
Indices.
Definition extensional.hh:242
Gecode::Int::Extensional::BitSet::size
unsigned int size(void) const
Return the number of required bit set words.
Definition bit-set.hpp:60
Gecode::Int::Extensional::BitSet::limit
unsigned int limit(void) const
Get the limit.
Definition bit-set.hpp:42
Gecode::Int::Extensional::BitSet::clear_mask
void clear_mask(BitSetData *mask) const
Clear the first limit words in mask.
Definition bit-set.hpp:149
Gecode::Int::Extensional::BitSet::BitSet
friend class BitSet
Definition extensional.hh:236
Gecode::Int::Extensional::BitSet::empty
bool empty(void) const
Check whether the set is empty.
Definition bit-set.hpp:48
Gecode::Int::Extensional::BitSet::words
unsigned int words(void) const
Return the number of required bit set words.
Definition bit-set.hpp:54
Gecode::Int::Extensional::BitSet::flush
void flush(void)
Make the set empty.
Definition bit-set.hpp:105
Gecode::Int::Extensional::BitSet::nand_with_mask
void nand_with_mask(const BitSetData *b)
Perform "nand" with b.
Definition bit-set.hpp:207
Gecode::Int::Extensional::BitSet::TinyBitSet
friend class TinyBitSet
Definition extensional.hh:237
Gecode::Int::Extensional::Compact::CTAdvisor
Advisor for updating current table.
Definition extensional.hh:367
Gecode::Int::Extensional::Compact::CTAdvisor::lst
const Range * lst(void) const
Return lasst range of support data structure.
Definition compact.hpp:99
Gecode::Int::Extensional::Compact::CTAdvisor::_lst
const Range * _lst
Last range of support data structure.
Definition extensional.hh:374
Gecode::Int::Extensional::Compact::CTAdvisor::fst
const Range * fst(void) const
Return first range of support data structure.
Definition compact.hpp:93
Gecode::Int::Extensional::Compact::CTAdvisor::adjust
void adjust(void)
Adjust supports.
Definition compact.hpp:47
Gecode::Int::Extensional::Compact::CTAdvisor::dispose
void dispose(Space &home, Council< CTAdvisor > &c)
Dispose advisor.
Definition compact.hpp:105
Gecode::Int::Extensional::Compact::CTAdvisor::CTAdvisor
CTAdvisor(Space &home, Propagator &p, Council< CTAdvisor > &c, const TupleSet &ts, View x0, int i)
Initialise from parameters.
Definition compact.hpp:80
Gecode::Int::Extensional::Compact::CTAdvisor::_fst
const Range * _fst
First range of support data structure.
Definition extensional.hh:372
Gecode::Int::Extensional::Compact::LostSupports
Iterator over lost supports.
Definition extensional.hh:430
Gecode::Int::Extensional::Compact::LostSupports::s
const BitSetData * s
The lost value's support.
Definition extensional.hh:443
Gecode::Int::Extensional::Compact::LostSupports::h
int h
High value.
Definition extensional.hh:441
Gecode::Int::Extensional::Compact::LostSupports::operator()
bool operator()(void) const
Whether iterator is done.
Definition compact.hpp:307
Gecode::Int::Extensional::Compact::LostSupports::supports
const BitSetData * supports(void) const
Provide access to corresponding supports.
Definition compact.hpp:312
Gecode::Int::Extensional::Compact::LostSupports::operator++
void operator++(void)
Move iterator to next value.
Definition compact.hpp:299
Gecode::Int::Extensional::Compact::LostSupports::LostSupports
LostSupports(const Compact< View, pos > &p, CTAdvisor &a, int l, int h)
Initialize iterator for values between l and h.
Definition compact.hpp:288
Gecode::Int::Extensional::Compact::LostSupports::l
int l
Low value.
Definition extensional.hh:439
Gecode::Int::Extensional::Compact::LostSupports::r
const Range * r
Range information.
Definition extensional.hh:435
Gecode::Int::Extensional::Compact::LostSupports::n_words
const unsigned int n_words
Number of words.
Definition extensional.hh:433
Gecode::Int::Extensional::Compact::LostSupports::lst
const Range * lst
Last range.
Definition extensional.hh:437
Gecode::Int::Extensional::Compact::ValidSupports
Iterator over valid supports.
Definition extensional.hh:397
Gecode::Int::Extensional::Compact::ValidSupports::operator()
bool operator()(void) const
Whether there are still supports left.
Definition compact.hpp:266
Gecode::Int::Extensional::Compact::ValidSupports::supports
const BitSetData * supports(void) const
Return supports.
Definition compact.hpp:271
Gecode::Int::Extensional::Compact::ValidSupports::n
int n
The value.
Definition extensional.hh:410
Gecode::Int::Extensional::Compact::ValidSupports::lst
const Range * lst
The last range.
Definition extensional.hh:408
Gecode::Int::Extensional::Compact::ValidSupports::operator++
void operator++(void)
Move to next supports.
Definition compact.hpp:239
Gecode::Int::Extensional::Compact::ValidSupports::xr
ViewRanges< View > xr
Range iterator.
Definition extensional.hh:404
Gecode::Int::Extensional::Compact::ValidSupports::ValidSupports
ValidSupports(const Compact< View, pos > &p, CTAdvisor &a)
Initialize from initialized propagator.
Definition compact.hpp:209
Gecode::Int::Extensional::Compact::ValidSupports::max
int max
Maximal value.
Definition extensional.hh:402
Gecode::Int::Extensional::Compact::ValidSupports::sr
const Range * sr
Support iterator.
Definition extensional.hh:406
Gecode::Int::Extensional::Compact::ValidSupports::find
void find(void)
Find a new value (only for negative case).
Definition compact.hpp:179
Gecode::Int::Extensional::Compact::ValidSupports::s
const BitSetData * s
The value's support.
Definition extensional.hh:412
Gecode::Int::Extensional::Compact::ValidSupports::n_words
const unsigned int n_words
Number of words.
Definition extensional.hh:400
Gecode::Int::Extensional::Compact::ValidSupports::val
int val(void) const
Return supported value.
Definition compact.hpp:277
Gecode::Int::Extensional::Compact::Compact
Compact(Space &home, Compact &p)
Constructor for cloning p.
Definition compact.hpp:335
Gecode::Int::Extensional::Compact::dispose
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:402
Gecode::Int::Extensional::Compact::ts
TupleSet ts
The tuple set.
Definition extensional.hh:467
Gecode::Int::Extensional::Compact::Compact
Compact(Home home, const TupleSet &ts)
Constructor for posting.
Definition compact.hpp:342
Gecode::Int::Extensional::Compact::supports
const BitSetData * supports(CTAdvisor &a, int n)
Return supports for value n.
Definition compact.hpp:148
Gecode::Int::Extensional::Compact::full
bool full(const Table &table) const
Check whether the table covers the whole Cartedion product.
Definition compact.hpp:379
Gecode::Int::Extensional::Compact::setup
void setup(Space &home, Table &table, ViewArray< View > &x)
Setup the actual table.
Definition compact.hpp:350
Gecode::Int::Extensional::Compact< View, true >::ValidSupports::n_words
const unsigned int n_words
Definition extensional.hh:465
Gecode::Int::Extensional::Compact::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition compact.hpp:391
Gecode::Int::Extensional::Compact::all
bool all(void) const
Whether all variables are assigned.
Definition compact.hpp:320
Gecode::Int::Extensional::Compact::range
const Range * range(CTAdvisor &a, int n)
Find range for n.
Definition compact.hpp:116
Gecode::Int::Extensional::Compact::atmostone
bool atmostone(void) const
Whether at most one variable is unassigned.
Definition compact.hpp:326
Gecode::Int::Extensional::Compact::Range
TupleSet::Range Range
Range type for supports.
Definition extensional.hh:365
Gecode::Int::Extensional::Compact::c
Council< CTAdvisor > c
The advisor council.
Definition extensional.hh:469
Gecode::Int::Extensional::LayeredGraph::Edge
Edge defined by in-state and out-state
Definition extensional.hh:78
Gecode::Int::Extensional::LayeredGraph::Edge::o_state
StateIdx o_state
Number of out-state.
Definition extensional.hh:81
Gecode::Int::Extensional::LayeredGraph::Edge::i_state
StateIdx i_state
Number of in-state.
Definition extensional.hh:80
Gecode::Int::Extensional::LayeredGraph::IndexRange
Range approximation of which positions have changed.
Definition extensional.hh:131
Gecode::Int::Extensional::LayeredGraph::IndexRange::reset
void reset(void)
Reset range to be empty.
Definition layered-graph.hpp:180
Gecode::Int::Extensional::LayeredGraph::IndexRange::add
void add(const IndexRange &ir)
Add index range ir to range.
Gecode::Int::Extensional::LayeredGraph::IndexRange::add
void add(int i)
Add index i to range.
Definition layered-graph.hpp:185
Gecode::Int::Extensional::LayeredGraph::IndexRange::fst
int fst(void) const
Return first position.
Definition layered-graph.hpp:213
Gecode::Int::Extensional::LayeredGraph::IndexRange::lshift
void lshift(int n)
Shift index range by n elements to the left.
Definition layered-graph.hpp:201
Gecode::Int::Extensional::LayeredGraph::IndexRange::lst
int lst(void) const
Return last position.
Definition layered-graph.hpp:218
Gecode::Int::Extensional::LayeredGraph::IndexRange::empty
bool empty(void) const
Test whether range is empty.
Definition layered-graph.hpp:196
Gecode::Int::Extensional::LayeredGraph::IndexRange::IndexRange
IndexRange(void)
Initialize range as empty.
Definition layered-graph.hpp:176
Gecode::Int::Extensional::LayeredGraph::Index::Index
Index(Space &home, Propagator &p, Council< Index > &c, int i)
Create index advisor.
Definition layered-graph.hpp:159
Gecode::Int::Extensional::LayeredGraph::Index::i
int i
The position of the view in the view array.
Definition extensional.hh:124
Gecode::Int::Extensional::LayeredGraph::LayerValues::operator()
bool operator()(void) const
Test whether more values supported.
Definition layered-graph.hpp:138
Gecode::Int::Extensional::LayeredGraph::LayerValues::operator++
void operator++(void)
Move to next supported value.
Definition layered-graph.hpp:143
Gecode::Int::Extensional::LayeredGraph::LayerValues::LayerValues
LayerValues(void)
Default constructor.
Definition layered-graph.hpp:124
Gecode::Int::Extensional::LayeredGraph::LayerValues::val
int val(void) const
Return supported value.
Definition layered-graph.hpp:148
Gecode::Int::Extensional::LayeredGraph::Layer
Layer for a view in the layered graph
Definition extensional.hh:93
Gecode::Int::Extensional::LayeredGraph::Layer::support
Support * support
Supported values.
Definition extensional.hh:99
Gecode::Int::Extensional::LayeredGraph::Layer::x
View x
Integer view.
Definition extensional.hh:95
Gecode::Int::Extensional::LayeredGraph::Layer::states
State * states
States used by outgoing edges.
Definition extensional.hh:98
Gecode::Int::Extensional::LayeredGraph::Layer::size
ValSize size
Number of supported values.
Definition extensional.hh:97
Gecode::Int::Extensional::LayeredGraph::Layer::n_states
StateIdx n_states
Number of states used by outgoing edges.
Definition extensional.hh:96
Gecode::Int::Extensional::LayeredGraph::State
States are described by number of incoming and outgoing edges.
Definition extensional.hh:70
Gecode::Int::Extensional::LayeredGraph::State::o_deg
Degree o_deg
The out-degree (number of outgoing edges) Initialize with zeroes.
Definition extensional.hh:73
Gecode::Int::Extensional::LayeredGraph::State::i_deg
Degree i_deg
The in-degree (number of incoming edges).
Definition extensional.hh:72
Gecode::Int::Extensional::LayeredGraph::State::init
void init(void)
Definition layered-graph.hpp:78
Gecode::Int::Extensional::LayeredGraph::Support
Support information for a value
Definition extensional.hh:84
Gecode::Int::Extensional::LayeredGraph::Support::edges
Edge * edges
Supporting edges in layered graph.
Definition extensional.hh:88
Gecode::Int::Extensional::LayeredGraph::Support::n_edges
Degree n_edges
Number of supporting edges.
Definition extensional.hh:87
Gecode::Int::Extensional::LayeredGraph::Support::val
Val val
Supported value.
Definition extensional.hh:86
Gecode::Int::Extensional::LayeredGraph::initialize
ExecStatus initialize(Space &home, const VarArgArray< Var > &x, const DFA &dfa)
Initialize layered graph.
Definition layered-graph.hpp:265
Gecode::Int::Extensional::LayeredGraph::advise
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition layered-graph.hpp:437
Gecode::Int::Extensional::LayeredGraph::n_edges
unsigned int n_edges
Total number of edges.
Definition extensional.hh:164
Gecode::Int::Extensional::LayeredGraph::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition layered-graph.hpp:597
Gecode::Int::Extensional::LayeredGraph::ValSize
Gecode::Support::IntTypeTraits< Val >::utype ValSize
Type for support size.
Definition extensional.hh:91
Gecode::Int::Extensional::LayeredGraph::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition layered-graph.hpp:745
Gecode::Int::Extensional::LayeredGraph::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high linear).
Definition layered-graph.hpp:738
Gecode::Int::Extensional::LayeredGraph::max_states
StateIdx max_states
Maximal number of states per layer.
Definition extensional.hh:160
Gecode::Int::Extensional::LayeredGraph::n_states
unsigned int n_states
Total number of states.
Definition extensional.hh:162
Gecode::Int::Extensional::LayeredGraph::o_state
State & o_state(int i, const Edge &e)
Return state for layer i and out state of edge e.
Gecode::Int::Extensional::LayeredGraph::i_dec
bool i_dec(int i, const Edge &e)
Decrement out degree for in state of edge e for layer i.
Definition layered-graph.hpp:97
Gecode::Int::Extensional::LayeredGraph::n
int n
Number of layers (and views).
Definition extensional.hh:156
Gecode::Int::Extensional::LayeredGraph::o_ch
IndexRange o_ch
Index range with out-degree modifications.
Definition extensional.hh:168
Gecode::Int::Extensional::LayeredGraph::a_ch
IndexRange a_ch
Index range for any change (for compression).
Definition extensional.hh:170
Gecode::Int::Extensional::LayeredGraph::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition layered-graph.hpp:583
Gecode::Int::Extensional::LayeredGraph::LayeredGraph
LayeredGraph(Space &home, LayeredGraph< View, Val, Degree, StateIdx > &p)
Constructor for cloning p.
Definition layered-graph.hpp:705
Gecode::Int::Extensional::LayeredGraph::audit
void audit(void)
Perform consistency check on data structures.
Definition layered-graph.hpp:242
Gecode::Int::Extensional::LayeredGraph::i_ch
IndexRange i_ch
Index range with in-degree modifications.
Definition extensional.hh:166
Gecode::Int::Extensional::LayeredGraph::c
Council< Index > c
The advisor council.
Definition extensional.hh:154
Gecode::Int::Extensional::LayeredGraph::post
static ExecStatus post(Home home, const VarArgArray< Var > &x, const DFA &dfa)
Post propagator on views x and DFA dfa.
Definition layered-graph.hpp:682
Gecode::Int::Extensional::LayeredGraph::i_state
State & i_state(int i, const Edge &e)
Return in state for layer i and in state of edge e.
Gecode::Int::Extensional::LayeredGraph::o_state
State & o_state(int i, StateIdx os)
Return out state for layer i and state index os.
Definition layered-graph.hpp:102
Gecode::Int::Extensional::LayeredGraph::o_dec
bool o_dec(int i, const Edge &e)
Decrement in degree for out state of edge e for layer i.
Definition layered-graph.hpp:114
Gecode::Int::Extensional::LayeredGraph::i_state
State & i_state(int i, StateIdx is)
Return in state for layer i and state index is.
Definition layered-graph.hpp:85
Gecode::Int::Extensional::LayeredGraph::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition layered-graph.hpp:591
Gecode::Int::Extensional::LayeredGraph::layers
Layer * layers
The layers of the graph.
Definition extensional.hh:158
Gecode::Int::Extensional::NegCompact::ValidSupports
Compact< View, false >::ValidSupports ValidSupports
Definition extensional.hh:596
Gecode::Int::Extensional::NegCompact::CTAdvisor
Compact< View, false >::CTAdvisor CTAdvisor
Definition extensional.hh:598
Gecode::Int::Extensional::NegCompact::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:743
Gecode::Int::Extensional::NegCompact::advise
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:904
Gecode::Int::Extensional::NegCompact::table
Table table
Current table.
Definition extensional.hh:608
Gecode::Int::Extensional::NegCompact::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:819
Gecode::Int::Extensional::NegCompact::NegCompact
NegCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:736
Gecode::Int::Extensional::NegCompact::dispose
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:806
Gecode::Int::Extensional::NegCompact::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:813
Gecode::Int::Extensional::NegCompact::post
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
Definition compact.hpp:798
Gecode::Int::Extensional::NegCompact::Range
Compact< View, false >::Range Range
Definition extensional.hh:597
Gecode::Int::Extensional::PosCompact::Status
Status management.
Definition extensional.hh:528
Gecode::Int::Extensional::PosCompact::Status::none
void none(void)
Set status to NONE.
Definition compact.hpp:444
Gecode::Int::Extensional::PosCompact::Status::s
ptrdiff_t s
A tagged pointer for storing the status.
Definition extensional.hh:531
Gecode::Int::Extensional::PosCompact::Status::single
bool single(CTAdvisor &a) const
Check whether status is single and equal to a.
Definition compact.hpp:430
Gecode::Int::Extensional::PosCompact::Status::Status
Status(StatusType t)
Initialize with type t (either NONE or SEVERAL).
Definition compact.hpp:417
Gecode::Int::Extensional::PosCompact::Status::touched
void touched(CTAdvisor &a)
Set status to SINGLE or MULTIPLE depending on a.
Definition compact.hpp:438
Gecode::Int::Extensional::PosCompact::Status::type
StatusType type(void) const
Return status type.
Definition compact.hpp:425
Gecode::Int::Extensional::PosCompact::Status::propagating
void propagating(void)
Set status to PROPAGATING.
Definition compact.hpp:449
Gecode::Int::Extensional::PosCompact::dispose
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:531
Gecode::Int::Extensional::PosCompact::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:467
Gecode::Int::Extensional::PosCompact::ValidSupports
Compact< View, true >::ValidSupports ValidSupports
Definition extensional.hh:506
Gecode::Int::Extensional::PosCompact::advise
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:615
Gecode::Int::Extensional::PosCompact::Range
Compact< View, true >::Range Range
Definition extensional.hh:507
Gecode::Int::Extensional::PosCompact::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:547
Gecode::Int::Extensional::PosCompact::table
Table table
Current table.
Definition extensional.hh:551
Gecode::Int::Extensional::PosCompact::CTAdvisor
Compact< View, true >::CTAdvisor CTAdvisor
Definition extensional.hh:508
Gecode::Int::Extensional::PosCompact::status
Status status
Propagator status.
Definition extensional.hh:549
Gecode::Int::Extensional::PosCompact::StatusType
StatusType
Type of status.
Definition extensional.hh:521
Gecode::Int::Extensional::PosCompact::NONE
@ NONE
No view has been touched.
Definition extensional.hh:524
Gecode::Int::Extensional::PosCompact::PROPAGATING
@ PROPAGATING
The propagator is currently running.
Definition extensional.hh:525
Gecode::Int::Extensional::PosCompact::SINGLE
@ SINGLE
A single view has been touched.
Definition extensional.hh:522
Gecode::Int::Extensional::PosCompact::MULTIPLE
@ MULTIPLE
Multiple view have been touched.
Definition extensional.hh:523
Gecode::Int::Extensional::PosCompact::LostSupports
Compact< View, true >::LostSupports LostSupports
Definition extensional.hh:509
Gecode::Int::Extensional::PosCompact::post
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
Definition compact.hpp:522
Gecode::Int::Extensional::PosCompact::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:538
Gecode::Int::Extensional::PosCompact::empty
bool empty(void) const
Check whether the table is empty.
Gecode::Int::Extensional::PosCompact::PosCompact
PosCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:460
Gecode::Int::Extensional::ReCompact::Range
Compact< View, false >::Range Range
Definition extensional.hh:639
Gecode::Int::Extensional::ReCompact::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:1014
Gecode::Int::Extensional::ReCompact::table
Table table
Current table.
Definition extensional.hh:649
Gecode::Int::Extensional::ReCompact::y
ViewArray< View > y
The views (for rewriting).
Definition extensional.hh:653
Gecode::Int::Extensional::ReCompact::CTAdvisor
Compact< View, false >::CTAdvisor CTAdvisor
Definition extensional.hh:640
Gecode::Int::Extensional::ReCompact::advise
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:1140
Gecode::Int::Extensional::ReCompact::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:1109
Gecode::Int::Extensional::ReCompact::ReCompact
ReCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:1005
Gecode::Int::Extensional::ReCompact::post
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post propagator for views x and table t.
Definition compact.hpp:1077
Gecode::Int::Extensional::ReCompact::b
CtrlView b
Boolean control view.
Definition extensional.hh:651
Gecode::Int::Extensional::ReCompact::ValidSupports
Compact< View, false >::ValidSupports ValidSupports
Definition extensional.hh:638
Gecode::Int::Extensional::ReCompact::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:1103
Gecode::Int::Extensional::ReCompact::dispose
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:1095
Gecode::Int::Extensional::TinyBitSet
Tiny bit-set.
Definition extensional.hh:302
Gecode::Int::Extensional::TinyBitSet::TinyBitSet
TinyBitSet(Space &home, const TinyBitSet< largersize > &tbs)
Initialize during cloning.
Gecode::Int::Extensional::TinyBitSet::intersect_with_mask
void intersect_with_mask(const BitSetData *mask)
Intersect with mask, sparse mask if sparse is true.
Definition tiny-bit-set.hpp:99
Gecode::Int::Extensional::TinyBitSet::words
unsigned int words(void) const
Return the number of required bit set words.
Definition tiny-bit-set.hpp:185
Gecode::Int::Extensional::TinyBitSet::width
unsigned int width(void) const
Return the highest active index.
Definition tiny-bit-set.hpp:173
Gecode::Int::Extensional::TinyBitSet::intersects
bool intersects(const BitSetData *b)
Check if has a non-empty intersection with the set.
Definition tiny-bit-set.hpp:129
Gecode::Int::Extensional::TinyBitSet::add_to_mask
void add_to_mask(const BitSetData *b, BitSetData *mask) const
Add to mask.
Definition tiny-bit-set.hpp:91
Gecode::Int::Extensional::TinyBitSet::limit
int limit(void) const
Get the limit.
Gecode::Int::Extensional::TinyBitSet::bits
unsigned long long int bits(void) const
Return an upper bound on the number of bits.
Definition tiny-bit-set.hpp:157
Gecode::Int::Extensional::TinyBitSet::nand_with_masks
void nand_with_masks(const BitSetData *a, const BitSetData *b)
Perform "nand" with and the "or" of a and b.
Gecode::Int::Extensional::TinyBitSet::ones
unsigned long long int ones(void) const
Return the number of ones.
Definition tiny-bit-set.hpp:148
Gecode::Int::Extensional::TinyBitSet::size
unsigned int size(void) const
Return the total number of words.
Definition tiny-bit-set.hpp:191
Gecode::Int::Extensional::TinyBitSet::empty
bool empty(void) const
Check whether the set is empty.
Definition tiny-bit-set.hpp:164
Gecode::Int::Extensional::TinyBitSet::_bits
BitSetData _bits[_size]
Words.
Definition extensional.hh:306
Gecode::Int::Extensional::TinyBitSet::intersect_with_masks
void intersect_with_masks(const BitSetData *a, const BitSetData *b)
Intersect with the "or" of and b.
Definition tiny-bit-set.hpp:106
Gecode::Int::Extensional::TinyBitSet::flush
void flush(void)
Make the set empty.
Definition tiny-bit-set.hpp:121
Gecode::Int::Extensional::TinyBitSet::nand_with_mask
void nand_with_mask(const BitSetData *b)
Perform "nand" with b.
Definition tiny-bit-set.hpp:114
Gecode::Int::Extensional::TinyBitSet::clear_mask
void clear_mask(BitSetData *mask)
Clear the first limit words in mask.
Definition tiny-bit-set.hpp:82
Gecode::Int::Extensional::TinyBitSet::TinyBitSet
friend class TinyBitSet
Definition extensional.hh:303
Gecode::Int::ViewRanges
Range iterator for integer views.
Definition view.hpp:54
Gecode::PropCost
Propagation cost.
Definition core.hpp:486
Gecode::Propagator::Space
friend class Space
Definition core.hpp:1066
Gecode::Propagator::Advisor
friend class Advisor
Definition core.hpp:1068
Gecode::Propagator::Council
friend class Council
Definition core.hpp:1069
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::Support::BitSetData
Date item for bitsets.
Definition bitset-base.hpp:65
Gecode::Support::IntTypeTraits
Traits to for information about integer types.
Definition int-type.hpp:52
Gecode::TupleSet::Range
Range information.
Definition int.hh:2201
Gecode::TupleSet
Class represeting a set of tuples.
Definition int.hh:2191
Gecode::TupleSet::Tuple
int * Tuple
Type of a tuple.
Definition int.hh:2197
Gecode::Val
Gecode::View
Gecode::VarArgArray
Argument array for variables.
Definition array.hpp:774
Gecode::ViewAdvisor::ViewAdvisor
ViewAdvisor(Space &home, Propagator &p, Council< A > &c, View x0)
Constructor for creation.
Definition advisor.hpp:66
Gecode::ViewAdvisor::view
View view(void) const
Access view.
Definition advisor.hpp:79
Gecode::ViewArray
View arrays.
Definition array.hpp:253
compact.hpp
int.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
rel.hh
layered-graph.hpp
Gecode::Int::Extensional
Extensional propagators
Gecode::Int::Extensional::Tuple
TupleSet::Tuple Tuple
Tuple type.
Definition extensional.hh:358
Gecode::Int::Extensional::postnegcompact
ExecStatus postnegcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for compact table propagator.
Definition compact.hpp:955
Gecode::Int::Extensional::postposcompact
ExecStatus postposcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for positive compact table propagator.
Definition compact.hpp:685
Gecode::Int::Extensional::BitSetData
Gecode::Support::BitSetData BitSetData
Import type.
Definition extensional.hh:226
Gecode::Int::Extensional::postrecompact
ExecStatus postrecompact(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post function for compact table propagator.
Definition compact.hpp:1192
Gecode::Int::Extensional::post_lgp
ExecStatus post_lgp(Home home, const VarArgArray< Var > &x, const DFA &dfa)
Select small types for the layered graph propagator.
Definition layered-graph.hpp:852
Gecode::Int
Finite domain integers.
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
tiny-bit-set.hpp