#include "munkres.h" int main(int argc, char **arv){ int costs[3][3] = { {1, 2, 3}, {2, 4, 6}, {3, 6, 9} }; printf("> testing the munkres assignment algorithm\n"); //initialise Munkres munk; if (!munk.init_matrix(3,3,(int *)&costs)){ printf("> error: init_matrix call failed\n"); exit(1); } //show data printf("> input array: worker n -> costs for job m\n\n"); printf(" job0 job1 job2\n"); for(int w=0; w<3; w++){ printf("worker %d -> %6d %6d %6d\n",w,costs[w][0],costs[w][1],costs[w][2]); } printf("\n> calling munk resolver\n"); munk.run(); printf("> done. results:\n\n"); for(int col=0; col<3; col++){ int row = munk.get_row_match_for_col(col); printf("worker %d is assigned to job %d\n",col,row); } printf("\n"); }