int.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_INT_HH__
#define __GECODE_SET_INT_HH__
#include <gecode/set.hh>
namespace Gecode { namespace Set { namespace Int {
template<class View>
class MinElement :
public MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
protected:
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
MinElement(Space& home, MinElement& p);
MinElement(Home home, View, Gecode::Int::IntView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
};
template<class View>
class NotMinElement :
public MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
protected:
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
NotMinElement(Space& home, NotMinElement& p);
NotMinElement(Home home, View, Gecode::Int::IntView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
};
template<class View, ReifyMode rm>
class ReMinElement :
public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
protected:
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
ReMinElement(Space& home, ReMinElement& p);
ReMinElement(Home home, View, Gecode::Int::IntView,
Gecode::Int::BoolView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
Gecode::Int::BoolView b);
};
template<class View>
class MaxElement :
public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
protected:
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
MaxElement(Space& home, MaxElement& p);
MaxElement(Home home, View, Gecode::Int::IntView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
};
template<class View>
class NotMaxElement :
public MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
protected:
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
using MixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
NotMaxElement(Space& home, NotMaxElement& p);
NotMaxElement(Home home, View, Gecode::Int::IntView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
};
template<class View, ReifyMode rm>
class ReMaxElement :
public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
protected:
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
ReMaxElement(Space& home, ReMaxElement& p);
ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
Gecode::Int::BoolView b);
};
template<class View>
class Card :
public MixBinaryPropagator<View,PC_SET_CARD,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
protected:
using MixBinaryPropagator<View,PC_SET_CARD,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
using MixBinaryPropagator<View,PC_SET_CARD,
Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
Card(Space& home, Card& p);
Card(Home home, View, Gecode::Int::IntView);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
};
template<class View>
class Weights : public Propagator {
protected:
SharedArray<int> elements;
SharedArray<int> weights;
View x;
Gecode::Int::IntView y;
Weights(Space& home, Weights& p);
Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
View, Gecode::Int::IntView);
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,
const SharedArray<int>& elements,
const SharedArray<int>& weights,
View x, Gecode::Int::IntView y);
};
}}}
#include <gecode/set/int/minmax.hpp>
#include <gecode/set/int/card.hpp>
#include <gecode/set/int/weights.hpp>
#endif
// STATISTICS: set-prop
card.hpp
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::Int::IntView
Integer view for integer variables.
Definition view.hpp:129
Gecode::Int::ReMixBinaryPropagator
Reified mixed binary propagator.
Definition propagator.hpp:124
Gecode::Int::ReMixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_DOM, Gecode::Int::BoolView >::x1
Gecode::Int::IntView x1
Definition propagator.hpp:129
Gecode::Int::ReMixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_DOM, Gecode::Int::BoolView >::b
Gecode::Int::BoolView b
Definition propagator.hpp:131
Gecode::Int::ReMixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_DOM, Gecode::Int::BoolView >::x0
View x0
Definition propagator.hpp:127
Gecode::MixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_BND >::x1
Gecode::Int::IntView x1
Definition pattern.hpp:209
Gecode::MixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_BND >::MixBinaryPropagator
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
Definition pattern.hpp:597
Gecode::MixBinaryPropagator< View, PC_SET_ANY, Gecode::Int::IntView, Gecode::Int::PC_INT_BND >::x0
View 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::Int::Card::Card
Card(Space &home, Card &p)
Constructor for cloning p.
Definition card.hpp:60
Gecode::Set::Int::Card::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition card.hpp:72
Gecode::Set::Int::Card::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition card.hpp:66
Gecode::Set::Int::Card::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for .
Definition card.hpp:51
Gecode::Set::Int::MaxElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:417
Gecode::Set::Int::MaxElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
Definition minmax.hpp:408
Gecode::Set::Int::MaxElement::MaxElement
MaxElement(Space &home, MaxElement &p)
Constructor for cloning p.
Definition minmax.hpp:402
Gecode::Set::Int::MaxElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:423
Gecode::Set::Int::MinElement::MinElement
MinElement(Space &home, MinElement &p)
Constructor for cloning p.
Definition minmax.hpp:61
Gecode::Set::Int::MinElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:72
Gecode::Set::Int::MinElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
Definition minmax.hpp:53
Gecode::Set::Int::MinElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:66
Gecode::Set::Int::NotMaxElement::NotMaxElement
NotMaxElement(Space &home, NotMaxElement &p)
Constructor for cloning p.
Definition minmax.hpp:451
Gecode::Set::Int::NotMaxElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:464
Gecode::Set::Int::NotMaxElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
Definition minmax.hpp:457
Gecode::Set::Int::NotMaxElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:470
Gecode::Set::Int::NotMinElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:160
Gecode::Set::Int::NotMinElement::NotMinElement
NotMinElement(Space &home, NotMinElement &p)
Constructor for cloning p.
Definition minmax.hpp:148
Gecode::Set::Int::NotMinElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:154
Gecode::Set::Int::NotMinElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
Definition minmax.hpp:141
Gecode::Set::Int::ReMaxElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:580
Gecode::Set::Int::ReMaxElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the largest element of s.
Definition minmax.hpp:565
Gecode::Set::Int::ReMaxElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:574
Gecode::Set::Int::ReMaxElement::ReMaxElement
ReMaxElement(Space &home, ReMaxElement &p)
Constructor for cloning p.
Definition minmax.hpp:558
Gecode::Set::Int::ReMinElement::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition minmax.hpp:290
Gecode::Set::Int::ReMinElement::post
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the minimal element of s.
Definition minmax.hpp:269
Gecode::Set::Int::ReMinElement::ReMinElement
ReMinElement(Space &home, ReMinElement &p)
Constructor for cloning p.
Definition minmax.hpp:277
Gecode::Set::Int::ReMinElement::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition minmax.hpp:284
Gecode::Set::Int::Weights::y
Gecode::Int::IntView y
The integer view.
Definition int.hh:267
Gecode::Set::Int::Weights::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition weights.hpp:247
Gecode::Set::Int::Weights::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition weights.hpp:210
Gecode::Set::Int::Weights::weights
SharedArray< int > weights
Weights for the elements in the upper bound.
Definition int.hh:262
Gecode::Set::Int::Weights::x
View x
The set view.
Definition int.hh:265
Gecode::Set::Int::Weights::Weights
Weights(Space &home, Weights &p)
Constructor for cloning p.
Definition weights.hpp:159
Gecode::Set::Int::Weights::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_LINEAR_LO).
Definition weights.hpp:185
Gecode::Set::Int::Weights::post
static ExecStatus post(Home home, const SharedArray< int > &elements, const SharedArray< int > &weights, View x, Gecode::Int::IntView y)
Post propagator for .
Definition weights.hpp:167
Gecode::Set::Int::Weights::elements
SharedArray< int > elements
List of elements in the upper bound.
Definition int.hh:260
Gecode::Set::Int::Weights::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition weights.hpp:198
Gecode::Set::Int::Weights::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition weights.hpp:191
Gecode::SharedArray
Shared array with arbitrary number of elements.
Definition shared-array.hpp:53
Gecode::View
set.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
minmax.hpp
Gecode::Int::PC_INT_BND
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:91
Gecode::Int::PC_INT_DOM
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode::Set::Int
Propagators connecting set and int variables.
Definition int.cpp:105
Gecode::Set
Finite integer sets.
Definition var-imp.hpp:137
Gecode::Set::PC_SET_CARD
const Gecode::PropCond PC_SET_CARD
Propagate when the cardinality of a view changes.
Definition var-type.hpp:216
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
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
weights.hpp