gcc.hh
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Patrick Pekczynski <pekczynski@ps.uni-sb.de>
*
* Contributing authors:
* Christian Schulte <schulte@gecode.org>
* Guido Tack <tack@gecode.org>
*
* Copyright:
* Patrick Pekczynski, 2004/2005
* Christian Schulte, 2009
* Guido Tack, 2009
*
* 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_GCC_HH__
#define __GECODE_INT_GCC_HH__
#include <gecode/int.hh>
#include <gecode/int/gcc/view.hpp>
#include <gecode/int/gcc/bnd-sup.hpp>
#include <gecode/int/gcc/dom-sup.hpp>
namespace Gecode { namespace Int { namespace GCC {
template<class Card>
class Val : public Propagator {
protected:
ViewArray<IntView> x;
ViewArray<Card> k;
Val(Home home, ViewArray<IntView>& x, ViewArray<Card>& k);
Val(Space& home, Val<Card>& p);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual size_t dispose(Space& home);
static ExecStatus post(Home home,
ViewArray<IntView>& x, ViewArray<Card>& k);
};
template<class Card>
class Bnd : public Propagator {
protected:
ViewArray<IntView> x;
ViewArray<IntView> y;
ViewArray<Card> k;
PartialSum<Card> lps;
PartialSum<Card> ups;
bool card_fixed;
bool skip_lbc;
Bnd(Space& home, Bnd<Card>& p);
ExecStatus pruneCards(Space& home);
ExecStatus lbc(Space& home, int& nb, HallInfo hall[], Rank rank[],
int mu[], int nu[]);
ExecStatus ubc(Space& home, int& nb, HallInfo hall[], Rank rank[],
int mu[], int nu[]);
Bnd(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool, bool);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual size_t dispose(Space& home);
static ExecStatus post(Home home,
ViewArray<IntView>& x, ViewArray<Card>& k);
};
template<class Card>
class Dom : public Propagator {
protected:
ViewArray<IntView> x;
ViewArray<IntView> y;
ViewArray<Card> k;
VarValGraph<Card>* vvg;
bool card_fixed;
Dom(Space& home, Dom<Card>& p);
Dom(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual void reschedule(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
virtual size_t dispose(Space& home);
static ExecStatus post(Home home,
ViewArray<IntView>& x, ViewArray<Card>& k);
};
}}}
#include <gecode/int/gcc/post.hpp>
#include <gecode/int/gcc/val.hpp>
#include <gecode/int/gcc/bnd.hpp>
#include <gecode/int/gcc/dom.hpp>
#endif
// STATISTICS: int-prop
bnd-sup.hpp
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::GCC::Bnd::ups
PartialSum< Card > ups
Data structure storing the sum of the views upper bounds.
Definition gcc.hh:128
Gecode::Int::GCC::Bnd::Bnd
Bnd(Space &home, Bnd< Card > &p)
Constructor for cloning p.
Definition bnd.hpp:56
Gecode::Int::GCC::Bnd::skip_lbc
bool skip_lbc
Stores whether the minium required occurences of the cardinalities are all zero. If so,...
Definition gcc.hh:141
Gecode::Int::GCC::Bnd::post
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Definition bnd.hpp:808
Gecode::Int::GCC::Bnd::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition bnd.hpp:75
Gecode::Int::GCC::Bnd::k
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition gcc.hh:120
Gecode::Int::GCC::Bnd::ubc
ExecStatus ubc(Space &home, int &nb, HallInfo hall[], Rank rank[], int mu[], int nu[])
Upper Bounds constraint (UBC) stating Hence the ubc constraints the variables such that no value oc...
Definition bnd.hpp:404
Gecode::Int::GCC::Bnd::pruneCards
ExecStatus pruneCards(Space &home)
Prune cardinality variables with 0 maximum occurrence.
Definition bnd.hpp:562
Gecode::Int::GCC::Bnd::card_fixed
bool card_fixed
Stores whether cardinalities are all assigned.
Definition gcc.hh:135
Gecode::Int::GCC::Bnd::y
ViewArray< IntView > y
Views on which to perform value-propagation (subset of x).
Definition gcc.hh:118
Gecode::Int::GCC::Bnd::dispose
virtual size_t dispose(Space &home)
Destructor.
Definition bnd.hpp:66
Gecode::Int::GCC::Bnd::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition bnd.hpp:596
Gecode::Int::GCC::Bnd::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition bnd.hpp:93
Gecode::Int::GCC::Bnd::x
ViewArray< IntView > x
Views on which to perform bounds-propagation.
Definition gcc.hh:116
Gecode::Int::GCC::Bnd::lps
PartialSum< Card > lps
Data structure storing the sum of the views lower bounds Necessary for reasoning about the interval c...
Definition gcc.hh:126
Gecode::Int::GCC::Bnd::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost funtion.
Definition bnd.hpp:81
Gecode::Int::GCC::Bnd::lbc
ExecStatus lbc(Space &home, int &nb, HallInfo hall[], Rank rank[], int mu[], int nu[])
Lower Bounds constraint (LBC) stating Hence the lbc constraints the variables such that every value...
Definition bnd.hpp:100
Gecode::Int::GCC::Dom::card_fixed
bool card_fixed
Stores whether cardinalities are all assigned.
Definition gcc.hh:238
Gecode::Int::GCC::Dom::dispose
virtual size_t dispose(Space &home)
Destructor.
Definition dom.hpp:88
Gecode::Int::GCC::Dom::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition dom.hpp:116
Gecode::Int::GCC::Dom::vvg
VarValGraph< Card > * vvg
Propagation is performed on a variable-value graph (used as cache).
Definition gcc.hh:231
Gecode::Int::GCC::Dom::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition dom.hpp:97
Gecode::Int::GCC::Dom::y
ViewArray< IntView > y
Views used to channel information between x and k ( ).
Definition gcc.hh:227
Gecode::Int::GCC::Dom::x
ViewArray< IntView > x
Views on which to perform domain-propagation.
Definition gcc.hh:222
Gecode::Int::GCC::Dom::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition dom.hpp:103
Gecode::Int::GCC::Dom::Dom
Dom(Space &home, Dom< Card > &p)
Constructor for cloning p.
Definition dom.hpp:79
Gecode::Int::GCC::Dom::k
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition gcc.hh:229
Gecode::Int::GCC::Dom::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition dom.hpp:109
Gecode::Int::GCC::Dom::post
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Definition dom.hpp:299
Gecode::Int::GCC::HallInfo
Container class provding information about the Hall structure of the problem variables.
Definition bnd-sup.hpp:456
Gecode::Int::GCC::PartialSum
Partial sum structure for constant time computation of the maximal capacity of an interval.
Definition bnd-sup.hpp:237
Gecode::Int::GCC::Rank
Maps domain bounds to their position in hall[].bounds.
Definition bnd-sup.hpp:154
Gecode::Int::GCC::Val::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition val.hpp:85
Gecode::Int::GCC::Val::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost funtion returning high linear.
Definition val.hpp:75
Gecode::Int::GCC::Val::post
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Definition val.hpp:287
Gecode::Int::GCC::Val::k
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition gcc.hh:68
Gecode::Int::GCC::Val::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition val.hpp:69
Gecode::Int::GCC::Val::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition val.hpp:281
Gecode::Int::GCC::Val::x
ViewArray< IntView > x
Views on which to perform value-propagation.
Definition gcc.hh:66
Gecode::Int::GCC::Val::dispose
virtual size_t dispose(Space &home)
Destructor.
Definition val.hpp:60
Gecode::Int::GCC::Val::Val
Val(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Constructor for posting.
Definition val.hpp:43
Gecode::Int::GCC::VarValGraph
Variable-value-graph used during propagation.
Definition dom-sup.hpp:387
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::ViewArray
View arrays.
Definition array.hpp:253
dom-sup.hpp
bnd.hpp
dom.hpp
int.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
post.hpp
val.hpp
view.hpp
Gecode::Int::GCC
Global cardinality propagators (Counting).
Gecode::Int
Finite domain integers.
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472