JAVA - multirow array

Posted by user51447 on Programmers See other posts from Programmers or by user51447
Published on 2012-04-07T17:41:50Z Indexed on 2012/04/07 17:45 UTC
Read the original article Hit count: 259

Filed under:

Here is my situation: a company has x number of employees and x number of machines. When someone is sick, the program have to give the best possible solution of people on the machines. But the employees can't work on every machine. I need a code for making little groups of possible solutions.

this is a static example private int[][] arrayCompetenties={{0,0,1,0,1},{1,0,1,0,1},{1,1,0,0,1},{1,1,1,1,1},{0,0,0,0,1}}; => row is for the people and columns are for machines

m1  m2  m3  m4  m5  m6  m7

p1 1 1
p2 1 1 1 1
p3 1 1 1 p4 1 1 1
p5 1 1 1 1 p6 1 1 1 1 p7 1 1 1 1 1 1

my question => with what code do i connect all the people to machine in groups (all the posibilities)

like:

p1 -> m1 , p2->m2 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6

p1 -> m1 , p2->m3 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6

p1 -> m1 , p2->m4 , p3 -> m5 , p4->m4 , p5 -> m5 , p6->m6

p1 -> m1 , p2->m5 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6

p1 -> m1 , p2->m2 , p3 -> m3 , p4->m4 , p5 -> m5 , p6->m6

....

i need a loop buth how? =D

thanks!

© Programmers or respective owner

Related posts about java