Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
Gecode::VarImp< VIC > Class Template Reference

Base-class for variable implementations. More...

#include <core.hpp>

Public Member Functions

 VarImp (Space &home)
 Creation. More...
 
 VarImp (void)
 Creation of static instances. More...
 

Protected Member Functions

void cancel (Space &home)
 Cancel all subscriptions when variable implementation is assigned. More...
 
bool advise (Space &home, ModEvent me, Delta &d)
 Run advisors when variable implementation has been modified with modification event me and domain change d. More...
 
ModEvent fail (Space &home)
 Run advisors to be run on failure and returns ME_GEN_FAILED. More...
 
void schedule (Space &home, PropCond pc1, PropCond pc2, ModEvent me)
 Schedule subscribed propagators. More...
 

Dependencies

void subscribe (Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me, bool schedule)
 Subscribe propagator p with propagation condition pc. More...
 
void cancel (Space &home, Propagator &p, PropCond pc)
 Cancel subscription of propagator p with propagation condition pc. More...
 
void subscribe (Space &home, Advisor &a, bool assigned, bool fail)
 Subscribe advisor a to variable. More...
 
void cancel (Space &home, Advisor &a, bool fail)
 Cancel subscription of advisor a. More...
 
unsigned int degree (void) const
 Return degree (number of subscribed propagators and advisors) More...
 
double afc (void) const
 Return accumulated failure count (plus degree) More...
 

Cloning variables

 VarImp (Space &home, VarImp &x)
 Constructor for cloning. More...
 
bool copied (void) const
 Is variable already copied. More...
 
VarImpforward (void) const
 Use forward pointer if variable already copied. More...
 
VarImpnext (void) const
 Return next copied variable. More...
 

Variable implementation-dependent propagator support

static void schedule (Space &home, Propagator &p, ModEvent me, bool force=false)
 Schedule propagator p with modification event me. More...
 
static void reschedule (Space &home, Propagator &p, PropCond pc, bool assigned, ModEvent me)
 Schedule propagator p. More...
 
static ModEvent me (const ModEventDelta &med)
 Project modification event for this variable type from med. More...
 
static ModEventDelta med (ModEvent me)
 Translate modification event me into modification event delta. More...
 
static ModEvent me_combine (ModEvent me1, ModEvent me2)
 Combine modifications events me1 and me2. More...
 

Delta information for advisors

static ModEvent modevent (const Delta &d)
 Return modification event. More...
 

Bit management

unsigned int bits (void) const
 Provide access to free bits. More...
 
unsigned int & bits (void)
 Provide access to free bits. More...
 

Memory management

static void * operator new (size_t, Space &)
 Allocate memory from space. More...
 
static void operator delete (void *, Space &)
 Return memory to space. More...
 
static void operator delete (void *)
 Needed for exceptions. More...
 

Detailed Description

template<class VIC>
class Gecode::VarImp< VIC >

Base-class for variable implementations.

Implements variable implementation for variable implementation configuration of type VIC.

Definition at line 156 of file core.hpp.

Constructor & Destructor Documentation

◆ VarImp() [1/3]

template<class VIC >
Gecode::VarImp< VIC >::VarImp ( Space home)
inline

Creation.

Definition at line 4040 of file core.hpp.

◆ VarImp() [2/3]

template<class VIC >
Gecode::VarImp< VIC >::VarImp ( void  )
inline

Creation of static instances.

Definition at line 4056 of file core.hpp.

◆ VarImp() [3/3]

template<class VIC >
Gecode::VarImp< VIC >::VarImp ( Space home,
VarImp< VIC > &  x 
)
inline

Constructor for cloning.

Definition at line 4161 of file core.hpp.

Member Function Documentation

◆ cancel() [1/3]

template<class VIC >
void Gecode::VarImp< VIC >::cancel ( Space home)
inlineprotected

Cancel all subscriptions when variable implementation is assigned.

Definition at line 4406 of file core.hpp.

◆ advise()

template<class VIC >
bool Gecode::VarImp< VIC >::advise ( Space home,
ModEvent  me,
Delta d 
)
inlineprotected

Run advisors when variable implementation has been modified with modification event me and domain change d.

Returns false if an advisor has failed.

Definition at line 4423 of file core.hpp.

◆ fail()

template<class VIC >
ModEvent Gecode::VarImp< VIC >::fail ( Space home)
protected

Run advisors to be run on failure and returns ME_GEN_FAILED.

Definition at line 4489 of file core.hpp.

◆ subscribe() [1/2]

template<class VIC >
void Gecode::VarImp< VIC >::subscribe ( Space home,
Propagator p,
PropCond  pc,
bool  assigned,
ModEvent  me,
bool  schedule 
)
inline

Subscribe propagator p with propagation condition pc.

In case schedule is false, the propagator is just subscribed but not scheduled for execution (this must be used when creating subscriptions during propagation).

In case the variable is assigned (that is, assigned is true), the subscribing propagator is scheduled for execution. Otherwise, the propagator subscribes and is scheduled for execution with modification event me provided that pc is different from PC_GEN_ASSIGNED.

Definition at line 4301 of file core.hpp.

◆ cancel() [2/3]

template<class VIC >
void Gecode::VarImp< VIC >::cancel ( Space home,
Propagator p,
PropCond  pc 
)
inline

Cancel subscription of propagator p with propagation condition pc.

Definition at line 4367 of file core.hpp.

◆ subscribe() [2/2]

template<class VIC >
void Gecode::VarImp< VIC >::subscribe ( Space home,
Advisor a,
bool  assigned,
bool  fail 
)
inline

Subscribe advisor a to variable.

The advisor a is only subscribed if assigned is false.

