A problem of combinatorial

Sehnsucht

Member
Joined
Oct 20, 2008
Messages
12
Location
France
Programming Experience
1-3
Hello,
For a project of Statistical O.R. (Operational research), I have to make several things:

  • First of all, list the set A all the combinations of k elements in a set of n elements (k < = n)
  • Then, for every combinations Have to list the set Bi all the permutations of j possible values.
  • Finally for every Bil verify if they corresponds to the constraints (to define according to the research).

From a mathematical point of view, the set A contains n! / (k! (n - k)!) and every set Bi contains j! Elements; let be a total of j! (n! / (k! (n - k)!)).

Example:
A bus of 80 places possesses 15 passengers and every passenger in a specific peculiarity among 10 categories, count all the possibilities of placement of these passengers in the bus.
The total number of combinations is thus 10! (80! / (15! (80 - 15)!)) = 5 472 782 816 133 670 000 000

I would want your opinion to proceed how, I have to begin by calculating the set A in its entirety or seeing to it that as this one fills to create the sets Bi in which I have "access"; or to approach quite other approach?

Furthermore I would like a help on some points where I do not how see proceeding:

  • Manage the saving of the process, the sort to be able to resume it later at the stage where it had stopped (as for the moment I manage all this by means of récursive I do not manage to save correctly my state)
  • Allow the display of the progress by means of ProgressBar, the problem being large numbers to be managed and which format to use to store them knowing that it has to slow down the least possible the rest (thus Decimal to avoid for example)
  • Any runway useful for the optimization of as well in term of speed of execution, that in term of memory (of the process in him even on one hand and the format of storage of the valid results on the other hand, knowing that any data base is excluded (at least for the moment))

Thank you in advance in all, for the worn attention on this message as well as on any brought help!

NB This was translated from french, so it may be inaccurate translation
 
hard to understand because of inadequate french translation...

Do you understand how to program that equation "10! (80! / (15! (80 - 15)!)) " in VB.NET? If so great because I don't!

Progress Bar: Put a counter after each step of the equation. Then use that as a reference for the progress bar.

Saving Memory: I'm not sure....

Saving Progress: After each step store the result in a textfile that way if the program ends you can retrieve results again. You will also need to store what point in the calculation you were at. That way you know where to continue from.

I hope that helps.

(I tried to keep words simple for the inevitable translation of the text ;) )
 
First, sorry for the awfull translation

Do you understand how to program that equation "10! (80! / (15! (80 - 15)!)) " in VB.NET? If so great because I don't!
This point isn't a problem for me.

Progress Bar: Put a counter after each step of the equation. Then use that as a reference for the progress bar.
Impossible to do this way for this example the ProgressBar.Maximum will have to be 5 472 782 816 133 670 000 000 that is far superior from Integer.Max

Saving Progress: After each step store the result in a textfile that way if the program ends you can retrieve results again. You will also need to store what point in the calculation you were at. That way you know where to continue from.
I'm agree with this point, but the calculation is done using recursives, then how to store the "stack" of the different level of the recursive (it's deepth) ?

But thank you for the response and don't hesitate to give advice again.
 
Sehnsucht said:
Impossible to do this way for this example the ProgressBar.Maximum will have to be 5 472 782 816 133 670 000 000 that is far superior from Integer.Max
Maximum can remain at default 100. Do you know how to calculate percentage?
 
Off course, I can put a counter on the generation's step and then calculate to get a percentage value but it will make more operations...
 
Yes, but you will not have problem with Integer max value. In some cases where max value changes this also means less drawing operations, which are usually slower than the calculation.
 
Back
Top