Please somebody, need help on weightmatching/minimizing problem!

*To*: mathgroup at smc.vnet.net*Subject*: [mg13766] Please somebody, need help on weightmatching/minimizing problem!*From*: kuai0401 at wineasy.se (leif huntus)*Date*: Mon, 24 Aug 1998 05:07:16 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Given N(usually 6=< N <=40) assembled parts(P=[P1,P2,...,PN]) each consisting of K(usually 4=< K <=6) components(C=[C1,C2,...,CK]) thus a total of N*K components. Initially each component are weighed in and given an index i(i=1,2,...,N). P1=iC1+iC2+...+iCK, and i=1 for C1,C2,...,CK P2=iC1+iC2+...+iCK, and i=2 for C1,C2,...,CK .. .. .. PN=iC1+iC2+...+iCK, and i=N for C1,C2,...,CK *) the indexes not to be included in summs. The problem is how do I rearrange the indexes for each component so that the weightdifferens(WD) between Max{P} and Min{P} is minimized? Can I cycle through every possible combination[1], If so how would that be done for example in C ,Matlab or Mathematica, algorithm? [1] How many are there if only column rearrangement are allowed, and I have a nxm matrix A? How would an algorithm look like that write out all posible rearrangement's of the matrix A, maybe mathematica has some built in functions that makes it easy? Example: How rearrange columns(now at initial state) C1,C2,C3 and C4 so that WD is minimized? P C1 C2 C3 C4 WD= 0.026(P11-P1) - ----- ----- ----- ----- P1 7.628 + 1.491 + 3.532 + 3.542 minimized WD= ? P2 7.640 + 1.491 + 3.533 + 3.541 P3 7.642 + 1.491 + 3.531 + 3.541 P4 7.644 + 1.492 + 3.534 + 3.541 P5 7.646 + 1.494 + 3.534 + 3.541 P6 7.647 + 1.493 + 3.532 + 3.541 P7 7.649 + 1.493 + 3.533 + 3.541 P8 7.643 + 1.493 + 3.532 + 3.541 P9 7.640 + 1.495 + 3.531 + 3.540 P10 7.645 + 1.491 + 3.532 + 3.542 P11 7.646 + 1.491 + 3.542 + 3.540 P12 7.640 + 1.493 + 3.530 + 3.543 Any help appreciated, please reply to Leif Huntus <kuai0401 at wineasy.se>