PDA

View Full Version : VBA code for distributing items having different weight and time to different slots



nixz
02-25-2016, 01:32 AM
Can anyone help me with this problem?
I have 4 factories, F1, F2, F3, F4 with maximum load 100, 100, 80, 60 tons at a time respectively. F1 and F2 can produce 6 different products namely a, b, c, d, e, f while F3 can produce a, b, c, d, e and F4 can produce only a, b, c, d The products a, b, c, d, e & f are having different production times and weights say
a 2days, 1ton
b 3days, 2ton
c 5days, 4ton
d 7days, 6ton
e 7days, 7ton
f 10days, 9ton
Now I got an order to produce 300 products.
a x 80, b x 30, c x 15, d x 4, e x 7, f x 3.
I need a vba code to distribute these products to different factories so that the total production is completed in almost the same time in 4 factories. More close enough.The code should also work if I get an order for 3 different products only like (a x 10, e x 10, f x 10).
If any one can help me in solving the above problem, its greatly appreciated.

SamT
02-25-2016, 10:36 PM
Is this a class assignment?
We will need to know the Distribution Algorithm.
Can the Factories Parallel process? IOW, can F1 turn out 100 Tons of product a in 2 days?
Can they Multi-Process? IOW, Can F1 Turn out 3 batches of Product a and 2 batches of Product b in the same 6 days?

nixz
02-27-2016, 12:16 PM
Nope, this is not a class assignment. This is my personal project.
Parallel production is not possible. One factory can produce one product at a time. F1 needs 2days to produce 1ton a and 4daya to produce 2 ton a and so on..
Multiprocessing also is not possible. F1 needs 12 days to produce 3batches of a and 2batches of b.
But F1,F2,F3,F4 togather can produce 4 batches of a in 2days.
One factory one product at a time.
Hope its clear.

SamT
02-28-2016, 11:54 AM
Four Systems and Multiple Processes.

Each System can utilize Multiple Processes
Each System has a Production Capacities

Each Process has a Production Unit
Each Process has at Time Duration.

OR: (To turn it sideways)

Each Process Can utilize Multiple Systems
Each Process has a Size
Each Process has a Duration.

Each System has a Maximum Size

The Goal: Given multiple units of multiple Processes, complete each totality of Processes at the same time.
Constraints: Each System can only be assigned one Process.

Visualizations: (as provided by OP)




System

Maximum Size
ProA
ProB
ProC
ProD
ProE
ProF


Sys1
100
X
X
X
X
X
X


Sys2
100
X
X
X
X
X
X


Sys3
80
X
X
X
X
X



Sys4
60

X
X
X







Process

Duration
Size


ProA

2
1


ProB
3
2


ProC
5
4


ProD
7
6


ProE
7
7


ProF
10
9



OR: (To turn it sideways)



Process

Duration
Size
Sys1
Sys2
Sys3
Sys4


ProA

2
1
X
X
X



ProB
3
2
X
X
X
X


ProC
5
4
X
X
X
X


ProD
7
6
X
X
X
X


ProE
7
7
X
X
X



ProF
10
9
X
X






Max Sizes
100
100
80
60





Please see: Cross Posting (http://www.vbaexpress.com/forum/showthread.php?18537-Cross-Posting&p=137004&viewfull=1#post137004) , then feel free to share this on other forums.

nixz
02-28-2016, 08:38 PM
Hi Sam,
Thanks for your time and reply. But I didnt get what you actually meant with your reply.