473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Optimum Batch Size Selection

Narender Sagar
189 100+
Dear All
I need to create a solution for following :
1. I have a Product Master Table in which, I have fields like ProductID, Product Name etc.
2. I have created another table for Batch Size (One to Many relationship) as my one ProductID can have multiple batch size. (But these are standard batch sizes on which the number of batches to produced to be calculated)
3. I have Demand Table in which I have ProductID and the Market Demand (along with Demand Month/Date etc.)
The situation is as follows: A Product "X" can have 3 standard batch size (in BatchSize Master) e.g.
(i) 100000, (ii) 500000 and (iii) 1000000 nos.
Suppose my demand is
a) from 1 to 400000 nos. I want, system should propose to make as many number of batches of 100000 each (depending on nearest figure)
b) If the demand is between 400000 to 500000, the system can propose to make one batch of 500000 units.
c) If my demand is 600000 units, system should propose one batch of 500000 units and 2nd batch of 100000 units.
d) Similarly, If the demand is 700000 units, system can propose to make one batch of 500000 units and 2 batches of 100000 units.
e) If demand is between 900001 to 1000000 units, system can propose to make 1 batches of 1000000 units.
and so on and so forth.
Like wise Product "Y" can have altogether different batch size in BatchSize Master.

I need your support to resolve this.
Please advise..
Thanks
Sep 30 '16 #1
6 1175
Narender Sagar
189 100+
Hi All
May I request someone to look into the case..
I am so hopeful from this group and I'm sure I'll get some quality response here.
Once again I'd like to bring attention of experts in this group..as this is very important project for me.
Thanks
Oct 1 '16 #2
PhilOfWalton
1,430 Expert 1GB
We seem to get a lot of questions from you, and with respect, I think that you ask Bytes before you have done any thinking.

I will point you on the right track - the rest is up to you.

Is the demand >= maximum batch size -
YES Add 1 to the large Bach size counter Deduct the Large Batch size and repeat until the answer is NO

Do the same thing for the Second largest Batch Size.

I leave you to work out what to do after you have process the smallest batch Size

Phil
Oct 1 '16 #3
Narender Sagar
189 100+
Thanks Phil..
I Will keep this in mind.
Oct 2 '16 #4
Oralloy
988 Expert 512MB
Narender,

Your question looks interesting, but it is difficult to do anything without seeing what you have done.

Will you please post your code when asking questions, so that some of us who are a bit slow-witted are better able to understand? I am having a bit of difficulty understanding your question, because I cannot envision the table structure and example data...

Thanks,
Oralloy
Oct 2 '16 #5
Narender Sagar
189 100+
Dear Oralloy

