Warnsdorff Class Reference

Custom brancher for knight's tours using Warnsdorff's rule. More...

## Classes

class | Choice
| Choice More...

## Public Member Functions

virtual bool | status (const Space &) const
| Check status of brancher, return true if alternatives left.
virtual Gecode::Choice * | choice (Space &)
| Return choice.
virtual Choice * | choice (const Space &, Archive &e)
| Return choice.
virtual ExecStatus | commit (Space &home, const Gecode::Choice &_c, unsigned int a)
| Perform commit for choice _c and alternative a.
virtual void | print (const Space &, const Gecode::Choice &_c, unsigned int a, std::ostream &o) const
| Print explanation.
virtual Actor * | copy (Space &home)
| Copy brancher.
virtual size_t | dispose (Space &)
| Delete brancher and return its size.
virtual NGL * | ngl (Space &home, const Choice &c, unsigned int a) const
| Create no-good literal for choice c and alternative a.
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.
virtual | ~Actor (void)
| To avoid warnings.

## Static Public Member Functions

static void | post (Home home, const IntVarArgs &x)
| Post brancher.
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.

## Protected Member Functions

| Warnsdorff (Home home, ViewArray< Int::IntView > &xv)
| Construct brancher.
| Warnsdorff (Space &home, Warnsdorff &b)
| Copy constructor.
Protected Member Functions inherited from Gecode::Brancher
| Brancher (Home home)
| Constructor for creation.
| Brancher (Space &home, Brancher &b)
| Constructor for cloning b.

## Protected Attributes

ViewArray< Int::IntView > | x
| Views of the brancher.
int | start
| Next variable to branch on.

## Detailed Description

Custom brancher for knight's tours using Warnsdorff's rule.

This class implements Warnsdorff's rule for finding knight's tours. The next position is choosen by taking the jump that minimizes the number of alternatives in the next step.

Definition at line 58 of file knights.cpp.

## Constructor & Destructor Documentation

## Warnsdorff() [1/2]

Warnsdorff::Warnsdorff | ( | Home | home,
|  | ViewArray< Int::IntView > & | xv )

inline protected

Construct brancher.

Definition at line 84 of file knights.cpp.

## Warnsdorff() [2/2]

Warnsdorff::Warnsdorff | ( | Space & | home,
|  | Warnsdorff & | b )

inline protected

Copy constructor.

Definition at line 87 of file knights.cpp.

## Member Function Documentation

## status()

virtual bool Warnsdorff::status | ( | const Space & |  | ) | const

inline virtual

Check status of brancher, return true if alternatives left.

Implements Gecode::Brancher.

Definition at line 93 of file knights.cpp.

## choice() [1/2]

virtual Gecode::Choice * Warnsdorff::choice | ( | Space & |  | ) |

inline virtual

Return choice.

Implements Gecode::Brancher.

Definition at line 104 of file knights.cpp.

## choice() [2/2]

virtual Choice * Warnsdorff::choice | ( | const Space & | ,
|  | Archive & | e )

inline virtual

Return choice.

Implements Gecode::Brancher.

Definition at line 120 of file knights.cpp.

## commit()

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

inline virtual

Perform commit for choice _c and alternative a.

Implements Gecode::Brancher.

Definition at line 126 of file knights.cpp.

## print()

virtual void Warnsdorff::print | ( | const Space & | ,
|  | const Gecode::Choice & | _c,
|  | unsigned int | a,
|  | std::ostream & | o ) const

inline virtual

Print explanation.

Reimplemented from Gecode::Brancher.

Definition at line 135 of file knights.cpp.

## copy()

virtual Actor * Warnsdorff::copy | ( | Space & | home | ) |

inline virtual

Copy brancher.

Implements Gecode::Actor.

Definition at line 144 of file knights.cpp.

## post()

void Warnsdorff::post | ( | Home | home,
|  | const IntVarArgs & | x )

inline static

Post brancher.

Definition at line 148 of file knights.cpp.

## dispose()

virtual size_t Warnsdorff::dispose | ( | Space & |  | ) |

inline virtual

Delete brancher and return its size.

Reimplemented from Gecode::Actor.

Definition at line 153 of file knights.cpp.

## Member Data Documentation

## x

ViewArray<Int::IntView> Warnsdorff::x

protected

Views of the brancher.

Definition at line 61 of file knights.cpp.

## start

int Warnsdorff::start

mutable protected

Next variable to branch on.

Definition at line 63 of file knights.cpp.

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

- examples/knights.cpp