Commit ff7766fa authored by Christian Würdig's avatar Christian Würdig
Browse files

changed solve function, return now 0 or negative on number, cost are pointer param

[r8279]
parent b708863f
......@@ -184,7 +184,7 @@ void hungarian_free(hungarian_problem_t* p) {
/**
* Do the assignment.
*/
int hungarian_solve(hungarian_problem_t* p, int *assignment) {
int hungarian_solve(hungarian_problem_t* p, int *assignment, int *final_cost) {
int i, j, m, n, k, l, s, t, q, unmatched, cost;
int *col_mate;
int *row_mate;
......@@ -442,5 +442,7 @@ done:
xfree(unchosen_row);
xfree(col_mate);
return cost;
*final_cost = cost;
return 0;
}
......@@ -76,9 +76,10 @@ void hungarian_free(hungarian_problem_t *p);
* This method computes the optimal assignment.
* @param p The hungarian object
* @param assignment The final assignment
* @return The resulting cost or a negative value if matching is invalid.
* @param final_cost The final costs
* @return 0 on success, negative number otherwise
*/
int hungarian_solve(hungarian_problem_t *p, int *assignment);
int hungarian_solve(hungarian_problem_t *p, int *assignment, int *final_cost);
/**
* Print the cost matrix.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment