circuit.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, 2006
*
* 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_CIRCUIT_HH__
#define __GECODE_INT_CIRCUIT_HH__
#include <gecode/int.hh>
#include <gecode/int/distinct.hh>
namespace Gecode { namespace Int { namespace Circuit {
template<class View, class Offset>
class Base : public NaryPropagator<View,Int::PC_INT_DOM> {
protected:
using NaryPropagator<View,Int::PC_INT_DOM>::x;
int start;
ViewArray<View> y;
Offset o;
Base(Space& home, Base& p);
Base(Home home, ViewArray<View>& x, Offset& o);
ExecStatus connected(Space& home);
ExecStatus path(Space& home);
public:
virtual size_t dispose(Space& home);
};
template<class View, class Offset>
class Val : public Base<View,Offset> {
protected:
using Base<View,Offset>::x;
using Base<View,Offset>::y;
using Base<View,Offset>::connected;
using Base<View,Offset>::path;
using Base<View,Offset>::o;
Val(Space& home, Val& p);
Val(Home home, ViewArray<View>& x, Offset& o);
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, Offset& o);
};
template<class View, class Offset>
class Dom : public Base<View,Offset> {
protected:
using Base<View,Offset>::x;
using Base<View,Offset>::y;
using Base<View,Offset>::connected;
using Base<View,Offset>::path;
using Base<View,Offset>::o;
Int::Distinct::DomCtrl<View> dc;
Dom(Space& home, Dom& p);
Dom(Home home, ViewArray<View>& x, Offset& o);
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);
static ExecStatus post(Home home, ViewArray<View>& x, Offset& o);
};
}}}
#include <gecode/int/circuit/base.hpp>
#include <gecode/int/circuit/val.hpp>
#include <gecode/int/circuit/dom.hpp>
#endif
// STATISTICS: int-prop
dom.hpp
Gecode::ActorLink::Actor
friend class Actor
Definition core.hpp:590
Gecode::Home
Home class for posting propagators
Definition core.hpp:856
Gecode::Int::Circuit::Base::connected
ExecStatus connected(Space &home)
Check whether the view value graph is strongly connected.
Definition base.hpp:69
Gecode::Int::Circuit::Base::y
ViewArray< View > y
Array for performing value propagation for distinct.
Definition circuit.hh:61
Gecode::Int::Circuit::Base::o
Offset o
Offset transformation.
Definition circuit.hh:63
Gecode::Int::Circuit::Base::dispose
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition base.hpp:290
Gecode::Int::Circuit::Base::start
int start
Remember where to start the next time the propagator runs.
Definition circuit.hh:59
Gecode::Int::Circuit::Base::path
ExecStatus path(Space &home)
Ensure path property: prune edges that could give too small cycles.
Definition base.hpp:236
Gecode::Int::Circuit::Base::Base
Base(Space &home, Base &p)
Constructor for cloning p.
Gecode::Int::Circuit::Dom::Dom
Dom(Space &home, Dom &p)
Constructor for cloning p.
Gecode::Int::Circuit::Dom::post
static ExecStatus post(Home home, ViewArray< View > &x, Offset &o)
Post propagator for circuit on x.
Definition dom.hpp:114
Gecode::Int::Circuit::Dom::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition dom.hpp:58
Gecode::Int::Circuit::Dom::dc
Int::Distinct::DomCtrl< View > dc
Propagation controller for propagating distinct.
Definition circuit.hh:129
Gecode::Int::Circuit::Dom::reschedule
virtual void reschedule(Space &home)
Schedule function.
Definition dom.hpp:67
Gecode::Int::Circuit::Dom::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition dom.hpp:52
Gecode::Int::Circuit::Dom::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition dom.hpp:78
Gecode::Int::Circuit::Val::post
static ExecStatus post(Home home, ViewArray< View > &x, Offset &o)
Post propagator for circuit on x.
Definition val.hpp:80
Gecode::Int::Circuit::Val::copy
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition val.hpp:52
Gecode::Int::Circuit::Val::propagate
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition val.hpp:64
Gecode::Int::Circuit::Val::cost
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (returns high linear).
Definition val.hpp:58
Gecode::Int::Circuit::Val::Val
Val(Space &home, Val &p)
Constructor for cloning p.
Gecode::Int::Distinct::DomCtrl
Propagation controller for domain consistent distinct.
Definition distinct.hh:250
Gecode::Int::Offset
Converter with fixed offset.
Definition view.hpp:650
Gecode::NaryPropagator< View, Int::PC_INT_DOM >::x
ViewArray< View > x
Definition pattern.hpp:145
Gecode::NaryPropagator< View, Int::PC_INT_DOM >::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::View
Gecode::ViewArray
View arrays.
Definition array.hpp:253
int.hh
Gecode::ModEventDelta
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
base.hpp
val.hpp
distinct.hh
Gecode::Int::Circuit
Circuit 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