First of all, sorry for late response and thanks for showing interest in question.
I've thought about the logic I need to apply. which is follows:
(Though, I'm open for further suggestion)
So system will check Maximum BatchSize and compare it with the demand. If MaxBatchSize is less than or equal to Demand, Value if true : Reduce it from Demand and count and store the BalanceDemand in Temp.Table, Value if False : check for next available BatchSize (Check if Next Available BatchSize is less than or equal to Demand or BalanceDemand and so on ;
I think I need to use following syntax:
Expand|Select|Wrap|Line Numbers
  1. Do { While | Until } condition
  2.     [ statements ]
  3.     [ Continue Do ]
  4.     [ statements ]
  5.     [ Exit Do ]
  6.     [ statements ]
  7. Loop
  8. -or-
  9. Do
  10.     [ statements ]
  11.     [ Continue Do ]
  12.     [ statements ]
  13.     [ Exit Do ]
  14.     [ statements ]
  15. Loop { While | Until } condition
  16.  
But I don't know what exactly should be my code

May I request to move further..

Thanks
Oct 7 '16 #6
Oralloy
988 Expert 512MB
Narender Sagar,

My preference is for the top driven loop form, because when one needs to analyse a program, one sees the loop control prior to analysing the content. Yes, the bottom driven loop has coding efficiency, I agree. Use of "Structured Coding" is about the ability to reason about code, so take it for what you will.

Your pseudo-code, rewritten slightly:
Expand|Select|Wrap|Line Numbers
  1. So system will check Maximum BatchSize and compare it with the demand. 
  2.  
  3. If MaxBatchSize is less than or equal to Demand, 
  4.   Value if true : Reduce it from Demand and count and store the BalanceDemand in Temp.Table, 
  5. Else
  6.   Value if False : check for next available BatchSize (Check if Next Available BatchSize is less than or equal to Demand or BalanceDemand and so on )
Let's simplify that a little bit and remove the editorialising:
Expand|Select|Wrap|Line Numbers
  1. Run MaxBatchSize batches until demand is less than MaxBatchSize
  2.  
  3. Run Batches of decreasing size until required production is complete.
  4.  
In the end, you might end up with something like this:
Expand|Select|Wrap|Line Numbers
  1. Dim BatchSize(0 To NumberOfBatchSizes) As Long
  2. BatchSize(0) = ...
  3. BatchSize(1) = ...
  4. BatchSize(2) = ...
  5. etc.
  6.  
  7. Dim MaxBatchSize As Long
  8. Let MaxBatchSize = BatchSize(Ulimit(BatchSize, 1))
  9.  
  10. Dim DemandRemaining As Long
  11. Let DemandRemaining = Demand
  12.  
  13. While DemandRemaining > MaxBatchSize Do
  14.   Store MaxBatchSize in TempTable
  15.   Let DemandRemaining = DemandRemaining - MaxBatchSize
  16. Loop
  17.  
  18. While DemandRemaining > 0 Do
  19.   For BatchIndex = LBound(BatchSize, 1) to UBound(BatchSize, 2)
  20.     If BatchSize(BatchIndex) > DemandRemaining Then
  21.       Store BatchSize(BatchIndex - 1) in TempTable
  22.       Let DemandRemaining = DemandRemaining - BatchSize(BatchIndex - 1)
  23.       Exit For
  24.     End If
  25.   Next
  26. Loop
  27.  
I would consider compressing both loops into one, but it is not necessary.

This is fine, if batch size is inversely proportional to production cost per unit. Are you trying to perform total optimisation, or just good-enough optimisation? For example, if our customer wants 103 units, that might be a batch of 100, and three batches of 1, while it is less expensive to produce a batch of 100, and a batch of 10, and just discard 7 units.

--Oralloy
Oct 8 '16 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ajay Garg | last post by:
I want to Insert 10000 rows at a time and commit in sql server , Is there a way to do it if the source tables have no id fields ? What would be the most efficient method? Thanks Ajay
1
by: | last post by:
Is there any way i can disable Font Style and Size Section that comes on Font Dialog Box.
2
by: andy6 | last post by:
I am using the following code and SQL Profiler shows no activity when I step through the .update line. Do you see a syntax error? Thanks! using (SqlConnection cn = new SqlConnection(cnStr)) {...
16
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on...
3
by: =?Utf-8?B?VG90eSBTYW50YW5h?= | last post by:
I am using textboxes, buttons labels and drop down lists on a web page, but i noticed that textboxes and buttons font size doesn't change when i change the font size in IE ( from IE menu:...
0
by: dankyy1 | last post by:
hi all i got a problem ....as there are a bill pool.all bills have a cost $ and the last date . from this pool i want to get optimum selection that near to equals to money and the date that...
1
by: bravo | last post by:
hi using mysql 4.1 i wish to update records using batch update but for a batch of 100, records and table having only 5000 records execution time is approx 2.4 sec i want to know whether this time...
7
by: Rick Merrill | last post by:
I need a web page in exact pixels height and width for use in standard def TV. Any ideas how?
3
by: Venturini | last post by:
I am trying to put together a web page where the customer makes choices of products and is then given a total. I am extremely new to Javascript and have managed to get as far as I have from web...
0
by: anoop s | last post by:
Hi, In my C# application I am using SqlBulkCopy for inserting data to DB. I set Batchsize as number of rows in my data table. Normally it have 4000 - 5000 records. But in worst case it may be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.