M
mehrtash.souri
Guest
Simple Problem !
I have order for 4 products P1,P2,P3,P4 and I have 3 Suppliers S1,S2,S3 every supplier offer a price for each product and there is distance between suppliers and each supplier may have 0 to 4 of my products.
.
How can I buy this products with the lowest price and fewer trips.
I find total states are supplier^product and in my simple case 3^4=81 states happened
P1S1,P2S1,P3S1,P4S1=62$
P1S1,P2S1,P3S1,P4S2=67$
...
.list of all possibilities
...
there is Shipment Cost between suppliers .
My truck is in My Companey . truck must know where to go (which supplier). and in each supplier what products must take.
So we must find which suppliers must meet and what product (lower price) must get from that supplier.
So 81 states that each state has Price .
Whan I have 10 products and 10 suppliers I will have 10^10=10,000,000,000 states and it takes at least 20 gigabytes of my ram and lang time to create this Matrix. In c#
First I Create All States Then Find Best Price among them.
This method takes gigabyte of ram and a lot of CPU usage and hours of calculation
Is there a better way (optimum algorithm) to solve this problem?
my goal is to find list of suppliers my truck must meet and which of products must take from each supplier.
also there is shipment cost between suppliers.
Best Price Less Trips.
my application finally must give me some thing like :
P1S1,P2S1,P3S2,P4S2=62$
this means that truck must go to supplier S1 and take p1,p2 products ,and then go to supplier S2 and take p3 & p4. because this is optimum way based on price and trip count.
For 2 suppliers (S1,S2) and 3 products(p1,p2,p3) .i have
After that, I can optimize my C# code or switch to GPU for calculations
Continue reading...
I have order for 4 products P1,P2,P3,P4 and I have 3 Suppliers S1,S2,S3 every supplier offer a price for each product and there is distance between suppliers and each supplier may have 0 to 4 of my products.
.
Product1
Product2
Product3
Product4
shipping costs
Supplier1 12$
18$
22$
10$
shipping cost 20$
Supplier2 12$
16$
19$
15$
shipping cost 10$
Supplier3 11$
20$
20$
20$
shipping cost 40$
How can I buy this products with the lowest price and fewer trips.
I find total states are supplier^product and in my simple case 3^4=81 states happened
P1S1,P2S1,P3S1,P4S1=62$
P1S1,P2S1,P3S1,P4S2=67$
...
.list of all possibilities
...
there is Shipment Cost between suppliers .
My truck is in My Companey . truck must know where to go (which supplier). and in each supplier what products must take.
So we must find which suppliers must meet and what product (lower price) must get from that supplier.
So 81 states that each state has Price .
Whan I have 10 products and 10 suppliers I will have 10^10=10,000,000,000 states and it takes at least 20 gigabytes of my ram and lang time to create this Matrix. In c#
First I Create All States Then Find Best Price among them.
This method takes gigabyte of ram and a lot of CPU usage and hours of calculation
Is there a better way (optimum algorithm) to solve this problem?
my goal is to find list of suppliers my truck must meet and which of products must take from each supplier.
also there is shipment cost between suppliers.
Best Price Less Trips.
my application finally must give me some thing like :
P1S1,P2S1,P3S2,P4S2=62$
this means that truck must go to supplier S1 and take p1,p2 products ,and then go to supplier S2 and take p3 & p4. because this is optimum way based on price and trip count.
For 2 suppliers (S1,S2) and 3 products(p1,p2,p3) .i have
p1s1,p2s1,p3s1
p1s1,p2s2,p3s1
p1s1,p2s1,p3s2
p1s1,p2s2,p3s2
p1s2,p2s2,p3s2
p1s2,p2s1,p3s2
p1s2,p2s2,p3s1
p1s2,p2s1,p3s1
p1s1,p2s2,p3s1
p1s1,p2s1,p3s2
p1s1,p2s2,p3s2
p1s2,p2s2,p3s2
p1s2,p2s1,p3s2
p1s2,p2s2,p3s1
p1s2,p2s1,p3s1
After that, I can optimize my C# code or switch to GPU for calculations
Continue reading...