Gecode::Brancher Class Referenceabstract
Functionality by programming task » Programming actors

Base-class for branchers. More...

`#include <core.hpp>`

## Protected Member Functions

| Brancher (Home home)
| Constructor for creation.
| Brancher (Space &home, Brancher &b)
| Constructor for cloning b.

## Brancher

virtual bool | status (const Space &home) const =0
| Check status of brancher, return true if alternatives left.
virtual const Choice * | choice (Space &home)=0
| Return choice.
virtual const Choice * | choice (const Space &home, Archive &e)=0
| Return choice from e.
virtual ExecStatus | commit (Space &home, const Choice &c, unsigned int a)=0
| Commit for choice c and alternative a.
virtual NGL * | ngl (Space &home, const Choice &c, unsigned int a) const
| Create no-good literal for choice c and alternative a.
virtual void | print (const Space &home, const Choice &c, unsigned int a, std::ostream &o) const
| Print branch for choice c and alternative a.

## Id and group support

unsigned int | id (void) const
| Return brancher id.
BrancherGroup | group (void) const
| Return group brancher belongs to.
void | group (BrancherGroup g)
| Add brancher to group g.

## Additional Inherited Members

Public Member Functions inherited from Gecode::Actor
virtual Actor * | copy (Space &home)=0
| Create copy.
virtual size_t | dispose (Space &home)
| Delete actor and return its size.
virtual | ~Actor (void)
| To avoid warnings.
static void * | operator new (size_t s, Space &home)
| Allocate memory from space.
static void | operator delete (void *p, Space &home)
| No-op for exceptions.
static void * | operator new (size_t s)
| Not used.
static void | operator delete (void *p)
| Not used.

## Detailed Description

Base-class for branchers.

Note that branchers cannot be created inside a propagator (no idea why one would like to do that anyway). If you do that the system will explode in a truly interesting way.

Definition at line 1442 of file core.hpp.

## Constructor & Destructor Documentation

## Brancher() [1/2]

Gecode::Brancher::Brancher | ( | Home | home | ) |

inline protected

Constructor for creation.

Definition at line 3605 of file core.hpp.

## Brancher() [2/2]

Gecode::Brancher::Brancher | ( | Space & | home,
|  | Brancher & | b )

inline protected

Constructor for cloning b.

Definition at line 3622 of file core.hpp.

## Member Function Documentation

## status()

virtual bool Gecode::Brancher::status | ( | const Space & | home | ) | const

pure virtual

Check status of brancher, return true if alternatives left.

This method is called when Space::status is called, it determines whether to continue branching with this brancher or move on to the (possibly) next brancher.

Implemented in CDBF, Gecode::FlatZinc::AuxVarBrancher, Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Gist::StopBrancher, Gecode::Kernel::FunctionBranch, Gecode::ViewBrancher< View, Filter, n >, Gecode::ViewBrancher< IntView, Filter, n >, QueenArmies::QueenBranch, Radiotherapy::NestedSearch, SteelMill::SteelMillBranch, and Warnsdorff.

## choice() [1/2]

virtual const Choice * Gecode::Brancher::choice | ( | Space & | home | ) |

pure virtual

Return choice.

Note that this method relies on the fact that it is called immediately after a previous call to status. Moreover, the member function can only be called once.

Implemented in CDBF, Gecode::FlatZinc::AuxVarBrancher, Gecode::FlatZinc::IntBoolBrancher< Merit >, Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Gist::StopBrancher, Gecode::Int::Branch::ViewValuesBrancher< n, min, Filter, Print >, Gecode::Int::LDSB::LDSBBrancher< View, n, Val, a, Filter, Print >, Gecode::Kernel::FunctionBranch, Gecode::Set::LDSB::LDSBSetBrancher< View, n, Val, a, Filter, Print >, Gecode::ViewValBrancher< View, n, Val, a, Filter, Print >, QueenArmies::QueenBranch, Radiotherapy::NestedSearch, SteelMill::SteelMillBranch, and Warnsdorff.

