Programming search engines
Functionality by programming task

## Enumerations

enum | Gecode::SpaceStatus { Gecode::SS_FAILED , Gecode::SS_SOLVED , Gecode::SS_BRANCH }
| Space status More...

## update, and dispose variables

SpaceStatus | Gecode::Space::status (StatusStatistics &stat=unused_status)
| Query space status.
const Choice * | Gecode::Space::choice (void)
| Create new choice for current brancher.
const Choice * | Gecode::Space::choice (Archive &e) const
| Create new choice from e.
Space * | Gecode::Space::clone (CloneStatistics &stat=unused_clone) const
| Clone space.
void | Gecode::Space::commit (const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
| Commit choice c for alternative a.
void | Gecode::Space::trycommit (const Choice &c, unsigned int a, CommitStatistics &stat=unused_commit)
| If possible, commit choice c for alternative a.
NGL * | Gecode::Space::ngl (const Choice &c, unsigned int a)
| Create no-good literal for choice c and alternative a.
void | Gecode::Space::print (const Choice &c, unsigned int a, std::ostream &o) const
| Print branch for choice c and alternative a.

## Detailed Description

## Enumeration Type Documentation

## SpaceStatus

enum Gecode::SpaceStatus

Space status

Enumerator
SS_FAILED | Space is failed
SS_SOLVED | Space is solved (no brancher left)
SS_BRANCH | Space must be branched (at least one brancher left)

Definition at line 1681 of file core.hpp.

## Function Documentation

## status()

SpaceStatus Gecode::Space::status | ( | StatusStatistics & | stat = unused_status | ) |

Query space status.

Propagates the space until fixpoint or failure; updates the statistics information stat; and:

- if the space is failed, SpaceStatus::SS_FAILED is returned.
- if the space is not failed but the space has no brancher left, SpaceStatus::SS_SOLVED is returned.
- otherwise, SpaceStatus::SS_BRANCH is returned.

Definition at line 252 of file core.cpp.

## choice() [1/2]

const Choice * Gecode::Space::choice | ( | void |  | ) |

Create new choice for current brancher.

This member function can only be called after the member function Space::status on the same space has been called and in between no non-const member function has been called on this space.

Moreover, the member function can only be called at most once (otherwise, it might generate conflicting choices).

Note that the above invariant only pertains to calls of member functions of the same space. If the invariant is violated, the system is likely to crash (hopefully it does). In particular, if applied to a space with no current brancher, the system will crash.

After a new choice has been created, no older choices can be used on the space.

If the status() member function has returned that the space has no more branchers (that is, the result was either SS_FAILED or SS_SOLVED), a call to choice() will return NULL and purge all remaining branchers inside the space. This is interesting for the case SS_SOLVED, where the call to choice can serve as garbage collection.

Throws an exception of type SpaceNotStable when applied to a not yet stable space.

Definition at line 537 of file core.cpp.

## choice() [2/2]

const Choice * Gecode::Space::choice | ( | Archive & | e | ) | const

Create new choice from e.

The archived representation e must have been created from a Choice that is compatible with this space (i.e., created from the same model).

Definition at line 570 of file core.cpp.

## clone()

Space * Gecode::Space::clone | ( | CloneStatistics & | stat = unused_clone | ) | const

inline

Clone space.

Assumes that the space is stable and not failed. If the space is failed, an exception of type SpaceFailed is thrown. If the space is not stable, an exception of SpaceNotStable is thrown.

Otherwise, a clone of the space is returned and the statistics information stat is updated.

Throws an exception of type SpaceNotCloned when the copy constructor of the Space class is not invoked during cloning.

Definition at line 3224 of file core.hpp.

## commit()

void Gecode::Space::commit | ( | const Choice & | c,
|  | unsigned int | a,
|  | CommitStatistics & | stat = unused_commit )

inline

Commit choice c for alternative a.

The current brancher in the space performs a commit from the information provided by the choice c and the alternative a. The statistics information stat is updated.

Note that no propagation is perfomed (to support path recomputation), in order to perform propagation the member function status must be used.

Committing with choices must be carried out in the same order as the choices have been obtained by the member function Space::choice().

It is perfectly okay to add constraints interleaved with choices (provided they are in the right order). However, if propagation is performed by calling the member function status and then new choices are computed, these choices are different.

Only choices can be used that are up-to-date in the following sense: if a new choice is created (via the choice member function), no older choices can be used.

Committing throws the following exceptions:

- SpaceNoBrancher, if the space has no current brancher (it is already solved).
- SpaceIllegalAlternative, if a is not smaller than the number of alternatives supported by the choice c.

Definition at line 3232 of file core.hpp.

## trycommit()

void Gecode::Space::trycommit | ( | const Choice & | c,
|  | unsigned int | a,
|  | CommitStatistics & | stat = unused_commit )

inline

If possible, commit choice c for alternative a.

The current brancher in the space performs a commit from the information provided by the choice c and the alternative a. The statistics information stat is updated.

Note that no propagation is perfomed (to support path recomputation), in order to perform propagation the member function status must be used.

Committing with choices must be carried out in the same order as the choices have been obtained by the member function Space::choice().

It is perfectly okay to add constraints interleaved with choices (provided they are in the right order). However, if propagation is performed by calling the member function status and then new choices are computed, these choices are different.

Only choices can be used that are up-to-date in the following sense: if a new choice is created (via the choice member function), no older choices can be used.

Committing throws the following exceptions:

- SpaceIllegalAlternative, if a is not smaller than the number of alternatives supported by the choice c.

Definition at line 3237 of file core.hpp.

## ngl()

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

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.
- 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.

It throws the following exceptions:

- SpaceIllegalAlternative, if a is not smaller than the number of alternatives supported by the choice c.

Definition at line 641 of file core.cpp.

## print()

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

Print branch for choice c and alternative a.

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

Print throws the following exceptions:

- SpaceNoBrancher, if the space has no current brancher (it is already solved).
- SpaceIllegalAlternative, if a is not smaller than the number of alternatives supported by the choice c.

Definition at line 655 of file core.cpp.