Programming actors
Functionality by programming task

## Topics

| Programming integer actors
| Programming set actors
| Programming float actors
| Reified propagator patterns
| Generic brancher based on view and value selection
| Generic brancher based on view selection
| Status of constraint propagation and branching commit
| Propagator patterns

## Classes

class | Gecode::PropCost
| Propagation cost. More...
class | Gecode::Actor
| Base-class for both propagators and branchers. More...
class | Gecode::Propagator
| Base-class for propagators. More...
class | Gecode::Council< A >
| Council of advisors More...
class | Gecode::Advisors< A >
| Class to iterate over advisors of a council. More...
class | Gecode::Advisor
| Base-class for advisors. More...
class | Gecode::Choice
| Choice for performing commit More...
class | Gecode::Brancher
| Base-class for branchers. More...
class | Gecode::ViewArray< View >
| View arrays. More...

## Macros

#define | GECODE_POST
| Check for failure in a constraint post function.
#define | GECODE_ME_CHECK(me)
| Check whether modification event me is failed, and forward failure.
#define | GECODE_ME_CHECK_MODIFIED(modified, me)
| Check whether me is failed or modified, and forward failure.
#define | GECODE_ME_FAIL(me)
| Check whether modification event me is failed, and fail space home.
#define | GECODE_ES_CHECK(es)
| Check whether execution status es is failed or subsumed, and forward failure or subsumption.
#define | GECODE_ES_FAIL(es)
| Check whether execution status es is failed, and fail space home.
#define | GECODE_REWRITE(prop, post)
| Rewrite propagator by executing post function.

## Typedefs

typedef int | Gecode::ModEventDelta
| Modification event deltas.

## Enumerations

enum | Gecode::ActorProperty { Gecode::AP_DISPOSE = (1 << 0) , Gecode::AP_WEAKLY = (1 << 1) , Gecode::AP_VIEW_TRACE = (1 << 2) , Gecode::AP_TRACE = (1 << 3) }
| Actor properties. More...

## Functions

bool | Gecode::me_failed (ModEvent me)
| Check whether modification event me is failed.
bool | Gecode::me_modified (ModEvent me)
| Check whether modification event me describes variable modification.

## update, and dispose variables

void | Gecode::Space::notice (Actor &a, ActorProperty p, bool duplicate=false)
| Notice actor property.
void | Gecode::Space::ignore (Actor &a, ActorProperty p, bool duplicate=false)
| Ignore actor property.
void | Gecode::Space::fail (void)
| Fail space.
bool | Gecode::Space::failed (void) const
| Check whether space is failed.
bool | Gecode::Space::stable (void) const
| Return if space is stable (at fixpoint or failed).

## Detailed Description

## Macro Definition Documentation

## GECODE_POST

#define GECODE_POST

Value:
if (home.failed()) return; \
::Gecode::PostInfo __gecode__pi(home);
Gecode::PostInfo
Class to set group information when a post function is executed.
Definition core.hpp:948

Check for failure in a constraint post function.

Also sets group information for posting.

Definition at line 40 of file macros.hpp.

## GECODE_ME_CHECK

#define GECODE_ME_CHECK | ( |  | me | ) |

Value:
do { \
if (::Gecode::me_failed(me)) \
return ::Gecode::ES_FAILED; \
} while (0)
Gecode::me_failed
bool me_failed(ModEvent me)
Check whether modification event me is failed.
Definition modevent.hpp:54

Check whether modification event me is failed, and forward failure.

To be used inside the propagate member function of a propagator or the commit member function of a brancher.

Definition at line 52 of file macros.hpp.

## GECODE_ME_CHECK_MODIFIED

#define GECODE_ME_CHECK_MODIFIED | ( |  | modified,
|  |  | me )

