How to find the best combination of numbers in order to get the maximum sum?

I need a solution that does the following:
From the table below, Select a number from each row and column, that are the best to sum together in order to get the maximum sum. There has to be a pick on each row and column, but picks can't be on the same row or column.
I'm open minded about the output or the method. I'm more concerned about the process here.
Thanks for any solution or advice in advance.

TABLE

14  14  12  10  9   3
0   0   0   0   0   0
14  7   16  12  10  7
8   2   3   0   0   0
10  8   9   4   3   3
12  5   5   5   0   0

DESIRED RESULT: (for example)

    14               
                    0
        16           
                0    
            4        
12                   

Upvotes: 2

Views: 130

Answers (1)

SaiBot
SaiBot

Reputation: 3745

This is an assignment problem. You can use the Hungarian Algorithm to solve it.

Check this GitHub for an implementation in Java Script.

Upvotes: 1

Related Questions