Generated on Sun Feb 17 15:24:10 2019 for Gecode by doxygen 1.6.3

var-imp.hpp

Go to the documentation of this file.
00001 /*
00002  *  CAUTION:
00003  *    This file has been automatically generated. Do not edit,
00004  *    edit the following files instead:
00005  *     - ./gecode/int/var-imp/int.vis
00006  *     - ./gecode/int/var-imp/bool.vis
00007  *     - ./gecode/set/var-imp/set.vis
00008  *     - ./gecode/float/var-imp/float.vis
00009  *
00010  *  This file contains generated code fragments which are
00011  *  copyrighted as follows:
00012  *
00013  *  Main author:
00014  *     Christian Schulte <schulte@gecode.org>
00015  *
00016  *  Copyright:
00017  *     Christian Schulte, 2007
00018  *
00019  *  The generated code fragments are part of Gecode, the generic
00020  *  constraint development environment:
00021  *     http://www.gecode.org
00022  *
00023  *  Permission is hereby granted, free of charge, to any person obtaining
00024  *  a copy of this software and associated documentation files (the
00025  *  "Software"), to deal in the Software without restriction, including
00026  *  without limitation the rights to use, copy, modify, merge, publish,
00027  *  distribute, sublicense, and/or sell copies of the Software, and to
00028  *  permit persons to whom the Software is furnished to do so, subject to
00029  *  the following conditions:
00030  *
00031  *  The above copyright notice and this permission notice shall be
00032  *  included in all copies or substantial portions of the Software.
00033  *
00034  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00035  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00036  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00037  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00038  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00039  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00040  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00041  *
00042  */
00043 
00044 #ifdef GECODE_HAS_INT_VARS
00045 namespace Gecode { namespace Int {
00047   class IntVarImpBase : public Gecode::VarImp<Gecode::Int::IntVarImpConf> {
00048   protected:
00050     IntVarImpBase(Gecode::Space& home, IntVarImpBase& x);
00051   public:
00053     IntVarImpBase(void);
00055     IntVarImpBase(Gecode::Space& home);
00057 
00058 
00070     void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
00072     void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed);
00074     Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
00076     static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me);
00085     void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned);
00087   };
00088 }}
00089 #endif
00090 #ifdef GECODE_HAS_INT_VARS
00091 namespace Gecode { namespace Int {
00093   class BoolVarImpBase : public Gecode::VarImp<Gecode::Int::BoolVarImpConf> {
00094   protected:
00096     BoolVarImpBase(Gecode::Space& home, BoolVarImpBase& x);
00097   public:
00099     BoolVarImpBase(void);
00101     BoolVarImpBase(Gecode::Space& home);
00103 
00104 
00116     void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
00118     void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed);
00120     Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
00122     static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me);
00131     void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned);
00133   };
00134 }}
00135 #endif
00136 #ifdef GECODE_HAS_SET_VARS
00137 namespace Gecode { namespace Set {
00139   class SetVarImpBase : public Gecode::VarImp<Gecode::Set::SetVarImpConf> {
00140   protected:
00142     SetVarImpBase(Gecode::Space& home, SetVarImpBase& x);
00143   public:
00145     SetVarImpBase(void);
00147     SetVarImpBase(Gecode::Space& home);
00149 
00150 
00162     void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
00164     void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed);
00166     Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
00168     static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me);
00177     void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned);
00179   };
00180 }}
00181 #endif
00182 #ifdef GECODE_HAS_FLOAT_VARS
00183 namespace Gecode { namespace Float {
00185   class FloatVarImpBase : public Gecode::VarImp<Gecode::Float::FloatVarImpConf> {
00186   protected:
00188     FloatVarImpBase(Gecode::Space& home, FloatVarImpBase& x);
00189   public:
00191     FloatVarImpBase(void);
00193     FloatVarImpBase(Gecode::Space& home);
00195 
00196 
00208     void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule);
00210     void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed);
00212     Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d);
00214     static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me);
00223     void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned);
00225   };
00226 }}
00227 #endif
00228 #ifdef GECODE_HAS_INT_VARS
00229 namespace Gecode { namespace Int {
00230 
00231   forceinline
00232   IntVarImpBase::IntVarImpBase(void) {}
00233 
00234   forceinline
00235   IntVarImpBase::IntVarImpBase(Gecode::Space& home)
00236     : Gecode::VarImp<Gecode::Int::IntVarImpConf>(home) {}
00237 
00238   forceinline
00239   IntVarImpBase::IntVarImpBase(Gecode::Space& home, IntVarImpBase& x)
00240     : Gecode::VarImp<Gecode::Int::IntVarImpConf>(home,x) {}
00241 
00242   forceinline void
00243   IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
00244     Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,p,pc,assigned,ME_INT_BND,schedule);
00245   }
00246   forceinline void
00247   IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) {
00248     Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,a,assigned,failed);
00249   }
00250 
00251   forceinline void
00252   IntVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) {
00253     Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,p,me);
00254   }
00255   forceinline void
00256   IntVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) {
00257     Gecode::VarImp<Gecode::Int::IntVarImpConf>::reschedule(home,p,pc,assigned,ME_INT_BND);
00258   }
00259 
00260   forceinline Gecode::ModEvent
00261   IntVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) {
00262     switch (me) {
00263     case ME_INT_VAL:
00264       // Conditions: VAL, BND, DOM
00265       Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_VAL,PC_INT_DOM,ME_INT_VAL);
00266       if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_VAL,d))
00267         return ME_INT_FAILED;
00268       cancel(home);
00269       break;
00270     case ME_INT_BND:
00271       // Conditions: BND, DOM
00272       Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_BND,PC_INT_DOM,ME_INT_BND);
00273       if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_BND,d))
00274         return ME_INT_FAILED;
00275       break;
00276     case ME_INT_DOM:
00277       // Conditions: DOM
00278       Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_DOM,PC_INT_DOM,ME_INT_DOM);
00279       if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_DOM,d))
00280         return ME_INT_FAILED;
00281       break;
00282     default: GECODE_NEVER;
00283     }
00284     return me;
00285   }
00286 
00287 }}
00288 #endif
00289 #ifdef GECODE_HAS_INT_VARS
00290 namespace Gecode { namespace Int {
00291 
00292   forceinline
00293   BoolVarImpBase::BoolVarImpBase(void) {}
00294 
00295   forceinline
00296   BoolVarImpBase::BoolVarImpBase(Gecode::Space& home)
00297     : Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home) {}
00298 
00299   forceinline
00300   BoolVarImpBase::BoolVarImpBase(Gecode::Space& home, BoolVarImpBase& x)
00301     : Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home,x) {}
00302 
00303   forceinline void
00304   BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
00305     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,p,pc,assigned,ME_BOOL_VAL,schedule);
00306   }
00307   forceinline void
00308   BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) {
00309     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,a,assigned,failed);
00310   }
00311 
00312   forceinline void
00313   BoolVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) {
00314     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::schedule(home,p,me);
00315   }
00316   forceinline void
00317   BoolVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) {
00318     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::reschedule(home,p,pc,assigned,ME_BOOL_VAL);
00319   }
00320 
00321   forceinline Gecode::ModEvent
00322   BoolVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent, Gecode::Delta& d) {
00323     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::schedule(home,PC_BOOL_VAL,PC_BOOL_VAL,ME_BOOL_VAL);
00324     if (!Gecode::VarImp<Gecode::Int::BoolVarImpConf>::advise(home,ME_BOOL_VAL,d))
00325       return ME_BOOL_FAILED;
00326     cancel(home);
00327     return ME_BOOL_VAL;
00328   }
00329 
00330 }}
00331 #endif
00332 #ifdef GECODE_HAS_SET_VARS
00333 namespace Gecode { namespace Set {
00334 
00335   forceinline
00336   SetVarImpBase::SetVarImpBase(void) {}
00337 
00338   forceinline
00339   SetVarImpBase::SetVarImpBase(Gecode::Space& home)
00340     : Gecode::VarImp<Gecode::Set::SetVarImpConf>(home) {}
00341 
00342   forceinline
00343   SetVarImpBase::SetVarImpBase(Gecode::Space& home, SetVarImpBase& x)
00344     : Gecode::VarImp<Gecode::Set::SetVarImpConf>(home,x) {}
00345 
00346   forceinline void
00347   SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
00348     Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,p,pc,assigned,ME_SET_CBB,schedule);
00349   }
00350   forceinline void
00351   SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) {
00352     Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,a,assigned,failed);
00353   }
00354 
00355   forceinline void
00356   SetVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) {
00357     Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,p,me);
00358   }
00359   forceinline void
00360   SetVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) {
00361     Gecode::VarImp<Gecode::Set::SetVarImpConf>::reschedule(home,p,pc,assigned,ME_SET_CBB);
00362   }
00363 
00364   forceinline Gecode::ModEvent
00365   SetVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) {
00366     switch (me) {
00367     case ME_SET_VAL:
00368       // Conditions: VAL, CARD, CLUB, CGLB, ANY
00369       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_VAL,PC_SET_ANY,ME_SET_VAL);
00370       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_VAL,d))
00371         return ME_SET_FAILED;
00372       cancel(home);
00373       break;
00374     case ME_SET_CARD:
00375       // Conditions: CARD, CLUB, CGLB, ANY
00376       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CARD);
00377       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CARD,d))
00378         return ME_SET_FAILED;
00379       break;
00380     case ME_SET_LUB:
00381       // Conditions: CLUB, ANY
00382       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CLUB,PC_SET_CLUB,ME_SET_LUB);
00383       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_ANY,PC_SET_ANY,ME_SET_LUB);
00384       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_LUB,d))
00385         return ME_SET_FAILED;
00386       break;
00387     case ME_SET_GLB:
00388       // Conditions: CGLB, ANY
00389       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CGLB,PC_SET_ANY,ME_SET_GLB);
00390       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_GLB,d))
00391         return ME_SET_FAILED;
00392       break;
00393     case ME_SET_BB:
00394       // Conditions: CLUB, CGLB, ANY
00395       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CLUB,PC_SET_ANY,ME_SET_BB);
00396       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_BB,d))
00397         return ME_SET_FAILED;
00398       break;
00399     case ME_SET_CLUB:
00400       // Conditions: CARD, CLUB, CGLB, ANY
00401       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CLUB);
00402       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CLUB,d))
00403         return ME_SET_FAILED;
00404       break;
00405     case ME_SET_CGLB:
00406       // Conditions: CARD, CLUB, CGLB, ANY
00407       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CGLB);
00408       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CGLB,d))
00409         return ME_SET_FAILED;
00410       break;
00411     case ME_SET_CBB:
00412       // Conditions: CARD, CLUB, CGLB, ANY
00413       Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CBB);
00414       if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CBB,d))
00415         return ME_SET_FAILED;
00416       break;
00417     default: GECODE_NEVER;
00418     }
00419     return me;
00420   }
00421 
00422 }}
00423 #endif
00424 #ifdef GECODE_HAS_FLOAT_VARS
00425 namespace Gecode { namespace Float {
00426 
00427   forceinline
00428   FloatVarImpBase::FloatVarImpBase(void) {}
00429 
00430   forceinline
00431   FloatVarImpBase::FloatVarImpBase(Gecode::Space& home)
00432     : Gecode::VarImp<Gecode::Float::FloatVarImpConf>(home) {}
00433 
00434   forceinline
00435   FloatVarImpBase::FloatVarImpBase(Gecode::Space& home, FloatVarImpBase& x)
00436     : Gecode::VarImp<Gecode::Float::FloatVarImpConf>(home,x) {}
00437 
00438   forceinline void
00439   FloatVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) {
00440     Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe(home,p,pc,assigned,ME_FLOAT_BND,schedule);
00441   }
00442   forceinline void
00443   FloatVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) {
00444     Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe(home,a,assigned,failed);
00445   }
00446 
00447   forceinline void
00448   FloatVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) {
00449     Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,p,me);
00450   }
00451   forceinline void
00452   FloatVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) {
00453     Gecode::VarImp<Gecode::Float::FloatVarImpConf>::reschedule(home,p,pc,assigned,ME_FLOAT_BND);
00454   }
00455 
00456   forceinline Gecode::ModEvent
00457   FloatVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) {
00458     switch (me) {
00459     case ME_FLOAT_VAL:
00460       // Conditions: VAL, BND
00461       Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,PC_FLOAT_VAL,PC_FLOAT_BND,ME_FLOAT_VAL);
00462       if (!Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise(home,ME_FLOAT_VAL,d))
00463         return ME_FLOAT_FAILED;
00464       cancel(home);
00465       break;
00466     case ME_FLOAT_BND:
00467       // Conditions: BND
00468       Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,PC_FLOAT_BND,PC_FLOAT_BND,ME_FLOAT_BND);
00469       if (!Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise(home,ME_FLOAT_BND,d))
00470         return ME_FLOAT_FAILED;
00471       break;
00472     default: GECODE_NEVER;
00473     }
00474     return me;
00475   }
00476 
00477 }}
00478 #endif
00479 namespace Gecode {
00480 
00481   forceinline void
00482   Space::update(ActorLink** sub) {
00483 #ifdef GECODE_HAS_INT_VARS
00484     Gecode::VarImp<Gecode::Int::IntVarImpConf>::update(*this,sub);
00485 #endif
00486 #ifdef GECODE_HAS_INT_VARS
00487     Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update(*this,sub);
00488 #endif
00489 #ifdef GECODE_HAS_SET_VARS
00490     Gecode::VarImp<Gecode::Set::SetVarImpConf>::update(*this,sub);
00491 #endif
00492 #ifdef GECODE_HAS_FLOAT_VARS
00493     Gecode::VarImp<Gecode::Float::FloatVarImpConf>::update(*this,sub);
00494 #endif
00495   }
00496 }
00497 // STATISTICS: kernel-var