1 /* 2 * CAUTION: 3 * This file has been automatically generated. Do not edit, 4 * edit the following files instead: 5 * - ./gecode/int/var-imp/int.vis 6 * - ./gecode/int/var-imp/bool.vis 7 * - ./gecode/set/var-imp/set.vis 8 * - ./gecode/float/var-imp/float.vis 9 * 10 * This file contains generated code fragments which are 11 * copyrighted as follows: 12 * 13 * Main author: 14 * Christian Schulte <schulte@gecode.org> 15 * 16 * Copyright: 17 * Christian Schulte, 2007 18 * 19 * The generated code fragments are part of Gecode, the generic 20 * constraint development environment: 21 * http://www.gecode.org 22 * 23 * Permission is hereby granted, free of charge, to any person obtaining 24 * a copy of this software and associated documentation files (the 25 * "Software"), to deal in the Software without restriction, including 26 * without limitation the rights to use, copy, modify, merge, publish, 27 * distribute, sublicense, and/or sell copies of the Software, and to 28 * permit persons to whom the Software is furnished to do so, subject to 29 * the following conditions: 30 * 31 * The above copyright notice and this permission notice shall be 32 * included in all copies or substantial portions of the Software. 33 * 34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 35 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 36 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 37 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 38 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 39 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 40 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 41 * 42 */ 43 44 #ifdef GECODE_HAS_INT_VARS 45 namespace Gecode { namespace Int { 46 /// Base-class for Int-variable implementations 47 class IntVarImpBase : public Gecode::VarImp<Gecode::Int::IntVarImpConf> { 48 protected: 49 /// Constructor for cloning \a x 50 IntVarImpBase(Gecode::Space& home, IntVarImpBase& x); 51 public: 52 /// Constructor for creating static instance of variable 53 IntVarImpBase(void); 54 /// Constructor for creating variable 55 IntVarImpBase(Gecode::Space& home); 56 /// \name Dependencies 57 //@{ 58 /** \brief Subscribe propagator \a p with propagation condition \a pc 59 * 60 * In case \a schedule is false, the propagator is just subscribed but 61 * not scheduled for execution (this must be used when creating 62 * subscriptions during propagation). 63 * 64 * In case the variable is assigned (that is, \a assigned is 65 * true), the subscribing propagator is scheduled for execution. 66 * Otherwise, the propagator subscribes and is scheduled for execution 67 * with modification event \a me provided that \a pc is different 68 * from \a PC_INT_VAL. 69 */ 70 void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule); 71 /// Subscribe advisor \a a if \a assigned is false. 72 void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed); 73 /// Notify that variable implementation has been modified with modification event \a me and delta information \a d 74 Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d); 75 /// \brief Schedule propagator \a p 76 static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me); 77 /** \brief Re-schedule propagator \a p 78 * 79 * In case the variable is assigned (that is, \a assigned is 80 * true), the propagator is scheduled for execution. 81 * Otherwise, the propagator is scheduled for execution 82 * with modification event \a me provided that \a pc is different 83 * from \a PC_INT_VAL. 84 */ 85 void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); 86 //@} 87 }; 88 }} 89 #endif 90 #ifdef GECODE_HAS_INT_VARS 91 namespace Gecode { namespace Int { 92 /// Base-class for Bool-variable implementations 93 class BoolVarImpBase : public Gecode::VarImp<Gecode::Int::BoolVarImpConf> { 94 protected: 95 /// Constructor for cloning \a x 96 BoolVarImpBase(Gecode::Space& home, BoolVarImpBase& x); 97 public: 98 /// Constructor for creating static instance of variable 99 BoolVarImpBase(void); 100 /// Constructor for creating variable 101 BoolVarImpBase(Gecode::Space& home); 102 /// \name Dependencies 103 //@{ 104 /** \brief Subscribe propagator \a p with propagation condition \a pc 105 * 106 * In case \a schedule is false, the propagator is just subscribed but 107 * not scheduled for execution (this must be used when creating 108 * subscriptions during propagation). 109 * 110 * In case the variable is assigned (that is, \a assigned is 111 * true), the subscribing propagator is scheduled for execution. 112 * Otherwise, the propagator subscribes and is scheduled for execution 113 * with modification event \a me provided that \a pc is different 114 * from \a PC_BOOL_VAL. 115 */ 116 void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule); 117 /// Subscribe advisor \a a if \a assigned is false. 118 void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed); 119 /// Notify that variable implementation has been modified with modification event \a me and delta information \a d 120 Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d); 121 /// \brief Schedule propagator \a p 122 static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me); 123 /** \brief Re-schedule propagator \a p 124 * 125 * In case the variable is assigned (that is, \a assigned is 126 * true), the propagator is scheduled for execution. 127 * Otherwise, the propagator is scheduled for execution 128 * with modification event \a me provided that \a pc is different 129 * from \a PC_BOOL_VAL. 130 */ 131 void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); 132 //@} 133 }; 134 }} 135 #endif 136 #ifdef GECODE_HAS_SET_VARS 137 namespace Gecode { namespace Set { 138 /// Base-class for Set-variable implementations 139 class SetVarImpBase : public Gecode::VarImp<Gecode::Set::SetVarImpConf> { 140 protected: 141 /// Constructor for cloning \a x 142 SetVarImpBase(Gecode::Space& home, SetVarImpBase& x); 143 public: 144 /// Constructor for creating static instance of variable 145 SetVarImpBase(void); 146 /// Constructor for creating variable 147 SetVarImpBase(Gecode::Space& home); 148 /// \name Dependencies 149 //@{ 150 /** \brief Subscribe propagator \a p with propagation condition \a pc 151 * 152 * In case \a schedule is false, the propagator is just subscribed but 153 * not scheduled for execution (this must be used when creating 154 * subscriptions during propagation). 155 * 156 * In case the variable is assigned (that is, \a assigned is 157 * true), the subscribing propagator is scheduled for execution. 158 * Otherwise, the propagator subscribes and is scheduled for execution 159 * with modification event \a me provided that \a pc is different 160 * from \a PC_SET_VAL. 161 */ 162 void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule); 163 /// Subscribe advisor \a a if \a assigned is false. 164 void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed); 165 /// Notify that variable implementation has been modified with modification event \a me and delta information \a d 166 Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d); 167 /// \brief Schedule propagator \a p 168 static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me); 169 /** \brief Re-schedule propagator \a p 170 * 171 * In case the variable is assigned (that is, \a assigned is 172 * true), the propagator is scheduled for execution. 173 * Otherwise, the propagator is scheduled for execution 174 * with modification event \a me provided that \a pc is different 175 * from \a PC_SET_VAL. 176 */ 177 void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); 178 //@} 179 }; 180 }} 181 #endif 182 #ifdef GECODE_HAS_FLOAT_VARS 183 namespace Gecode { namespace Float { 184 /// Base-class for Float-variable implementations 185 class FloatVarImpBase : public Gecode::VarImp<Gecode::Float::FloatVarImpConf> { 186 protected: 187 /// Constructor for cloning \a x 188 FloatVarImpBase(Gecode::Space& home, FloatVarImpBase& x); 189 public: 190 /// Constructor for creating static instance of variable 191 FloatVarImpBase(void); 192 /// Constructor for creating variable 193 FloatVarImpBase(Gecode::Space& home); 194 /// \name Dependencies 195 //@{ 196 /** \brief Subscribe propagator \a p with propagation condition \a pc 197 * 198 * In case \a schedule is false, the propagator is just subscribed but 199 * not scheduled for execution (this must be used when creating 200 * subscriptions during propagation). 201 * 202 * In case the variable is assigned (that is, \a assigned is 203 * true), the subscribing propagator is scheduled for execution. 204 * Otherwise, the propagator subscribes and is scheduled for execution 205 * with modification event \a me provided that \a pc is different 206 * from \a PC_FLOAT_VAL. 207 */ 208 void subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule); 209 /// Subscribe advisor \a a if \a assigned is false. 210 void subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed); 211 /// Notify that variable implementation has been modified with modification event \a me and delta information \a d 212 Gecode::ModEvent notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d); 213 /// \brief Schedule propagator \a p 214 static void schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me); 215 /** \brief Re-schedule propagator \a p 216 * 217 * In case the variable is assigned (that is, \a assigned is 218 * true), the propagator is scheduled for execution. 219 * Otherwise, the propagator is scheduled for execution 220 * with modification event \a me provided that \a pc is different 221 * from \a PC_FLOAT_VAL. 222 */ 223 void reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned); 224 //@} 225 }; 226 }} 227 #endif 228 #ifdef GECODE_HAS_INT_VARS 229 namespace Gecode { namespace Int { 230 231 forceinline IntVarImpBase(void)232 IntVarImpBase::IntVarImpBase(void) {} 233 234 forceinline IntVarImpBase(Gecode::Space & home)235 IntVarImpBase::IntVarImpBase(Gecode::Space& home) 236 : Gecode::VarImp<Gecode::Int::IntVarImpConf>(home) {} 237 238 forceinline IntVarImpBase(Gecode::Space & home,IntVarImpBase & x)239 IntVarImpBase::IntVarImpBase(Gecode::Space& home, IntVarImpBase& x) 240 : Gecode::VarImp<Gecode::Int::IntVarImpConf>(home,x) {} 241 242 forceinline void subscribe(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned,bool schedule)243 IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) { 244 Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,p,pc,assigned,ME_INT_BND,schedule); 245 } 246 forceinline void subscribe(Gecode::Space & home,Gecode::Advisor & a,bool assigned,bool failed)247 IntVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) { 248 Gecode::VarImp<Gecode::Int::IntVarImpConf>::subscribe(home,a,assigned,failed); 249 } 250 251 forceinline void schedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::ModEvent me)252 IntVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) { 253 Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,p,me); 254 } 255 forceinline void reschedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned)256 IntVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) { 257 Gecode::VarImp<Gecode::Int::IntVarImpConf>::reschedule(home,p,pc,assigned,ME_INT_BND); 258 } 259 260 forceinline Gecode::ModEvent notify(Gecode::Space & home,Gecode::ModEvent me,Gecode::Delta & d)261 IntVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) { 262 switch (me) { 263 case ME_INT_VAL: 264 // Conditions: VAL, BND, DOM 265 Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_VAL,PC_INT_DOM,ME_INT_VAL); 266 if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_VAL,d)) 267 return ME_INT_FAILED; 268 cancel(home); 269 break; 270 case ME_INT_BND: 271 // Conditions: BND, DOM 272 Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_BND,PC_INT_DOM,ME_INT_BND); 273 if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_BND,d)) 274 return ME_INT_FAILED; 275 break; 276 case ME_INT_DOM: 277 // Conditions: DOM 278 Gecode::VarImp<Gecode::Int::IntVarImpConf>::schedule(home,PC_INT_DOM,PC_INT_DOM,ME_INT_DOM); 279 if (!Gecode::VarImp<Gecode::Int::IntVarImpConf>::advise(home,ME_INT_DOM,d)) 280 return ME_INT_FAILED; 281 break; 282 default: GECODE_NEVER; 283 } 284 return me; 285 } 286 287 }} 288 #endif 289 #ifdef GECODE_HAS_INT_VARS 290 namespace Gecode { namespace Int { 291 292 forceinline BoolVarImpBase(void)293 BoolVarImpBase::BoolVarImpBase(void) {} 294 295 forceinline BoolVarImpBase(Gecode::Space & home)296 BoolVarImpBase::BoolVarImpBase(Gecode::Space& home) 297 : Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home) {} 298 299 forceinline BoolVarImpBase(Gecode::Space & home,BoolVarImpBase & x)300 BoolVarImpBase::BoolVarImpBase(Gecode::Space& home, BoolVarImpBase& x) 301 : Gecode::VarImp<Gecode::Int::BoolVarImpConf>(home,x) {} 302 303 forceinline void subscribe(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned,bool schedule)304 BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) { 305 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,p,pc,assigned,ME_BOOL_VAL,schedule); 306 } 307 forceinline void subscribe(Gecode::Space & home,Gecode::Advisor & a,bool assigned,bool failed)308 BoolVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) { 309 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::subscribe(home,a,assigned,failed); 310 } 311 312 forceinline void schedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::ModEvent me)313 BoolVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) { 314 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::schedule(home,p,me); 315 } 316 forceinline void reschedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned)317 BoolVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) { 318 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::reschedule(home,p,pc,assigned,ME_BOOL_VAL); 319 } 320 321 forceinline Gecode::ModEvent notify(Gecode::Space & home,Gecode::ModEvent,Gecode::Delta & d)322 BoolVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent, Gecode::Delta& d) { 323 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::schedule(home,PC_BOOL_VAL,PC_BOOL_VAL,ME_BOOL_VAL); 324 if (!Gecode::VarImp<Gecode::Int::BoolVarImpConf>::advise(home,ME_BOOL_VAL,d)) 325 return ME_BOOL_FAILED; 326 cancel(home); 327 return ME_BOOL_VAL; 328 } 329 330 }} 331 #endif 332 #ifdef GECODE_HAS_SET_VARS 333 namespace Gecode { namespace Set { 334 335 forceinline SetVarImpBase(void)336 SetVarImpBase::SetVarImpBase(void) {} 337 338 forceinline SetVarImpBase(Gecode::Space & home)339 SetVarImpBase::SetVarImpBase(Gecode::Space& home) 340 : Gecode::VarImp<Gecode::Set::SetVarImpConf>(home) {} 341 342 forceinline SetVarImpBase(Gecode::Space & home,SetVarImpBase & x)343 SetVarImpBase::SetVarImpBase(Gecode::Space& home, SetVarImpBase& x) 344 : Gecode::VarImp<Gecode::Set::SetVarImpConf>(home,x) {} 345 346 forceinline void subscribe(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned,bool schedule)347 SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) { 348 Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,p,pc,assigned,ME_SET_CBB,schedule); 349 } 350 forceinline void subscribe(Gecode::Space & home,Gecode::Advisor & a,bool assigned,bool failed)351 SetVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) { 352 Gecode::VarImp<Gecode::Set::SetVarImpConf>::subscribe(home,a,assigned,failed); 353 } 354 355 forceinline void schedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::ModEvent me)356 SetVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) { 357 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,p,me); 358 } 359 forceinline void reschedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned)360 SetVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) { 361 Gecode::VarImp<Gecode::Set::SetVarImpConf>::reschedule(home,p,pc,assigned,ME_SET_CBB); 362 } 363 364 forceinline Gecode::ModEvent notify(Gecode::Space & home,Gecode::ModEvent me,Gecode::Delta & d)365 SetVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) { 366 switch (me) { 367 case ME_SET_VAL: 368 // Conditions: VAL, CARD, CLUB, CGLB, ANY 369 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_VAL,PC_SET_ANY,ME_SET_VAL); 370 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_VAL,d)) 371 return ME_SET_FAILED; 372 cancel(home); 373 break; 374 case ME_SET_CARD: 375 // Conditions: CARD, CLUB, CGLB, ANY 376 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CARD); 377 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CARD,d)) 378 return ME_SET_FAILED; 379 break; 380 case ME_SET_LUB: 381 // Conditions: CLUB, ANY 382 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CLUB,PC_SET_CLUB,ME_SET_LUB); 383 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_ANY,PC_SET_ANY,ME_SET_LUB); 384 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_LUB,d)) 385 return ME_SET_FAILED; 386 break; 387 case ME_SET_GLB: 388 // Conditions: CGLB, ANY 389 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CGLB,PC_SET_ANY,ME_SET_GLB); 390 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_GLB,d)) 391 return ME_SET_FAILED; 392 break; 393 case ME_SET_BB: 394 // Conditions: CLUB, CGLB, ANY 395 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CLUB,PC_SET_ANY,ME_SET_BB); 396 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_BB,d)) 397 return ME_SET_FAILED; 398 break; 399 case ME_SET_CLUB: 400 // Conditions: CARD, CLUB, CGLB, ANY 401 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CLUB); 402 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CLUB,d)) 403 return ME_SET_FAILED; 404 break; 405 case ME_SET_CGLB: 406 // Conditions: CARD, CLUB, CGLB, ANY 407 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CGLB); 408 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CGLB,d)) 409 return ME_SET_FAILED; 410 break; 411 case ME_SET_CBB: 412 // Conditions: CARD, CLUB, CGLB, ANY 413 Gecode::VarImp<Gecode::Set::SetVarImpConf>::schedule(home,PC_SET_CARD,PC_SET_ANY,ME_SET_CBB); 414 if (!Gecode::VarImp<Gecode::Set::SetVarImpConf>::advise(home,ME_SET_CBB,d)) 415 return ME_SET_FAILED; 416 break; 417 default: GECODE_NEVER; 418 } 419 return me; 420 } 421 422 }} 423 #endif 424 #ifdef GECODE_HAS_FLOAT_VARS 425 namespace Gecode { namespace Float { 426 427 forceinline FloatVarImpBase(void)428 FloatVarImpBase::FloatVarImpBase(void) {} 429 430 forceinline FloatVarImpBase(Gecode::Space & home)431 FloatVarImpBase::FloatVarImpBase(Gecode::Space& home) 432 : Gecode::VarImp<Gecode::Float::FloatVarImpConf>(home) {} 433 434 forceinline FloatVarImpBase(Gecode::Space & home,FloatVarImpBase & x)435 FloatVarImpBase::FloatVarImpBase(Gecode::Space& home, FloatVarImpBase& x) 436 : Gecode::VarImp<Gecode::Float::FloatVarImpConf>(home,x) {} 437 438 forceinline void subscribe(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned,bool schedule)439 FloatVarImpBase::subscribe(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned, bool schedule) { 440 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe(home,p,pc,assigned,ME_FLOAT_BND,schedule); 441 } 442 forceinline void subscribe(Gecode::Space & home,Gecode::Advisor & a,bool assigned,bool failed)443 FloatVarImpBase::subscribe(Gecode::Space& home, Gecode::Advisor& a, bool assigned, bool failed) { 444 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::subscribe(home,a,assigned,failed); 445 } 446 447 forceinline void schedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::ModEvent me)448 FloatVarImpBase::schedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::ModEvent me) { 449 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,p,me); 450 } 451 forceinline void reschedule(Gecode::Space & home,Gecode::Propagator & p,Gecode::PropCond pc,bool assigned)452 FloatVarImpBase::reschedule(Gecode::Space& home, Gecode::Propagator& p, Gecode::PropCond pc, bool assigned) { 453 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::reschedule(home,p,pc,assigned,ME_FLOAT_BND); 454 } 455 456 forceinline Gecode::ModEvent notify(Gecode::Space & home,Gecode::ModEvent me,Gecode::Delta & d)457 FloatVarImpBase::notify(Gecode::Space& home, Gecode::ModEvent me, Gecode::Delta& d) { 458 switch (me) { 459 case ME_FLOAT_VAL: 460 // Conditions: VAL, BND 461 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,PC_FLOAT_VAL,PC_FLOAT_BND,ME_FLOAT_VAL); 462 if (!Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise(home,ME_FLOAT_VAL,d)) 463 return ME_FLOAT_FAILED; 464 cancel(home); 465 break; 466 case ME_FLOAT_BND: 467 // Conditions: BND 468 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::schedule(home,PC_FLOAT_BND,PC_FLOAT_BND,ME_FLOAT_BND); 469 if (!Gecode::VarImp<Gecode::Float::FloatVarImpConf>::advise(home,ME_FLOAT_BND,d)) 470 return ME_FLOAT_FAILED; 471 break; 472 default: GECODE_NEVER; 473 } 474 return me; 475 } 476 477 }} 478 #endif 479 namespace Gecode { 480 481 forceinline void update(ActorLink ** sub)482 Space::update(ActorLink** sub) { 483 #ifdef GECODE_HAS_INT_VARS 484 Gecode::VarImp<Gecode::Int::IntVarImpConf>::update(*this,sub); 485 #endif 486 #ifdef GECODE_HAS_INT_VARS 487 Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update(*this,sub); 488 #endif 489 #ifdef GECODE_HAS_SET_VARS 490 Gecode::VarImp<Gecode::Set::SetVarImpConf>::update(*this,sub); 491 #endif 492 #ifdef GECODE_HAS_FLOAT_VARS 493 Gecode::VarImp<Gecode::Float::FloatVarImpConf>::update(*this,sub); 494 #endif 495 } 496 } 497 // STATISTICS: kernel-var 498