member.hh
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, 2011
*
* 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_MEMBER_HH__
#define __GECODE_INT_MEMBER_HH__
#include <gecode/int.hh>
#include <gecode/int/val-set.hh>
namespace Gecode { namespace Int { namespace Member {
template<class View>
class Prop : public NaryOnePropagator<View,PC_INT_DOM> {
protected:
using NaryOnePropagator<View,PC_INT_DOM>::x;
using NaryOnePropagator<View,PC_INT_DOM>::y;
ValSet vs;
static void add(Space& home, ValSet& vs, ViewArray<View>& x);
void eliminate(Space& home);
Prop(Home home, ValSet& vs, ViewArray<View>& x, View y);
Prop(Space& home, Prop<View>& p);
public:
virtual PropCost cost(const Space&, const ModEventDelta& med) const;
virtual Propagator* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, ViewArray<View>& x, View y);
static ExecStatus post(Home home, ValSet& vs, ViewArray<View>& x, View y);
virtual size_t dispose(Space& home);
};
template<class View, ReifyMode rm>
class ReProp : public Prop<View> {
protected:
using Prop<View>::x;
using Prop<View>::y;
using Prop<View>::vs;
using Prop<View>::add;
using Prop<View>::eliminate;
BoolView b;
ReProp(Home home, ValSet& vs, ViewArray<View>& x, View y, BoolView b);
ReProp(Space& home, ReProp<View,rm>& p);
public:
virtual Propagator* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, ViewArray<View>& x, View y, BoolView b);
virtual size_t dispose(Space& home);
};
}}}
#include <gecode/int/member/prop.hpp>
#include <gecode/int/member/re-prop.hpp>
#endif
// STATISTICS: int-prop
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::BoolView
Boolean view for Boolean variables.
Definition view.hpp:1380
Gecode::Int::Member::Prop::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition prop.hpp:133
Gecode::Int::Member::Prop::copy
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:113
Gecode::Int::Member::Prop::cost
virtual PropCost cost(const Space &, const ModEventDelta &med) const
Cost function.
Definition prop.hpp:127
Gecode::Int::Member::Prop::add
static void add(Space &home, ValSet &vs, ViewArray< View > &x)
Add values of assigned views in x to value set va.
Definition prop.hpp:46
Gecode::Int::Member::Prop::Prop
Prop(Home home, ValSet &vs, ViewArray< View > &x, View y)
Constructor for posting.
Definition prop.hpp:40
Gecode::Int::Member::Prop::vs
ValSet vs
Value set storing the values of already assigned views.
Definition member.hh:59
Gecode::Int::Member::Prop::eliminate
void eliminate(Space &home)
Eliminate views from x that are not equal to y or ar subsumed by vs.
Definition prop.hpp:58
Gecode::Int::Member::Prop::post
static ExecStatus post(Home home, ViewArray< View > &x, View y)
Post propagator for .
Definition prop.hpp:71
Gecode::Int::Member::Prop::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition prop.hpp:119
Gecode::Int::Member::ReProp::copy
virtual Propagator * copy(Space &home)
Copy propagator during cloning.
Definition re-prop.hpp:101
Gecode::Int::Member::ReProp::ReProp
ReProp(Home home, ValSet &vs, ViewArray< View > &x, View y, BoolView b)
Constructor for posting.
Definition re-prop.hpp:40
Gecode::Int::Member::ReProp::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-prop.hpp:115
Gecode::Int::Member::ReProp::b
BoolView b
Boolean control variable.
Definition member.hh:98
Gecode::Int::Member::ReProp::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-prop.hpp:107
Gecode::Int::Member::ReProp::post
static ExecStatus post(Home home, ViewArray< View > &x, View y, BoolView b)
Post propagator for .
Definition re-prop.hpp:48
Gecode::Int::ValSet
Class for storing values of already assigned views.
Definition val-set.hh:44
Gecode::NaryOnePropagator< View, PC_INT_DOM >::x
ViewArray< View > x
Definition pattern.hpp:175
Gecode::NaryOnePropagator< View, PC_INT_DOM >::NaryOnePropagator
NaryOnePropagator(Space &home, NaryOnePropagator &p)
Gecode::NaryOnePropagator< View, PC_INT_DOM >::y
View y
Definition pattern.hpp:177
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::View
Gecode::ViewArray
View arrays.
Definition array.hpp:253
int.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
prop.hpp
Gecode::Int::Member
Membership propagators.
Gecode::Int
Finite domain integers.
Gecode::Int::PC_INT_DOM
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
re-prop.hpp
val-set.hh