Page 1 of 1

How to try each possibilities?

Posted: Fri Sep 11, 2015 5:40 pm
by matgarage
I'm working on a project where I need to dispatch products into groups and then test a set of 'performances'.
For example :
18 products to dispach
8 room/sit in each group
3 groups where to dispatch the product

I've wrote a script that use logical rules to optimize the dispatching of the products into each group, to get a 'not so bad' result of performances.
To test for other possibilities I've set a function that random the dispatching and test, recursively, until limit of try or if the goal of performance is reached.

But, I would like to try for each possibilities, one by one, and stop when each possibilities have been tested.

Is there a logical/mathematical method to do that in script ?

Re: How to try each possibilities?

Posted: Sat Sep 12, 2015 12:52 am
by dunbarx
Hi.

I am having difficulty undertanding exactly what you are trying to do. Can you give a concrete example, even if of a simple case?

Craig Newman

Re: How to try each possibilities?

Posted: Sat Sep 12, 2015 10:34 am
by matgarage
Hi Craig

I get 3 groups (boxes), and in each group i get 8 sit/room to place products.
I get 18 products to pack into the boxes.
So I need 3 boxes.
For each product numbered from 1 to 18, there is many possible dispatching :
Box 1 = 1 , 2 , 3 , 4 , 5 , 6
Box 2 = 7 , 8 , 9 , 10 , 11 , 12
Box 3 = 13 , 14 , 15 , 16 , 17 , 18

OR

Box 1 = 7 , 8 , 9 , 10 , 11 , 12
Box 2 = 13 , 14 , 15 , 16 , 17 , 18
Box 3 = 1 , 2 , 3 , 4 , 5 , 6

OR

Box 1 = 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14
Box 2 = 15 , 16 , 17 , 18 , 5 , 6
Box 3 = 1 , 2 , 3 , 4

OR ...

Each dispatching is evaluated by my script to calculate a performance.
For this example we can say that each product has a weight and I can calculate the total weight of each dispatching to find the one that fit with my goal.

I'm looking for a way to try each possible dispatching.
I think about a sort of record of each tested combination and a test to compare actual random dispatch to this list. But it will be even longer.
Tell me if I'm wrong but I think that in my example there is :
(8 * 8 * 8 ) * 18 = 9216 possibilities
But we can say that
1 , 2 , 3 , 4 , 5 , 6 is the same that 6 , 5 , 4 , 3 , 2 , 1 (if I'm testing the total weight)

AND

Box 1 = 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14
Box 2 = 15 , 16 , 17 , 18 , 5 , 6 , 3 , 4
Box 3 = 1 , 2
is the same that
Box 1 = 1 , 2
Box 2 = 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14
Box 3 = 15 , 16 , 17 , 18 , 5 , 6 , 3 , 4

Interesting way to optimize but that's to complicated for my skills.
Perhaps you can give me some hints ?