PDA

View Full Version : Permutation with a handicap



sasa
05-14-2008, 06:22 AM
Hi all,





The question

I have four items represented randomly in thirty-one rows (just a month). (see my example). I need to extract a sequence where the given items (a,b,c,d) must be sequenced the the best way possible for that case in an equal numeric distribution and with the maximum equidistance one from another.
For example a,b,c,d,a,b,c,d,a,b,c,d, etc is good (not repeated items and equidistant items)
Aabbcdaabbcc, is not good, (repeated and not equidistant items)
I have a routine able to obtain a good permutation of the items but the difficulty is when, like in the example ( I have a bottleneck in some rows (4,10,25), there only two items or worse just one.. Considered this bottleneck, is it possible to find a routine to obtain the best result possible in that situation ?



I would appreciate any kinds of assistance.



sasa

Bob Phillips
05-14-2008, 07:53 AM
Is it me or is the standard of questions dropping through the floor. I have a rough idea of what is being asked here, but a very rough idea at that. The question doesn't explain fully, the workbook is no extra help at all, no before and after examples, just a series of letters, and the routine referred to isn't even in the example workbook.

Hang on, I have to fetch my crystal ball.

sasa
05-14-2008, 11:58 AM
Well, I see ?? it is difficult to explain my problem both because of my English and my question is not simple. I will try to express better, using a short and simplified example.
We have four names Tom, Bill, Melanie, Mike and each name is in a cell of the same row. A1=Tom, B1=Bill, C1= Melanie, D1=Mike. The same names can be found in the cells below not necessarily in the same sequence (for example a2= Bill, b2= Tom, c2= Mike, d2= Melanie, in addition they cannot be present necessarily all together.( For example a3= Melanie b3=Mike c3= empty d3= empty and so on).
Now if you look at my second example in column H you can see all the possible permutation of the four names, but in this case for example what I need are only those that end with Tom and have in the position before last Melanie or Mike.
Practically in this case my bottleneck are the last two rows.
Now this example is just one unity of four rows repeated along the thirty-one days of a month so I ask if is it possible to obtain a final result as a sequence of quatrains where the four names are in the better way possible four by four uniformly distribuited.

sasa

sasa
05-14-2008, 10:58 PM
May be my practical need can better explain what I mean. The four names are four workers and every day the are not necessarily present at work. So what I need is the possibility to obtain a sequence where considered that some days are present only one or two workers I can equally distribuite their work shift in the month. I need to alternate them in the best way possible. Infact if they are all avalable every day I can easy choice one among of the four and alternate them every day, but if I have some day only one or two avalable I am forced to select these, so in the other days I'd like to select the others to obtain a correct distribution of the work shifts.
I think that select the quatrain where I have a limited choice of the workers, I need a routine able to find all the other quatrains that better combine with this one.

sasa
05-16-2008, 11:47 PM
In other words I am wondering if is it possible to arrange a macro that can give any permutation of some items while leaving other items fixed in their positions.

sasa

sasa
05-21-2008, 03:18 AM
Snoopy was lost and abandoned on the sidewalk for many days.
:(