Value:
do { \
::Gecode::ModEvent __me__ ## __LINE__ = (me); \
if (::Gecode::me_failed(__me__ ## __LINE__)) \
return ::Gecode::ES_FAILED; \
modified |= ::Gecode::me_modified(__me__ ## __LINE__); \
} while (0)
Gecode::me_modified
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition modevent.hpp:59
Gecode::ModEvent
int ModEvent
Type for modification events.
Definition core.hpp:62

Check whether me is failed or modified, and forward failure.

To be used inside the propagate member function of a propagator or the commit member function of a brancher.

Definition at line 64 of file macros.hpp.

## GECODE_ME_FAIL

#define GECODE_ME_FAIL | ( |  | me | ) |

Value:
do { \
if (::Gecode::me_failed(me)) { \
(home).fail(); \
return; \
}} while (0)

Check whether modification event me is failed, and fail space home.

To be used inside post functions.

Definition at line 77 of file macros.hpp.

## GECODE_ES_CHECK

#define GECODE_ES_CHECK | ( |  | es | ) |

Value:
do { \
::Gecode::ExecStatus __es__ ## __LINE__ = (es); \
if (__es__ ## __LINE__ < ::Gecode::ES_OK) \
return __es__ ## __LINE__; \
} while (0)
Gecode::ExecStatus
ExecStatus
Definition core.hpp:472
Gecode::ES_OK
@ ES_OK
Execution is okay.
Definition core.hpp:476

Check whether execution status es is failed or subsumed, and forward failure or subsumption.

Definition at line 91 of file macros.hpp.

## GECODE_ES_FAIL

#define GECODE_ES_FAIL | ( |  | es | ) |

Value:
do { \
::Gecode::ExecStatus __es__ ## __LINE__ = (es); \
assert(__es__ ## __LINE__ != ::Gecode::__ES_SUBSUMED); \
if (__es__ ## __LINE__ < ::Gecode::ES_OK) { \
(home).fail(); return; \
} \
} while (0)
Gecode::__ES_SUBSUMED
@ __ES_SUBSUMED
Internal: propagator is subsumed, do not use.
Definition core.hpp:473

Check whether execution status es is failed, and fail space home.

Definition at line 103 of file macros.hpp.

## GECODE_REWRITE

#define GECODE_REWRITE | ( |  | prop,
|  |  | post )

Value:
do { \
::Gecode::Propagator& __p__ ## __LINE__ = (prop); \
size_t __s__ ## __LINE__ = __p__ ## __LINE__.dispose(home); \
::Gecode::ExecStatus __es__ ## __LINE__ = (post); \
if (__es__ ## __LINE__ != ::Gecode::ES_OK) \
return ::Gecode::ES_FAILED; \
return home.ES_SUBSUMED_DISPOSED(__p__ ## __LINE__,__s__ ## __LINE__); \
} while (0)
Gecode::Actor::dispose
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition core.hpp:3252
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064

Rewrite propagator by executing post function.

Definition at line 116 of file macros.hpp.

## Typedef Documentation

## ModEventDelta

typedef int Gecode::ModEventDelta

Modification event deltas.

Modification event deltas are used by propagators. A propagator stores a modification event for each variable type. They can be accessed through a variable or a view from a given propagator. They can be constructed from a given modevent by a variable or view.

Definition at line 89 of file core.hpp.

## Enumeration Type Documentation

## ActorProperty

enum Gecode::ActorProperty

Actor properties.

Enumerator
AP_DISPOSE | Actor must always be disposed. Normally, a propagator will not be disposed if its home space is deleted. However, if an actor uses external resources, this property can be used to make sure that the actor will always be disposed.
AP_WEAKLY | Propagator is only weakly monotonic, that is, the propagator is only monotonic on assignments.
AP_VIEW_TRACE | A propagator is in fact implementing a view trace recorder.
AP_TRACE | A propagator is in fact implementing a trace recorder.

Definition at line 553 of file core.hpp.

## Function Documentation

## notice()

void Gecode::Space::notice | ( | Actor & | a,
|  | ActorProperty | p,
|  | bool | duplicate = false )

inline

Notice actor property.

Make the space notice that the actor a has the property p. Note that the same property can only be noticed once for an actor unless duplicate is true.

Definition at line 4059 of file core.hpp.

## ignore()

void Gecode::Space::ignore | ( | Actor & | a,
|  | ActorProperty | p,
|  | bool | duplicate = false )

inline

Ignore actor property.

Make the space ignore that the actor a has the property p. Note that a property must be ignored before an actor is disposed.

Definition at line 4074 of file core.hpp.

## fail()

void Gecode::Space::fail | ( | void |  | ) |

inline

Fail space.

This is useful for failing outside of actors. Never use inside a propagate or commit member function. The system will crash!

Definition at line 4030 of file core.hpp.

## failed()

bool Gecode::Space::failed | ( | void |  | ) | const

inline

Check whether space is failed.

Note that this does not perform propagation. This is useful for posting actors: only if a space is not yet failed, new actors are allowed to be created.

Definition at line 4044 of file core.hpp.

## stable()

bool Gecode::Space::stable | ( | void |  | ) | const

inline

Return if space is stable (at fixpoint or failed).

Definition at line 4053 of file core.hpp.

## me_failed()

bool Gecode::me_failed | ( | ModEvent | me | ) |

inline

Check whether modification event me is failed.

Definition at line 54 of file modevent.hpp.

## me_modified()

bool Gecode::me_modified | ( | ModEvent | me | ) |

inline

Check whether modification event me describes variable modification.

Definition at line 59 of file modevent.hpp.