This algorithm help group diferents elements with repeating tags into the minimum number of groups neceseary.
It can do this taking the tags with highest usage or the lowest.
The script takes an input file as input in which the first line indicates the number of tags in total and after that each line (index) belongs to the element (index) and it contains the tags folowed by the letter "G" (although it can be any letter).
ex.:
8
G1,G6
G1,G7
G1,G6,G8
G2,G7
G3,G6,G7
G3,G6,G8
G4,G7
G4,G8
To execute the script run the following command in you command line tool:
go run ./main.go assignments.txt max
go run ./main.go assignments.txt mix
The result should look something like this (max criterion):
It indicates the element number and the tag group it belongs to.
T1 -> G6
T2 -> G7
T3 -> G6
T4 -> G7
T5 -> G6
T6 -> G6
T7 -> G7
T8 -> G8