Template Class Munkres

Class Documentation

template<typename T>
class brille::assignment::Munkres

A single-case implementation of the Munkres’ Assignment Algorithm.

See, e.g., http://csclab.murraystate.edu/~bob.pilgrim/445/munkres.html

Public Functions

Munkres(size_t n, std::vector<T> cmat = std::vector<T>())

The Munkres intializer

If the cost matrix is provided the assignment algorithm is run automatically.

Parameters
  • n: the dimensionality of the system, which must be square

  • cmat: [optional] the cost matrix

void reset()
bool run_assignment()

Start the assignment algorithm.

Resets the mask matrix, cover vectors, stored indices, step, and finished state before attempting to run the assignment algorithm.

Return

A flag to indicate if the algorithm finished successfully

std::vector<T> &get_cost(void)

Get a mutable reference to the cost matrix, useful for filling.

const std::vector<T> &get_cost(void) const

Get an immutable reference to the cost matrix.

bool get_assignment(size_t *out)

After the assignment algorithm has run, use get_assignment to retrieve the result

Return

The returned flag is true if the assignment was made.

Parameters
  • [out] out: A size_t pointer at which the N task assignments will be stored

std::string to_string() const