If fail is true, the advisor a is also run when a variable operation triggers failure. This feature is undocumented.

Definition at line 4317 of file core.hpp.

◆ cancel() [3/3]

template<class VIC >
void Gecode::VarImp< VIC >::cancel ( Space home,
Advisor a,
bool  fail 
)
inline

Cancel subscription of advisor a.

Definition at line 4397 of file core.hpp.

◆ degree()

template<class VIC >
unsigned int Gecode::VarImp< VIC >::degree ( void  ) const
inline

Return degree (number of subscribed propagators and advisors)

Note that the degree of a variable implementation is not available during cloning.

Definition at line 4077 of file core.hpp.

◆ afc()

template<class VIC >
double Gecode::VarImp< VIC >::afc ( void  ) const
inline

Return accumulated failure count (plus degree)

Note that the accumulated failure count of a variable implementation is not available during cloning.

Definition at line 4084 of file core.hpp.

◆ copied()

template<class VIC >
bool Gecode::VarImp< VIC >::copied ( void  ) const
inline

Is variable already copied.

Definition at line 4141 of file core.hpp.

◆ forward()

template<class VIC >
VarImp< VIC > * Gecode::VarImp< VIC >::forward ( void  ) const
inline

Use forward pointer if variable already copied.

Definition at line 4147 of file core.hpp.

◆ next()

template<class VIC>
VarImp* Gecode::VarImp< VIC >::next ( void  ) const

Return next copied variable.

◆ schedule() [1/2]

template<class VIC >
void Gecode::VarImp< VIC >::schedule ( Space home,
Propagator p,
ModEvent  me,
bool  force = false 
)
inlinestatic

Schedule propagator p with modification event me.

If force is true, the propagator is re-scheduled (including cost computation) even though its modification event delta has not changed.

Definition at line 4207 of file core.hpp.

◆ reschedule()

template<class VIC >
void Gecode::VarImp< VIC >::reschedule ( Space home,
Propagator p,
PropCond  pc,
bool  assigned,
ModEvent  me 
)
inlinestatic

Schedule propagator p.

Schedules a propagator for propagation condition pc and modification event me. If the variable is assigned, the appropriate modification event is used for scheduling.

Definition at line 4326 of file core.hpp.

◆ me()

template<class VIC >
ModEvent Gecode::VarImp< VIC >::me ( const ModEventDelta med)
inlinestatic

Project modification event for this variable type from med.

Definition at line 4189 of file core.hpp.

◆ med()

template<class VIC >
ModEventDelta Gecode::VarImp< VIC >::med ( ModEvent  me)
inlinestatic

Translate modification event me into modification event delta.

Definition at line 4195 of file core.hpp.

◆ me_combine()

template<class VIC >
ModEvent Gecode::VarImp< VIC >::me_combine ( ModEvent  me1,
ModEvent  me2 
)
inlinestatic

Combine modifications events me1 and me2.

Definition at line 4201 of file core.hpp.

◆ modevent()

template<class VIC >
ModEvent Gecode::VarImp< VIC >::modevent ( const Delta d)
inlinestatic

Return modification event.

Definition at line 4109 of file core.hpp.

◆ bits() [1/2]

template<class VIC >
unsigned int Gecode::VarImp< VIC >::bits ( void  ) const
inline

Provide access to free bits.

Definition at line 4115 of file core.hpp.

◆ bits() [2/2]

template<class VIC >
unsigned int & Gecode::VarImp< VIC >::bits ( void  )
inline

Provide access to free bits.

Definition at line 4121 of file core.hpp.

◆ schedule() [2/2]

template<class VIC >
void Gecode::VarImp< VIC >::schedule ( Space home,
PropCond  pc1,
PropCond  pc2,
ModEvent  me 
)
inlineprotected

Schedule subscribed propagators.

Definition at line 4215 of file core.hpp.

◆ operator new()

template<class VIC >
void * Gecode::VarImp< VIC >::operator new ( size_t  s,
Space home 
)
inlinestatic

Allocate memory from space.

Definition at line 2979 of file core.hpp.

◆ operator delete() [1/2]

template<class VIC >
void Gecode::VarImp< VIC >::operator delete ( void *  ,
Space  
)
inlinestatic

Return memory to space.

Definition at line 2976 of file core.hpp.

◆ operator delete() [2/2]

template<class VIC >
void Gecode::VarImp< VIC >::operator delete ( void *  )
inlinestatic

Needed for exceptions.

Definition at line 2973 of file core.hpp.

Member Data Documentation

◆ base

template<class VIC>
ActorLink** Gecode::VarImp< VIC >::base

Subscribed actors.

The base pointer of the array of subscribed actors.

This pointer must be first to avoid padding on 64 bit machines.

Definition at line 232 of file core.hpp.

◆ fwd

template<class VIC>
VarImp<VIC>* Gecode::VarImp< VIC >::fwd

Forwarding pointer.

During cloning, this is used as the forwarding pointer for the variable. The original value is saved in the copy and restored after cloning.

Definition at line 241 of file core.hpp.

◆ idx

template<class VIC>
unsigned int Gecode::VarImp< VIC >::idx
inline

Indices of subscribed actors.

The entries from base[0] to base[idx[pc_max]] are propagators, where the entries between base[idx[pc-1]] and base[idx[pc]] are the propagators that have subscribed with propagation condition pc.

The entries between base[idx[pc_max]] and base[idx[pc_max+1]] are the advisors subscribed to the variable implementation.

Definition at line 272 of file core.hpp.

◆ next

template<class VIC>
VarImp< VIC > * Gecode::VarImp< VIC >::next
inline

During cloning, points to the next copied variable.

Definition at line 274 of file core.hpp.


The documentation for this class was generated from the following file: