Generated on Tue Apr 18 10:21:47 2017 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  *  Last modified:
00012  *     $Date: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
00013  *     $Revision: 15137 $
00014  *
00015  *  This file is part of Gecode, the generic constraint
00016  *  development environment:
00017  *     http://www.gecode.org
00018  *
00019  *  Permission is hereby granted, free of charge, to any person obtaining
00020  *  a copy of this software and associated documentation files (the
00021  *  "Software"), to deal in the Software without restriction, including
00022  *  without limitation the rights to use, copy, modify, merge, publish,
00023  *  distribute, sublicense, and/or sell copies of the Software, and to
00024  *  permit persons to whom the Software is furnished to do so, subject to
00025  *  the following conditions:
00026  *
00027  *  The above copyright notice and this permission notice shall be
00028  *  included in all copies or substantial portions of the Software.
00029  *
00030  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00031  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00032  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00033  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00034  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00035  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00036  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00037  *
00038  */
00039 
00040 #ifndef __GECODE_SET_INT_HH__
00041 #define __GECODE_SET_INT_HH__
00042 
00043 #include <gecode/set.hh>
00044 
00045 namespace Gecode { namespace Set { namespace Int {
00046 
00058   template<class View>
00059   class MinElement :
00060     public MixBinaryPropagator<View,PC_SET_ANY,
00061       Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00062   protected:
00063     using MixBinaryPropagator<View,PC_SET_ANY,
00064       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00065     using MixBinaryPropagator<View,PC_SET_ANY,
00066       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00068     MinElement(Space& home, bool share,MinElement& p);
00070     MinElement(Home home, View, Gecode::Int::IntView);
00071   public:
00073     virtual Actor* copy(Space& home,bool);
00075     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00077     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00078   };
00079 
00086   template<class View>
00087   class NotMinElement :
00088     public MixBinaryPropagator<View,PC_SET_ANY,
00089       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00090   protected:
00091     using MixBinaryPropagator<View,PC_SET_ANY,
00092       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00093     using MixBinaryPropagator<View,PC_SET_ANY,
00094       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00096     NotMinElement(Space& home, bool share,NotMinElement& p);
00098     NotMinElement(Home home, View, Gecode::Int::IntView);
00099   public:
00101     virtual Actor* copy(Space& home,bool);
00103     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00105     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00106   };
00107 
00114   template<class View, ReifyMode rm>
00115   class ReMinElement :
00116     public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00117       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00118   protected:
00119     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00120       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00121     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00122       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00123     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00124       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00126     ReMinElement(Space& home, bool share,ReMinElement& p);
00128     ReMinElement(Home home, View, Gecode::Int::IntView,
00129                  Gecode::Int::BoolView);
00130   public:
00132     virtual Actor* copy(Space& home,bool);
00134     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00136     static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00137                            Gecode::Int::BoolView b);
00138   };
00139 
00146   template<class View>
00147   class MaxElement :
00148     public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00149   protected:
00150     using MixBinaryPropagator<View,PC_SET_ANY,
00151       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00152     using MixBinaryPropagator<View,PC_SET_ANY,
00153       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00155     MaxElement(Space& home, bool share,MaxElement& p);
00157     MaxElement(Home home, View, Gecode::Int::IntView);
00158   public:
00160     virtual Actor* copy(Space& home,bool);
00162     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00164     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00165   };
00166 
00173   template<class View>
00174   class NotMaxElement :
00175     public MixBinaryPropagator<View,PC_SET_ANY,
00176       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
00177   protected:
00178     using MixBinaryPropagator<View,PC_SET_ANY,
00179       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x0;
00180     using MixBinaryPropagator<View,PC_SET_ANY,
00181       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
00183     NotMaxElement(Space& home, bool share,NotMaxElement& p);
00185     NotMaxElement(Home home, View, Gecode::Int::IntView);
00186   public:
00188     virtual Actor* copy(Space& home,bool);
00190     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00192     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00193   };
00194 
00201   template<class View, ReifyMode rm>
00202   class ReMaxElement :
00203     public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00204       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
00205   protected:
00206     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00207       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x0;
00208     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00209       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::x1;
00210     using Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
00211       Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView>::b;
00213     ReMaxElement(Space& home, bool share,ReMaxElement& p);
00215     ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
00216   public:
00218     virtual Actor* copy(Space& home,bool);
00220     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00222     static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
00223                            Gecode::Int::BoolView b);
00224   };
00225 
00232   template<class View>
00233   class Card :
00234     public MixBinaryPropagator<View,PC_SET_CARD,
00235       Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
00236   protected:
00237     using MixBinaryPropagator<View,PC_SET_CARD,
00238       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x0;
00239     using MixBinaryPropagator<View,PC_SET_CARD,
00240       Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
00242     Card(Space& home, bool share,Card& p);
00244     Card(Home home, View, Gecode::Int::IntView);
00245   public:
00247     virtual Actor* copy(Space& home,bool);
00249     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00251     static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
00252   };
00253 
00260   template<class View>
00261   class Weights : public Propagator {
00262   protected:
00264     SharedArray<int> elements;
00266     SharedArray<int> weights;
00267 
00269     View x;
00271     Gecode::Int::IntView y;
00272 
00274     Weights(Space& home, bool share,Weights& p);
00276     Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
00277             View, Gecode::Int::IntView);
00278   public:
00280     virtual Actor* copy(Space& home,bool);
00282     virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
00284     virtual void reschedule(Space& home);
00286     virtual size_t dispose(Space& home);
00288     virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
00290     static ExecStatus post(Home home,
00291                            const SharedArray<int>& elements,
00292                            const SharedArray<int>& weights,
00293                            View x, Gecode::Int::IntView y);
00294   };
00295 
00296 }}}
00297 
00298 #include <gecode/set/int/minmax.hpp>
00299 #include <gecode/set/int/card.hpp>
00300 #include <gecode/set/int/weights.hpp>
00301 
00302 #endif
00303 
00304 // STATISTICS: set-prop