Class ExactCover

Class Documentation

class ExactCover

the exact cover problem on dancing links

Public Functions

ExactCover(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)

a new option, its index

Pre:

items distinct, in [ 0 , primary + secondary ), one primary

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

calls visit( options ) on each solution, the indices of its options, until it returns true; the number of solutions visited

Post:

each solution is an exact cover (an audit)

inline long updates(void) const

the nodes updated by the last solve(), Knuth’s measure of the work