rel.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>
* Guido Tack <tack@gecode.org>
* Vincent Barichard <Vincent.Barichard@univ-angers.fr>
*
* Contributing authors:
* Gabor Szokoli <szokoli@gecode.org>
*
* Copyright:
* Christian Schulte, 2002
* Guido Tack, 2004
* Gabor Szokoli, 2003
* Vincent Barichard, 2012
*
* 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_FLOAT_REL_HH__
#define __GECODE_FLOAT_REL_HH__
#include <gecode/int.hh>
#include <gecode/float.hh>
namespace Gecode { namespace Float { namespace Rel {
/*
* Equality propagators
*
*/
template<class View0, class View1>
class Eq :
public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
protected:
using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x0;
using MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND>::x1;
Eq(Space& home, Eq<View0,View1>& p);
public:
Eq(Home home, View0 x0, View1 x1);
Eq(Space& home, Propagator& p, View0 x0, View1 x1);
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x0, View1 x1);
};
template<class View>
class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
protected:
using NaryPropagator<View,PC_FLOAT_BND>::x;
NaryEq(Space& home, NaryEq<View>& p);
NaryEq(Home home, ViewArray<View>&);
public:
virtual Actor* copy(Space& home);
virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, ViewArray<View>& x);
};
template<class View, class CtrlView, ReifyMode rm>
class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
protected:
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
ReEq(Space& home, ReEq& p);
ReEq(Home home, View x0, View x1, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x0, View x1, CtrlView b);
};
template<class View, class CtrlView, ReifyMode rm>
class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
protected:
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
FloatVal c;
ReEqFloat(Space& home, ReEqFloat& p);
ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
};
template<class View0, class View1>
class Nq :
public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
protected:
using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x0;
using MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL>::x1;
Nq(Space& home, Nq<View0,View1>& p);
public:
Nq(Home home, View0 x0, View1 x1);
Nq(Space& home, Propagator& p, View0 x0, View1 x1);
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View0 x0, View1 x1);
};
template<class View>
class NqFloat :
public UnaryPropagator<View,PC_FLOAT_VAL> {
protected:
using UnaryPropagator<View,PC_FLOAT_VAL>::x0;
FloatVal c;
NqFloat(Space& home, NqFloat<View>& p);
public:
NqFloat(Home home, View x, FloatVal c);
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x0, FloatVal c);
};
/*
* Order propagators
*
*/
template<class View>
class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
protected:
using BinaryPropagator<View,PC_FLOAT_BND>::x0;
using BinaryPropagator<View,PC_FLOAT_BND>::x1;
Lq(Space& home, Lq& p);
Lq(Home home, View x0, View x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x0, View x1);
};
template<class View>
class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
protected:
using BinaryPropagator<View,PC_FLOAT_BND>::x0;
using BinaryPropagator<View,PC_FLOAT_BND>::x1;
Le(Space& home, Le& p);
Le(Home home, View x0, View x1);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x0, View x1);
};
/*
* Reified order propagators
*
*/
template<class View, class CtrlView, ReifyMode rm>
class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
protected:
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
FloatVal c;
ReLqFloat(Space& home, ReLqFloat& p);
ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
};
template<class View, class CtrlView, ReifyMode rm>
class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
protected:
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
using Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
FloatVal c;
ReLeFloat(Space& home, ReLeFloat& p);
ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
};
template<class View, class CtrlView, ReifyMode rm>
class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
protected:
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x0;
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::x1;
using Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView>::b;
ReLq(Space& home, ReLq& p);
ReLq(Home home, View x0, View x1, CtrlView b);
public:
virtual Actor* copy(Space& home);
virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
static ExecStatus post(Home home, View x0, View x1, CtrlView b);
};
}}}
#include <gecode/float/rel/eq.hpp>
#include <gecode/float/rel/nq.hpp>
#include <gecode/float/rel/lq-le.hpp>
#endif
// STATISTICS: float-prop
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::BinaryPropagator< View, PC_FLOAT_BND >::x0
View x0
Definition pattern.hpp:87
Gecode::BinaryPropagator< View, PC_FLOAT_BND >::BinaryPropagator
BinaryPropagator(Space &home, BinaryPropagator &p)
Gecode::BinaryPropagator< View, PC_FLOAT_BND >::x1
View x1
Definition pattern.hpp:87
Gecode::FloatVal
Float value type.
Definition float.hh:334
Gecode::Float::Rel::Eq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:85
Gecode::Float::Rel::Eq::Eq
Eq(Space &home, Eq< View0, View1 > &p)
Constructor for cloning p.
Definition eq.hpp:67
Gecode::Float::Rel::Eq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:79
Gecode::Float::Rel::Eq::post
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition eq.hpp:50
Gecode::Float::Rel::Le::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:117
Gecode::Float::Rel::Le::post
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition lq-le.hpp:91
Gecode::Float::Rel::Le::Le
Le(Space &home, Le &p)
Constructor for cloning p.
Gecode::Float::Rel::Le::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:111
Gecode::Float::Rel::Lq::Lq
Lq(Space &home, Lq &p)
Constructor for cloning p.
Gecode::Float::Rel::Lq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:67
Gecode::Float::Rel::Lq::post
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition lq-le.hpp:52
Gecode::Float::Rel::Lq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:73
Gecode::Float::Rel::NaryEq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:161
Gecode::Float::Rel::NaryEq::NaryEq
NaryEq(Space &home, NaryEq< View > &p)
Constructor for cloning p.
Definition eq.hpp:141
Gecode::Float::Rel::NaryEq::post
static ExecStatus post(Home home, ViewArray< View > &x)
Post bounds consistent propagator .
Definition eq.hpp:119
Gecode::Float::Rel::NaryEq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:146
Gecode::Float::Rel::NaryEq::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition eq.hpp:152
Gecode::Float::Rel::NqFloat::NqFloat
NqFloat(Space &home, NqFloat< View > &p)
Constructor for cloning p.
Definition nq.hpp:104
Gecode::Float::Rel::NqFloat::c
FloatVal c
Float constant to check.
Definition rel.hh:213
Gecode::Float::Rel::NqFloat::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:115
Gecode::Float::Rel::NqFloat::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:109
Gecode::Float::Rel::NqFloat::post
static ExecStatus post(Home home, View x0, FloatVal c)
Post bounds consistent propagator .
Definition nq.hpp:92
Gecode::Float::Rel::Nq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:74
Gecode::Float::Rel::Nq::post
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition nq.hpp:49
Gecode::Float::Rel::Nq::Nq
Nq(Space &home, Nq< View0, View1 > &p)
Constructor for cloning p.
Definition nq.hpp:63
Gecode::Float::Rel::Nq::Nq
Nq(Space &home, Propagator &p, View0 x0, View1 x1)
Constructor for rewriting p during cloning.
Gecode::Float::Rel::Nq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:68
Gecode::Float::Rel::ReEqFloat::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:317
Gecode::Float::Rel::ReEqFloat::c
FloatVal c
Float constant to check.
Definition rel.hh:157
Gecode::Float::Rel::ReEqFloat::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:311
Gecode::Float::Rel::ReEqFloat::post
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post bounds consistent propagator .
Definition eq.hpp:285
Gecode::Float::Rel::ReEqFloat::ReEqFloat
ReEqFloat(Space &home, ReEqFloat &p)
Constructor for cloning p.
Definition eq.hpp:306
Gecode::Float::Rel::ReEq::ReEq
ReEq(Space &home, ReEq &p)
Constructor for cloning p.
Definition eq.hpp:233
Gecode::Float::Rel::ReEq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:238
Gecode::Float::Rel::ReEq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:244
Gecode::Float::Rel::ReEq::post
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post bounds consistent propagator .
Definition eq.hpp:211
Gecode::Float::Rel::ReLeFloat::post
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition lq-le.hpp:321
Gecode::Float::Rel::ReLeFloat::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:366
Gecode::Float::Rel::ReLeFloat::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:360
Gecode::Float::Rel::ReLeFloat::ReLeFloat
ReLeFloat(Space &home, ReLeFloat &p)
Constructor for cloning p.
Definition lq-le.hpp:355
Gecode::Float::Rel::ReLeFloat::c
FloatVal c
Float constant to check.
Definition rel.hh:332
Gecode::Float::Rel::ReLqFloat::c
FloatVal c
Float constant to check.
Definition rel.hh:304
Gecode::Float::Rel::ReLqFloat::post
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition lq-le.hpp:234
Gecode::Float::Rel::ReLqFloat::ReLqFloat
ReLqFloat(Space &home, ReLqFloat &p)
Constructor for cloning p.
Definition lq-le.hpp:267
Gecode::Float::Rel::ReLqFloat::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:278
Gecode::Float::Rel::ReLqFloat::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:272
Gecode::Float::Rel::ReLq::ReLq
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
Definition lq-le.hpp:180
Gecode::Float::Rel::ReLq::post
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
Definition lq-le.hpp:141
Gecode::Float::Rel::ReLq::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:191
Gecode::Float::Rel::ReLq::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:185
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::ReBinaryPropagator
Reified binary propagator.
Definition propagator.hpp:87
Gecode::Int::ReBinaryPropagator< View, PC_FLOAT_BND, CtrlView >::x0
View x0
Definition propagator.hpp:90
Gecode::Int::ReBinaryPropagator< View, PC_FLOAT_BND, CtrlView >::b
CtrlView b
Definition propagator.hpp:92
Gecode::Int::ReBinaryPropagator< View, PC_FLOAT_BND, CtrlView >::x1
View x1
Definition propagator.hpp:90
Gecode::Int::ReUnaryPropagator
Reified unary propagator.
Definition propagator.hpp:54
Gecode::Int::ReUnaryPropagator< View, PC_FLOAT_BND, CtrlView >::b
CtrlView b
Definition propagator.hpp:59
Gecode::Int::ReUnaryPropagator< View, PC_FLOAT_BND, CtrlView >::x0
View x0
Definition propagator.hpp:57
Gecode::MixBinaryPropagator< View0, PC_FLOAT_BND, View1, PC_FLOAT_BND >::x1
View1 x1
Definition pattern.hpp:209
Gecode::MixBinaryPropagator< View0, PC_FLOAT_BND, View1, PC_FLOAT_BND >::MixBinaryPropagator
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
Definition pattern.hpp:597
Gecode::MixBinaryPropagator< View0, PC_FLOAT_BND, View1, PC_FLOAT_BND >::x0
View0 x0
Definition pattern.hpp:207
Gecode::NaryPropagator< View, PC_FLOAT_BND >::x
ViewArray< View > x
Definition pattern.hpp:145
Gecode::NaryPropagator< View, PC_FLOAT_BND >::NaryPropagator
NaryPropagator(Space &home, NaryPropagator &p)
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::UnaryPropagator< View, PC_FLOAT_VAL >::x0
View x0
Definition pattern.hpp:58
Gecode::UnaryPropagator< View, PC_FLOAT_VAL >::UnaryPropagator
UnaryPropagator(Space &home, UnaryPropagator &p)
Gecode::View
Gecode::ViewArray
View arrays.
Definition array.hpp:253
eq.hpp
lq-le.hpp
nq.hpp
float.hh
int.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Gecode::Float::Rel
Simple relation propagators.
Gecode::Float
Floating point numbers.
Gecode::Float::PC_FLOAT_VAL
const Gecode::PropCond PC_FLOAT_VAL
Propagate when a view becomes assigned (single value).
Definition var-type.hpp:283
Gecode::Float::PC_FLOAT_BND
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:292
Gecode
Gecode toplevel namespace
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472