## choice() [2/2]

virtual const Choice * Gecode::Brancher::choice | ( | const Space & | home,
|  | Archive & | e )

pure virtual

Return choice from e.

Implemented in CDBF, Gecode::FlatZinc::AuxVarBrancher, Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Gist::StopBrancher, Gecode::Int::Branch::ViewValuesBrancher< n, min, Filter, Print >, Gecode::Int::LDSB::LDSBBrancher< View, n, Val, a, Filter, Print >, Gecode::Kernel::FunctionBranch, Gecode::ViewValBrancher< View, n, Val, a, Filter, Print >, QueenArmies::QueenBranch, Radiotherapy::NestedSearch, SteelMill::SteelMillBranch, and Warnsdorff.

## commit()

virtual ExecStatus Gecode::Brancher::commit | ( | Space & | home,
|  | const Choice & | c,
|  | unsigned int | a )

pure virtual

Commit for choice c and alternative a.

The current brancher in the space home performs a commit from the information provided by the choice c and the alternative a.

Implemented in CDBF, Gecode::FlatZinc::AuxVarBrancher, Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Gist::StopBrancher, Gecode::Int::Branch::ViewValuesBrancher< n, min, Filter, Print >, Gecode::Int::LDSB::LDSBBrancher< View, n, Val, a, Filter, Print >, Gecode::Kernel::FunctionBranch, Gecode::Set::LDSB::LDSBSetBrancher< View, n, Val, a, Filter, Print >, Gecode::ViewValBrancher< View, n, Val, a, Filter, Print >, QueenArmies::QueenBranch, Radiotherapy::NestedSearch, SteelMill::SteelMillBranch, and Warnsdorff.

## ngl()

NGL * Gecode::Brancher::ngl | ( | Space & | home,
|  | const Choice & | c,
|  | unsigned int | a ) const

virtual

Create no-good literal for choice c and alternative a.

The current brancher in the space home creates a no-good literal from the information provided by the choice c and the alternative a. The brancher has the following options:

- it returns NULL for all alternatives a. This means that the brancher does not support no-good literals (default).
- it returns NULL for the last alternative a. This means that this alternative is equivalent to the negation of the disjunction of all other alternatives.

Reimplemented in Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Int::Branch::ViewValuesBrancher< n, min, Filter, Print >, and Gecode::ViewValBrancher< View, n, Val, a, Filter, Print >.

Definition at line 92 of file core.cpp.

## print()

void Gecode::Brancher::print | ( | const Space & | home,
|  | const Choice & | c,
|  | unsigned int | a,
|  | std::ostream & | o ) const

virtual

Print branch for choice c and alternative a.

Prints an explanation of the alternative a of choice c on the stream o.

Reimplemented in CDBF, Gecode::FlatZinc::AuxVarBrancher, Gecode::FlatZinc::IntBoolBrancherBase, Gecode::Gist::StopBrancher, Gecode::Int::Branch::ViewValuesBrancher< n, min, Filter, Print >, Gecode::Kernel::FunctionBranch, Gecode::ViewValBrancher< View, n, Val, a, Filter, Print >, QueenArmies::QueenBranch, Radiotherapy::NestedSearch, SteelMill::SteelMillBranch, and Warnsdorff.

Definition at line 97 of file core.cpp.

## id()

unsigned int Gecode::Brancher::id | ( | void |  | ) | const

inline

Return brancher id.

Definition at line 3629 of file core.hpp.

## group() [1/2]

BrancherGroup Gecode::Brancher::group | ( | void |  | ) | const

inline

Return group brancher belongs to.

Definition at line 3634 of file core.hpp.

## group() [2/2]

void Gecode::Brancher::group | ( | BrancherGroup | g | ) |

inline

Add brancher to group g.

Definition at line 3639 of file core.hpp.

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

- gecode/kernel/core.hpp
- gecode/kernel/core.cpp