Class FastExactCover

Nested Relationships

Nested Types

Class Documentation

class FastExactCover

the exact cover with colors on sparse sets (dancing cells)

Public Functions

FastExactCover(int primary, int secondary = 0)

the items 0 , … , primary - 1 primary, the next secondary ones

Pre:

primary >= 0 and secondary >= 0

int addOption(const std::vector<int> &items, const std::vector<int> &colors = {})

a new option, its index; colors[ k ] > 0 is the color of items[ k ], 0 or no colors none

Pre:

items distinct, in [ 0 , primary + secondary ), one primary; colors empty or of the size of items, not negative, 0 on the primary items

template<class F>
long solve(F &&visit)

calls visit( options ) on each solution, the indices of its options in the order chosen, until it returns true (if it returns bool); the number visited

Post:

each solution is a solution (an audit)

inline long updates(void) const

the options taken out of a set by the last solve()

inline long nodes(void) const

the nodes of the tree of the search of the last solve()