Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Operations Research Bin-packing Problem


From   [email protected]
To   [email protected]
Subject   Re: st: Operations Research Bin-packing Problem
Date   22 Dec 2010 13:29:46 -0600

Happy Holidays Statalisters,

Here is the code I'm using for the problem described below. It works except for failing to carry forward the "new" remaining job time. As a result I end up with most of my jobs "scheduled" in the first block except for those that are too large for it. Jobs that are too large are compared with succeeding blocks until one is that it fits in.

local obsno = 0
while `obsno' <= _N {
local ++obsno
foreach day of numlist 1/5 {
foreach block of numlist 1/2 {
replace RemainingDay`day'Block`block'=Day`day'Block`block' if logid==000001
replace RemainingDay`day'Block`block'=RemainingDay`day'Block`block'[_n-1] if logid!=000001
local priorday=`day'-1
replace D`day'B`block'=.b if schedmins>RemainingDay`day'Block`block'
replace D`day'B`block' = logid if D`day'B`block'==. & D`priorday'B`block'!=. & D`priorday'B`block'!=logid & schedmins<RemainingDay`day'Block`block'
replace D`day'B2 =.f if D`day'B1==logid
replace D`day'B`block'=.f if D`priorday'B`block'==logid | D`priorday'B`block'==.f replace RemainingDay`day'Block`block'=RemainingDay`day'Block`block'-schedmins if D`day'B`block'==logid
}
}
}


Any assistance in getting the adjusted time to to be transferred forward before the next job is scheduled would be appreciated.

Thank you,
Christopher Dickerson
PhD Student
University of Minnesota


On Dec 16 2010, [email protected] wrote:

I am trying to develop an initial solution to a bin-packing problem using Stata.

I have 2 time blocks (different lengths) over a series of 5 days (10 total blocks). Various processes of differing lengths need to be scheduled into the time blocks depending on how much time remains available.

As far as I can tell I need to loop over observations one at a time completing all the calculations in one observation before moving forward. This is because scheduling in one observation changes the available time for all remaining observations.

In plain language:
1: schedule process in block if estimated process time < time available for
block (initially first fit but in future some form of best fit)
2: do not schedule in additional blocks (or replace as some form of missing
if the process is scheduled in a prior block)
3: reduce time available in block scheduled by estimated processing time for all remaining attempts to schedule a process

I can get it to run in such a fashion that:

1: all processes get scheduled in the first block on the first day because the time remaining in that block is not adjusted before the comparison between available time and estimated processing time occurs.

2: or the first observation works correctly, the available time is correctly carried forward to the second (and only the second) observation but the comparison and scheduling of additional processes does not occur.

If the code I have created thus far would be useful, I will post.

Thank you in advance for the assistance,
Christopher Dickerson
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index