Generated on Thu Apr 11 13:59:04 2019 for Gecode by doxygen 1.6.3

int.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *     Christian Schulte <schulte@gecode.org>
00006  *
00007  *  Copyright:
00008  *     Guido Tack, 2004
00009  *     Christian Schulte, 2004
00010  *
00011  *  This file is part of Gecode, the generic constraint
00012  *  development environment:
00013  *     http://www.gecode.org
00014  *
00015  *  Permission is hereby granted, free of charge, to any person obtaining
00016  *  a copy of this software and associated documentation files (the
00017  *  "Software"), to deal in the Software without restriction, including
00018  *  without limitation the rights to use, copy, modify, merge, publish,
00019  *  distribute, sublicense, and/or sell copies of the Software, and to
00020  *  permit persons to whom the Software is furnished to do so, subject to
00021  *  the following conditions:
00022  *
00023  *  The above copyright notice and this permission notice shall be
00024  *  included in all copies or substantial portions of the Software.
00025  *
00026  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00027  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00028  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00029  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00030  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00031  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00032  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00033  *
00034  */
00035 
00036 #ifndef __GECODE_SET_INT_HH__
00037 #define __GECODE_SET_INT_HH__
00038 
00039 #include <gecode/set.hh>
00040 
00041 namespace Gecode { namespace Set { namespace Int {
00042 
00054   template<class View>
00055   class MinElement :
00056     public MixBinaryPropagator<View,PC_SET_ANY,
00057       Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00058   protected:
00059     using MixBinaryPropagator<View,PC_SET_ANY,
00060       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00061     using MixBinaryPropagator<View,PC_SET_ANY,
00062       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00064     MinElement(Space& home, MinElement& p);
00066     MinElement(Home home, View, Gecode::Int::IntView);
00067   public:
00069     virtual Actor* copy(Space& home);
00071     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00073     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00074   };
00075 
00082   template<class View>
00083   class NotMinElement :
00084     public MixBinaryPropagator<View,PC_SET_ANY,
00085       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00086   protected:
00087     using MixBinaryPropagator<View,PC_SET_ANY,
00088       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00089     using MixBinaryPropagator<View,PC_SET_ANY,
00090       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00092     NotMinElement(Space& home, NotMinElement& p);
00094     NotMinElement(Home home, View, Gecode::Int::IntView);
00095   public:
00097     virtual Actor* copy(Space& home);
00099     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00101     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00102   };
00103 
00110   template<class View, ReifyMode rm>
00111   class ReMinElement :
00112     public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00113       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00114   protected:
00115     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00116       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00117     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00118       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00119     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00120       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00122     ReMinElement(Space& home, ReMinElement& p);
00124     ReMinElement(Home home, View, Gecode::Int::IntView,
00125                  Gecode::Int::BoolView);
00126   public:
00128     virtual Actor* copy(Space& home);
00130     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00132     static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00133                            Gecode::Int::BoolView b);
00134   };
00135 
00142   template<class View>
00143   class MaxElement :
00144     public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00145   protected:
00146     using MixBinaryPropagator<View,PC_SET_ANY,
00147       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00148     using MixBinaryPropagator<View,PC_SET_ANY,
00149       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00151     MaxElement(Space& home, MaxElement& p);
00153     MaxElement(Home home, View, Gecode::Int::IntView);
00154   public:
00156     virtual Actor* copy(Space& home);
00158     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00160     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00161   };
00162 
00169   template<class View>
00170   class NotMaxElement :
00171     public MixBinaryPropagator<View,PC_SET_ANY,
00172       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00173   protected:
00174     using MixBinaryPropagator<View,PC_SET_ANY,
00175       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00176     using MixBinaryPropagator<View,PC_SET_ANY,
00177       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00179     NotMaxElement(Space& home, NotMaxElement& p);
00181     NotMaxElement(Home home, View, Gecode::Int::IntView);
00182   public:
00184     virtual Actor* copy(Space& home);
00186     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00188     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00189   };
00190 
00197   template<class View, ReifyMode rm>
00198   class ReMaxElement :
00199     public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00200       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00201   protected:
00202     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00203       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00204     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00205       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00206     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00207       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00209     ReMaxElement(Space& home, ReMaxElement& p);
00211     ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
00212   public:
00214     virtual Actor* copy(Space& home);
00216     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00218     static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00219                            Gecode::Int::BoolView b);
00220   };
00221 
00228   template<class View>
00229   class Card :
00230     public MixBinaryPropagator<View,PC_SET_CARD,
00231       Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00232   protected:
00233     using MixBinaryPropagator<View,PC_SET_CARD,
00234       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00235     using MixBinaryPropagator<View,PC_SET_CARD,
00236       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00238     Card(Space& home, Card& p);
00240     Card(Home home, View, Gecode::Int::IntView);
00241   public:
00243     virtual Actor* copy(Space& home);
00245     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00247     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00248   };
00249 
00256   template<class View>
00257   class Weights : public Propagator {
00258   protected:
00260     SharedArray<int> elements;
00262     SharedArray<int> weights;
00263 
00265     View x;
00267     Gecode::Int::IntView y;
00268 
00270     Weights(Space& home, Weights& p);
00272     Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
00273             View, Gecode::Int::IntView);
00274   public:
00276     virtual Actor* copy(Space& home);
00278     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00280     virtual void reschedule(Space& home);
00282     virtual size_t dispose(Space& home);
00284     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00286     static ExecStatus post(Home home,
00287                            const SharedArray<int>& elements,
00288                            const SharedArray<int>& weights,
00289                            View x, Gecode::Int::IntView y);
00290   };
00291 
00292 }}}
00293 
00294 #include <gecode/set/int/minmax.hpp>
00295 #include <gecode/set/int/card.hpp>
00296 #include <gecode/set/int/weights.hpp>
00297 
00298 #endif
00299 
00300 // STATISTICS: set-prop