Branching
Functionality by programming task » Programming models » Using integer set variables and constraints

## Topics

| Selecting set variables
| Value selection for set variables
| Assigning set variables

## Classes

class | Gecode::SetAFC
| Recording AFC information for set variables. More...
class | Gecode::SetAction
| Recording actions for set variables. More...
class | Gecode::SetCHB
| Recording CHB for set variables. More...
class | Gecode::SetVarBranch
| Which variable to select for branching. More...
class | Gecode::SetValBranch
| Which values to select for branching first. More...
class | Gecode::SetAssign
| Which value to select for assignment. More...

## Typedefs

typedef std::function< bool(const Space &home, SetVar x, int i)> | Gecode::SetBranchFilter
| Branch filter function type for set variables.
typedef std::function< double(const Space &home, SetVar x, int i)> | Gecode::SetBranchMerit
| Branch merit function type for set variables.
typedef std::function< int(const Space &home, SetVar x, int i)> | Gecode::SetBranchVal
| Branch value function type for set variables.
typedef std::function< void(Space &home, unsigned int a, SetVar x, int i, int n)> | Gecode::SetBranchCommit
| Branch commit function type for set variables.

## Functions

void | Gecode::branch (Home home, const SetVarArgs &x, SetVarBranch vars, SetValBranch vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Branch over x with variable selection vars and value selection vals.
void | Gecode::branch (Home home, const SetVarArgs &x, TieBreak< SetVarBranch > vars, SetValBranch vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Branch over x with tie-breaking variable selection vars and value selection vals.
void | Gecode::branch (Home home, SetVar x, SetValBranch vals, SetVarValPrint vvp=nullptr)
| Branch over x with value selection vals.
void | Gecode::assign (Home home, const SetVarArgs &x, SetVarBranch vars, SetAssign vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Assign all x with variable selection vars and value selection vals.
void | Gecode::assign (Home home, const SetVarArgs &x, TieBreak< SetVarBranch > vars, SetAssign vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Assign all x with tie-breaking variable selection vars and value selection vals.
void | Gecode::assign (Home home, SetVar x, SetAssign vals, SetVarValPrint vvp=nullptr)
| Assign x with value selection vals.
void | Gecode::branch (Home home, const SetVarArgs &x, SetValBranch vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Branch over x with value selection vals.
void | Gecode::assign (Home home, const SetVarArgs &x, SetAssign vals, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Assign all x with value selection vals.
void | Gecode::branch (Home home, const SetVarArgs &x, SetVarBranch vars, SetValBranch vals, const Symmetries &syms, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Branch over x with variable selection vars and value selection vals with symmetry breaking.
void | Gecode::branch (Home home, const SetVarArgs &x, TieBreak< SetVarBranch > vars, SetValBranch vals, const Symmetries &syms, SetBranchFilter bf=nullptr, SetVarValPrint vvp=nullptr)
| Branch over x with tie-breaking variable selection vars and value selection vals with symmetry breaking.

## Detailed Description

## Typedef Documentation

## SetBranchFilter

typedef std::function<bool(const Space& home, SetVar x, int i)> Gecode::SetBranchFilter

Branch filter function type for set variables.

The variable x is considered for selection and i refers to the variable's position in the original array passed to the brancher.

Definition at line 1083 of file set.hh.

## SetBranchMerit

typedef std::function<double(const Space& home, SetVar x, int i)> Gecode::SetBranchMerit

Branch merit function type for set variables.

The function must return a merit value for the variable x. The value i refers to the variable's position in the original array passed to the brancher.

Definition at line 1095 of file set.hh.

## SetBranchVal

typedef std::function<int(const Space& home, SetVar x, int i)> Gecode::SetBranchVal

Branch value function type for set variables.

Returns a value for the variable x that is to be used in the corresponding branch commit function. The integer i refers to the variable's position in the original array passed to the brancher.

Definition at line 1108 of file set.hh.

## SetBranchCommit

typedef std::function<void(Space& home, unsigned int a, SetVar x, int i, int n)> Gecode::SetBranchCommit

Branch commit function type for set variables.

The function must post a constraint on the variable x which corresponds to the alternative a. The integer i refers to the variable's position in the original array passed to the brancher. The value n is the value computed by the corresponding branch value function.

Definition at line 1123 of file set.hh.

## Function Documentation

## branch() [1/6]

void Gecode::branch | ( | Home | home,
|  | const SetVarArgs & | x,
|  | SetVarBranch | vars,
|  | SetValBranch | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Branch over x with variable selection vars and value selection vals.

Definition at line 39 of file branch.cpp.

## branch() [2/6]

void Gecode::branch | ( | Home | home,
|  | const SetVarArgs & | x,
|  | TieBreak< SetVarBranch > | vars,
|  | SetValBranch | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Branch over x with tie-breaking variable selection vars and value selection vals.

Definition at line 55 of file branch.cpp.

## branch() [3/6]

void Gecode::branch | ( | Home | home,
|  | SetVar | x,
|  | SetValBranch | vals,
|  | SetVarValPrint | vvp = nullptr )

Branch over x with value selection vals.

Definition at line 101 of file branch.cpp.

## assign() [1/4]

void Gecode::assign | ( | Home | home,
|  | const SetVarArgs & | x,
|  | SetVarBranch | vars,
|  | SetAssign | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Assign all x with variable selection vars and value selection vals.

Definition at line 108 of file branch.cpp.

## assign() [2/4]

void Gecode::assign | ( | Home | home,
|  | const SetVarArgs & | x,
|  | TieBreak< SetVarBranch > | vars,
|  | SetAssign | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Assign all x with tie-breaking variable selection vars and value selection vals.

Definition at line 123 of file branch.cpp.

## assign() [3/4]

void Gecode::assign | ( | Home | home,
|  | SetVar | x,
|  | SetAssign | vals,
|  | SetVarValPrint | vvp = nullptr )

Assign x with value selection vals.

Definition at line 169 of file branch.cpp.

## branch() [4/6]

void Gecode::branch | ( | Home | home,
|  | const SetVarArgs & | x,
|  | SetValBranch | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

inline

Branch over x with value selection vals.

Definition at line 37 of file branch.hpp.

## assign() [4/4]

void Gecode::assign | ( | Home | home,
|  | const SetVarArgs & | x,
|  | SetAssign | vals,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

inline

Assign all x with value selection vals.

Definition at line 43 of file branch.hpp.

## branch() [5/6]

void Gecode::branch | ( | Home | home,
|  | const SetVarArgs & | x,
|  | SetVarBranch | vars,
|  | SetValBranch | vals,
|  | const Symmetries & | syms,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Branch over x with variable selection vars and value selection vals with symmetry breaking.

Definition at line 138 of file ldsb.cpp.

## branch() [6/6]

void Gecode::branch | ( | Home | home,
|  | const SetVarArgs & | x,
|  | TieBreak< SetVarBranch > | vars,
|  | SetValBranch | vals,
|  | const Symmetries & | syms,
|  | SetBranchFilter | bf = nullptr,
|  | SetVarValPrint | vvp = nullptr )

Branch over x with tie-breaking variable selection vars and value selection vals with symmetry breaking.

Definition at line 171 of file ldsb.cpp.