Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default difficulty with permutations, please help!

Hi there

I have a two-dimensional array with 53 "rows" and 11 "columns". The array
values are either "1" or "0", indicating whether a person is working ("1")
or not-working ("0") during each of 11 hourly shifts in a day. The 53 rows
represent different ways in which a person could work. For instance,
concatenating one row of the array yields a string of "01111000000", which
indicates that a person is scheduled to work 4 consecutive hours (ie. the 4
"1"s) from the second hour of the day (ie. the position of the first "1", in
this case 9am). The 53 permutations are not complete: some have been
excluded since they don't represent a realistic work pattern. For example,
the string "01010101010" represents too uneven a pattern of work, while the
string "01000000010" presents too big a stretch between the person's two
shifts.

Two questions arise:

Firstly, how can I use a VBA procedure to generate all possible permutations
for two, three, four and more people? (Am I right to say that the total
number of permutations for n people is 53^n? If so, then the number of
permutations expands rapidly: 53; 2,809; 148,877; 7,890,481; and so on.
Nonetheless I need to write the different permutations out.)

Secondly, how do I generate only the distinct permutations? For instance, in
the case n=2, there are 2,809 (=53^2) permutations but there are only 1,481
(=53+52+51+50+...+1) distinct permutations. If I'm right, to get only the
distinct permutations, I add the values in each "row" of the original array
(ie. case n=1) to each row in the array for case n=k, omitting the case k=n.

Any suggestions would be gratefully appreciated!

Best regards
Loane


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default difficulty with permutations, please help!

If there are 53 feasible work patterns and you want to see how many unique
ways you can pair two of them (two workers), then

=combin(53,2) = 1378
this assumes that they can not work an identical shift. If they can, then
there would be 53 more combinations.

likewise for 3 people

=combin(53,3) = 23,426

4 =combin(53,4) = 292,825

and so forth.

You say you want to generate them, so where do you want to put the output
and in what format?

do you want 1,2 to indicate array item 1 (work pattern 1) paired with array
item 2 (work pattern 2) as an output.

Or do you want 11 cells times 2 rows written to a worksheet.

--
Regards,
Tom Ogilvy


"Loane Sharp" wrote in message
...
Hi there

I have a two-dimensional array with 53 "rows" and 11 "columns". The array
values are either "1" or "0", indicating whether a person is working ("1")
or not-working ("0") during each of 11 hourly shifts in a day. The 53 rows
represent different ways in which a person could work. For instance,
concatenating one row of the array yields a string of "01111000000", which
indicates that a person is scheduled to work 4 consecutive hours (ie. the

4
"1"s) from the second hour of the day (ie. the position of the first "1",

in
this case 9am). The 53 permutations are not complete: some have been
excluded since they don't represent a realistic work pattern. For example,
the string "01010101010" represents too uneven a pattern of work, while

the
string "01000000010" presents too big a stretch between the person's two
shifts.

Two questions arise:

Firstly, how can I use a VBA procedure to generate all possible

permutations
for two, three, four and more people? (Am I right to say that the total
number of permutations for n people is 53^n? If so, then the number of
permutations expands rapidly: 53; 2,809; 148,877; 7,890,481; and so on.
Nonetheless I need to write the different permutations out.)

Secondly, how do I generate only the distinct permutations? For instance,

in
the case n=2, there are 2,809 (=53^2) permutations but there are only

1,481
(=53+52+51+50+...+1) distinct permutations. If I'm right, to get only the
distinct permutations, I add the values in each "row" of the original

array
(ie. case n=1) to each row in the array for case n=k, omitting the case

k=n.

Any suggestions would be gratefully appreciated!

Best regards
Loane




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permutations art Excel Worksheet Functions 1 May 8th 09 05:07 PM
Permutations Dave Excel Discussion (Misc queries) 5 July 23rd 07 03:06 PM
permutations newyorkjoy Excel Discussion (Misc queries) 3 November 1st 05 08:20 PM
Permutations RedChequer Excel Worksheet Functions 9 September 26th 05 03:14 AM
Permutations RedChequer Excel Worksheet Functions 2 September 25th 05 04:05 AM


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"