Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Factory Crane Scheduling by Dynamic Programming Ionut. Aron Cura Capital Management, ionut.aron@gmail.com Latife Genç-Kaya Istanbul Şehir University, latifegenc@sehir.edu.tr Iiro Harjunkoski ABB Corporate Research, Germany, Iiro.Harjunkoski@de.abb.com Samid Hoda Tepper School of Business, Carnegie Mellon University, shoda@andrew.cmu.edu J. N. Hooker Tepper School of Business, Carnegie Mellon University, john@hooker.tepper.cmu.edu Revised December 2010 Abstract We describe a specialized dynamic programming algorithm for factory crane scheduling. An innovative data structure controls the memory requirements of the state space and enables solution of problems of realistic size. The algorithm finds optimal space-time trajectories for two factory cranes or hoists that move along a single overhead track. Each crane is assigned a sequence of pickups and deliveries at specified locations that must be performed within given time windows. The cranes must not interfere with each other, although one may yield to the other. The state space representation permits a wide variety of constraints and objective functions. It is stored in a compressed data structure that uses a cartesian product of intervals of states and an array of two-dimensional circular queues. We also show that only certain types of trajectories need be considered. The algorithm found optimal solutions in less than a minute for medium-sized instances of the problem (160 tasks, spanning four hours). It can also be used to create benchmarks for tuning heuristic algorithms that solve larger instances. 1 1 Introduction Manufacturing facilities frequently rely on track-mounted cranes to move inprocess materials or equipment from one location to another. A typical arrangement, and the type studied here, allows one or more hoists to move along a single horizontal track that is normally mounted on the ceiling. Each hoist may be mounted on a crossbar that permits lateral movement as the crossbar itself moves longitudinally along the track. A cable suspended from the crossbar raises and lowers a lifting hook or other device. When a production schedule for the plant is drawn up, cranes must be available to move materials from one processing unit to another at the desired times. The cranes may also transport cleaning or maintenance equipment. Because the cranes operate on a single track, they must be scheduled so as not to interfere with each other. One crane may be required to yield (move out of the way) to permit another crane to pick up or deliver its load. The problem is combinatorial in nature because one must not only compute a space-time trajectory for each crane, but must decide which crane yields to another and when. A decision made at one point may create a bottleneck that has unforeseen repercussions much later in the schedule. Production planners may put together a schedule that seems to allow ample time for crane movements, only to find that the crane operators cannot keep up with the schedule. In this paper we analyze the problem of scheduling two cranes and describe an exact algorithm, based on dynamic programming, to solve it. We assume that each crane has been pre-assigned a sequence of jobs to perform. A crane may be required to carry out multiple tasks at various locations before completing a job, and each job may specify a different set of tasks. Time windows may be given for the job as a whole and/or the tasks within a job. We selected a dynamic programming approach because it not only solves a problem of this kind but accommodates a wide variety of constraints that may arise in factory settings. Any constraint or objective function that can be defined in terms of the current state vector can be implemented. For example, precedence relations may be imposed between jobs, or between tasks in different jobs. A crane may be allowed to pause, or yield to the other crane, between certain tasks but not others. Many linear and nonlinear objective functions are possible, although in practice the objective is normally to follow the production schedule as closely as possible. The state space is large, due to the fine space-time granularity with which the problem must be solved, as well as the necessity of keeping up with which task a crane is performing and how long it has been processing that task. To deal with these complications we introduce a novel state space description that represents many states implicitly as a cartesian product of intervals. The state space is efficiently stored and updated in a data structure that uses an array of two-dimensional circular queues. These enhancements accelerate solution by at least an order of magnitude and allow us to solve problems of realistic size within a reasonable time. This research is part of a larger project in which both heuristic and exact al2 gorithms have been developed for use in crane scheduling software. The heuristic method makes crane assignment and sequencing decisions as well as computing space-time trajectories, and it is fast enough to accommodate large problems involving several cranes. However, once the assignments and sequencing are given, the heuristic method may fail to find feasible trajectories when they exist and reject good solutions as a result. We therefore found it important to solve the trajectory problem exactly for a given assignment and sequencing, as a check on the heuristic method. The exact algorithm has practical value in its own right, because two-crane problems are common in industry, and the algorithm solves instances of respectable size within a minute or so. Yet it has an equally important role in the creation of benchmarks against which heuristic methods can be tested and tuned for best performance. We begin by deriving structural results for the two-crane problem that restrict the trajectories that must be considered. This not only accelerates solution but simplifies the operation of the cranes by restricting their movements to certain predictable patterns. We then describe the dynamic programming algorithm and the state space representation, and we conclude with computational results and directions for further research. 2 Previous Work Crane scheduling has received a great deal of study, but little attention has been given to the factory crane scheduling problem addressed here. The literature focuses primarily on two types of problems: movement of materials from one tank to another in an electroplating or similar process (normally referred to as hoist scheduling problems), and loading and unloading of container ships in a port. Both differ significantly from the factory crane problem. A classification scheme for hoist scheduling problems appears in [13]. These problems typically require a cyclic schedule involving one or more types of parts, where parts of each type must visit specified tanks in a fixed sequence. The most common objective is to minimize cycle time. Much research in this area deals with the single-hoist cyclic scheduling problem [1, 12, 17]. Even this restricted problem is NP-complete [6]. Several papers address cyclic two-hoist and multi-hoist problems. One approach partitions the tanks into contiguous subsets, assigns a hoist to each subset, and schedules each hoist within its partition [7, 23]. A better solution can generally be obtained, however, by allowing a tank to be served by more than one hoist. Models for this problem assign transfer operations to hoists and determine when each operation should begin and end [2, 5, 8, 9, 10, 14, 18, 19, 20, 21]. These models do not explicitly compute space-time trajectories but avoid collisions by selecting departure and arrival times that allow hoists to make the necessary movements without interference Our problem differs from the typical hoist scheduling problem in several respects. The schedule is not cyclic. The problem is given as a set of jobs rather than parts to be processed. Each crane is assigned a sequence of jobs rather 3 than transfer operations. A job may consist of several tasks to be performed consecutively by one crane in a specified order. The jobs may all be different. Both loaded and empty cranes may be allowed to pause or yield, and permission to do so may depend on which task is being executed. There may also be precedence constraints and a wide variety of objective functions. Port cranes are generally classified as quay cranes and yard cranes. Quay cranes may be mounted on a single track, as are factory cranes, but the scheduling problem differs significantly. The cranes load (or unload) containers into ships rather than transferring items from one location on the track to another. A given crane can reach several ships, or several holds in a single ship, either by rotating its arm or perhaps by moving laterally along the track. The problem is to assign cranes to loading (unloading) tasks, and schedule the tasks, so that the cranes do not interfere with each other [3, 4, 15]. Yard cranes are typically mounted on wheels and can follow certain paths in the dockyard to move containers from one location to another [16, 22]. Port and yard cranes clearly present a different type of scheduling problem than factory cranes. An early study of factory crane scheduling [11] presents heuristic algorithms that obtain noninterfering solutions only under certain conditions. A worst-case bound is derived for makespan in the two-crane case. However, the method is insufficiently general to address the problem considered here. There is no attempt to apply it to realistic problems, and no computational results are reported. 3 The Optimal Trajectory Problem As noted above, we define a crane scheduling problem to consist of a number of jobs, each of which specifies several tasks to be performed consecutively. For example, a job may require that a crane pick up a ladle at one location, fill the ladle with molten metal at a second location, deliver the metal to a third location, and then return the ladle. Tasks may also involve maintenance and cleaning activities. The same crane must perform all the tasks in a job and must remain stationary at the appropriate location while processing each task. The location and processing time for each task are given (Fig.1), as are release times and deadlines. Each crane is pre-assigned a sequence of jobs. Each job must finish before the next job assigned to that crane begins. In this study we explicitly account only for the longitudinal movements of the crane along the track. We assume that the crane has time to make the necessary lateral and vertical movements as it moves from one task location to another. This results in little loss of generality, because any additional time necessary for lateral or vertical motion can be built into the processing time for the task. 4 The problem data are: Rj , Dj , Pj = release time, deadline, and processing time of task j Lj = processing location (stop) for task j c(j) = crane assigned to task j v, Lmax = maximum crane speed and track length δ = minimum crane separation Note that we refer to the processing location of a task as a stop. We suppose for generality that there are cranes 1, . . . , m, where crane 1 is the left crane and crane m the right crane, although we solve the problem only for m = 2. Tmax is the length of the time horizon. The problem variables are: xc (t) = position of crane c at time t yct = task being processed by crane c at time t (0 if none) τj = time at which task j starts processing Task j therefore finishes processing at time τj + Pj . We assume that the tasks are indexed so that tasks assigned to a given crane are processed in order of increasing indices. If we measure time in discrete intervals of length ∆t, the basic problem with n tasks and m cranes may be stated min f (τ )   0 ≤ xc (t) ≤ Lmax  xc (t) − v∆t ≤ xc (t + ∆t) ≤ xc (t) + v∆t all c, all t ∈ T   yct > 0 ⇒ xc (t) = Lyct xc (t) ≤ xc+1 (t) − ∆, c = 1, . . . , m − 1, all t ∈ T ) Rj ≤ τj ≤ Dj − Pj j = 1, . . . , n yc(j)t = j, t = τj , . . . , τj + Pj − ∆t {c(j) = c(j ′ ), j < j ′ } ⇒ τj < τj ′ , j, j ′ = 1, . . . , n xct , τj ∈ R, yct ∈ {0, . . . , n}, all c, all t ∈ T (a) (b) (c) (d) (1) (e) (f ) (g) where T = {0, ∆t, . . . , Tmax }. Constraint (a) requires that the cranes stay on the track, and (b) that their speed be within the maximum. Constraint (c) implies that a crane must be at the right location when it is processing a task. Constraint (d) makes sure the cranes do not interfere with each other. Constraint (e) enforces the time windows, and (f) ensures that processing continues for the required amount of time once it starts. Constraint (g) requires that the tasks assigned to a crane be processed in the right order. A number of additional constraints may be imposed in the dynamic programming model, as described in Section 5 below. We assume that the objective f (τ ) is a function of the task start times, because this is sufficient for practical application and allows us to prove the 5 structural results below. Because the dynamic P programming model requires separability, we assume f (τ ) has the form j fj (τj ). Yet each fj (τj ) can be any function whatever, which provides a great deal of flexibility. In typical factory applications, we are interested in conforming to the production schedule as closely as possible. Thus we might define fj (τj ) = pj (τj − Rj ), where pj (t) is any penalty function of the tardiness t we may wish to use, linear or nonlinear, continuous or discontinuous. If we wish to minimize makespan, we can let task n be a dummy task that is constrained to follow all others, and set fn (τn ) = τn and fj (τj ) = 0 for j = 1, . . . , n − 1. 4 Canonical Trajectories Optimal control of the cranes is much easier to calculate when it is recognized that only certain trajectories need be considered, namely those we call canonical trajectories. We will show that when there are two cranes, some pair of canonical trajectories is optimal. This substantially reduces the number of state transitions that must be enumerated and makes a dynamic programming approach computationally practical for this problem. Let a processing schedule for a given crane consist of the vector τ of task start times. We define the extremal trajectory with respect to τ for the left crane to be one that moves to the right as late as possible, and moves to the left as early as possible (Fig. 1). The extremal trajectory for the right crane moves to the left as late as possible and to the right as early as possible. More precisely, if Lj ≤ Lj+1 , the extremal trajectory for the left crane for t ∈ [τj , τj+1 ] is given by  Lj for t ∈ [τj , Tj ] x̄1t = Lj + v(t − Tj ) for t ∈ [Tj , τj+1 ] where Tj = τj+1 − (Lj+1 − Lj )/v. If Lj > Lj+1 , it is given by  for t ∈ [τj , τj + Pj ]  Lj Lj + v(t − τj − Pj ) for t ∈ [τj + Pj , Tj′ ] x̄1t =  Lj+1 for t ∈ [Tj′ , τj+1 ] where Tj′ = τj + Pj + (Lj+1 − Lj )/v. A trajectory for the left crane is canonical with respect to the right crane if at each moment it is the leftmost of the left crane’s extremal trajectory and the right crane’s actual trajectory, allowing for separation ∆ (Fig. 2). More precisely, trajectory x′1 is canonical for the left crane, with respect to trajectory x2 for the right crane, if x′1 (t) = min{x̄1 (t), x2 (t) − ∆} at each time t. Similarly, trajectory x′2 (t) is canonical for the right crane if x′2 (t) = max{x̄2 (t), x1 (t) + ∆}. Finally, a pair of trajectories is canonical if the trajectories are canonical with respect to each other. Theorem 1 If the two-crane problem (1) has an optimal solution, then some optimal pair of trajectories is canonical. 6 Figure 1: Left: Sample space-time trajectory for one task. The shaded vertical bars denote processing, which in this case consists of loading and unloading. Right: Extremal trajectory for the left crane (a) when the destination is to the right of the origin, and (b) when the destination is to the left of the origin. Figure 2: Canonical trajectory for the left crane (leftmost solid line). 7 Proof. The idea of the proof is to replace the left crane’s optimal trajectory with a canonical trajectory with respect to the right crane’s optimal trajectory. Then assign the right crane a canonical trajectory with respect to the left crane’s new trajectory, and assign the left crane a canonical trajectory with respect to the right crane’s new trajectory. At this point it is shown that the trajectories are canonical with respect to each other. We will see that these replacements can be made without changing the objective function value, which means the canonical trajectories are optimal, and the theorem follows. Thus let x∗ = (x∗1 , x∗2 ) be a pair of optimal trajectories for a two-crane problem. Let x̄1 , x̄2 be extremal trajectories for the left and right cranes with respect to the processing schedules in the optimal trajectories. By definition, the extremal trajectories have the same processing schedules as the original trajectories. Consider the canonical trajectory x′1 for the left crane with respect to x∗2 , which is given by x′1 (t) = min{x̄1 (t), x∗2 (t) − ∆}. We claim that (x′1 , x∗2 ) is optimal. First note that x̄1 (t) = x∗1 (t) if the left crane is processing at time t, by definition of x̄1 . Thus x̄1 (t) = x∗1 (t) ≤ x∗2 (t) − ∆ for all such t, because x∗1 , x∗2 is a feasible schedule. This implies that x′1 (t) = x∗1 (t) at all times t when the left crane is processing. The left crane can therefore retain its original processing schedule. Because the objective function value does not change, (x′1 , x∗2 ) is optimal if it is feasible. Furthermore, (x′1 , x∗2 ) is feasible because the cranes do not interfere with each other, and the speed of the left crane is never greater than v. The cranes do not interfere with each other because x′1 (t) ≤ x∗2 (t) − ∆ for all t, from the defintion of x′1 (t). To show that the speed of the left crane is never more than v it suffices to show that the average speed in the left-to-right direction between any pair of time points t1 , t2 is never more than v, and similarly for the average speed in the right-to-left direction. The former is min{x̄1 (t2 ), x∗2 (t2 ) − ∆} − min{x̄1 (t1 ), x∗1 (t1 ) − ∆} x′1 (t2 ) − x′1 (t1 ) = t2 − t1 t2 − t1   x̄1 (t2 ) − x̄1 (t1 ) x∗2 (t2 ) − x∗2 (t1 ) ≤ max ≤v , t2 − t1 t2 − t1 where the first inequality is due to the fact that min{a, b} − min{c, d} ≤ max{a − c, b − d} for any a, b, c, d, and the second inequality due to the fact that x̄1 and x∗2 are feasible trajectories. The speed in the right-to-left direction is similarly bounded. Now consider the canonical trajectory x′2 for the right crane with respect to ′ x1 , given by x′2 (t) = max{x̄2 (t), x′1 (t) + ∆}. It can be shown as above that the right crane can retain its processing schedule, and (x′1 , x′2 ) is therefore optimal. Finally, let x′′1 be the canonical trajectory for the left crane with respect to ′ x2 , given by x′′1 (t) = min{x̄1 (t), x′2 (t) − ∆}. Again (x′′1 , x′2 ) is optimal. Since x′′1 is canonical with respect to x′2 , to prove the theorem it suffices to show that x′2 8 is canonical with respect to x′′1 ; that is, max{x̄2 (t), x′′1 (t) + ∆} = x′2 (t) for all t. To show this we consider four cases for each time t. Case 1: x̄1 (t) + ∆ ≤ x̄2 (t). We first show that (x′′1 (t), x′2 (t)) = (x̄1 (t), x̄2 (t)) (2) Because x′1 (t) = min{x̄1 (t), x∗2 (t) − ∆}, x′1 (t) is equal to x̄1 (t) or x∗2 (t) − ∆. In the latter case, we have x′2 (t) = max{x̄2 (t), x′1 (t) + ∆} = max{x̄2 (t), x∗2 (t)} = x̄2 (t) and x′′1 (t) = min{x̄1 , x′2 (t) − ∆} = min{x̄1 , x̄2 (t) − ∆} = x̄1 (t) If, on the other hand, x′1 (t) = x̄1 (t), we have x′2 (t) = max{x̄2 (t), x̄1 (t) + ∆} = x̄2 (t) and again x′′1 (t) = x̄1 (t). Now from (2) we have max{x̄2 (t), x′′1 (t) + ∆} = max{x̄2 (t), x̄1 (t) + ∆} = x̄2 (t) = x′2 (t) as claimed. The remaining cases suppose x̄2 (t) < x̄1 (t) + ∆ and consider the situations in which x∗2 (t) is less than or equal to x̄2 (t), between x̄2 (t) and x̄1 (t) + ∆, and greater than x̄1 (t) + ∆. Case 2: x∗2 (t) ≤ x̄2 (t) < x̄1 (t) + ∆. It can be checked that (x′′1 (t), x′2 (t)) = (x̄2 (t) − ∆, x̄2 (t)) and max{x̄2 (t), x′′1 (t) + ∆} = max{x̄2 (t), x̄2 (t)} = x̄2 (t) = x′2 (t), as claimed. Case 3: x̄2 (t) < x∗2 (t) ≤ x̄1 (t) + ∆. Here (x′′1 (t), x′2 (t)) = (x∗2 (t) − ∆, x∗2 (t)) and max{x̄2 (t), x′′1 (t) + ∆} = max{x̄2 (t), x∗2 (t)} = x∗2 (t) = x′2 (t). Case 4: x̄2 (t) < x̄1 (t) + ∆ < x∗2 (t). Here (x′′1 (t), x′2 (t)) = (x̄1 (t), x̄1 (t) + ∆) and max{x̄2 (t), x′′1 (t) + ∆} = max{x̄2 (t), x̄1 (t) + ∆} = x̄1 (t) + ∆ = x′2 (t). This completes the proof. The properties of canonical trajectories allow us to consider a very restricted subset of trajectories when computing the optimum. Corollary 2 If the two-crane problem has an optimal solution, then there is an optimal solution with the following characteristics: (a) While not processing a task, the left (right) crane is never to the right (left) of both the previous and the next stop. (b) While not processing a task, the left (right) crane is moving in a direction toward its next stop if it is to the right (left) of the previous or next stop. (c) A crane never moves in the direction away from its next stop unless it is adjacent to the other crane at all times during such motion. 9 (d) While not processing a task, the left (right) crane can be stationary only if it is (i) at the previous or the next stop, whichever is further to the left (right), or (ii) adjacent to the other crane. Proof. (a) If crane 1 (the left crane) is to the right of both its previous and next stop at some time t, then x1 (t) > x̄1 (t). This is impossible in a canonical trajectory, in which x1 (t) = min{x̄1 (t), x2 (t) − ∆}. The argument is similar for crane 2. (b) Suppose crane 1 is to the right of its previous stop. Due to (a), it is not to the right of its next stop, which must therefore be to the right of the previous stop. We cannot have x1 (t) > x̄1 (t) as in (a), and we cannot have x1 (t) < x̄1 (t), since this means the crane cannot reach its next stop in time. So crane 1 is on its canonical trajectory, which means that it is moving toward its next stop. The argument is similar if crane is to the right of the next stop. (c) From (a) and (b), at a given time t crane 1 can be moving in the direction opposite its next stop only if it is at or to the left of both the previous and next stops. This means that it will be to the left of both at time t + ∆t, so that x1 (t + ∆t) < x̄1 (t + ∆t). But since x1 (t + ∆t) = min{x̄1 (t + ∆t), x2 (t + ∆t) − ∆} this means x1 (t + ∆t) = x2 (t + ∆t) − ∆, and crane 1 is adjacent to the other crane. Since crane 1 is moving left between t and t + ∆t, it must be adjacent to the other crane at time t as well. (d) From (a) and (b), a stationary crane 1 must be at or to the left both the previous and the next stop. If it is at one of them, then (i) applies. If it is to the left of both, then x1 (t) < x̄1 (t), which again implies that x1 (t) = x2 (t) − ∆, and (ii) holds. 5 Dynamic Programming Recursion The optimal control problem for the cranes is not simply a matter of computing an optimal space-time trajectory. It is complicated by three factors: (a) each crane must perform tasks in a certain order; (b) each task must be performed at a certain location for a certain amount of time; and (c) the cranes must not interfere with each other. Dynamic programming has the flexibility to deal with these and other constraints while preserving optimality (up to the precision allowed by the space and time granularity). The drawback is a potentially exploding state space, but we will show how to keep it under control for problems of reasonable size. To simplify notation, we assume from here out that ∆t = 1. There are three state variables for each crane. One is the crane location xct as defined in model (1). The second is the task yct assigned to crane c at time t. This the task currently being processed, or if the crane is not currently processing, the next task to be processd by crane c. This differs from yct in the 10 model (1) in that we no longer set yct = 0 when crane c is not processing. The third state variable is uct =  amount of time crane c will have been processing at time t + 1 (0 if the crane is neither processing nor starts processing at time t) In principle the recursion is straightforward, although a practical implementation requires careful management of state transitions and data structures. Let xt = (x1t , x2t ), and similarly for yt and ut . Also let zt = (xt , yt , ut ). It is convenient to use a forward recursion: gt+1 (zt+1 ) = min zt ∈S −1 (zt+1 ) {h(t, yt , ut ) + gt (zt )} (3) where gt (zt ) is the cost of an optimal trajectory between the initial state and state zt at time t, h(t, yt , ut ) is the cost incurred at time t, and S −1 (zt+1 ) is the set of states at time t from which the system can move to state zt+1 at time t + 1. P Because the objective function is f (τ ) = j fj (τj ) as specified earlier, we incur cost fj (t) when the crane c assigned P task j starts task j at time t (i.e., yct = j and uct = 1). Thus h(t, yt , ut ) = c hc (t, yt , ut ), where  fyct (t) if uct = 1 hc (t, yt , ut ) = 0 otherwise The boundary condition is g0 (z0 ) = 0, where z0 is the initial state. The optimal cost is gTmax (zTmax ), where zTmax is the desired terminal state. The possible state transitions are restricted by the rules in Corollary 1. This allows us to exclude states from S −1 (zt+1 ) and therefore reduce computation. Rule (a), for example, prevents the left crane from moving to the right if this would put it to the right of both the current and the next stop. Let y ′ be the stop that precedes stop y1,t+1 in the list of stops assigned to the left crane (crane 1). If x1,t+1 = max{Ly1,t+1 , Ly′ } in state zt+1 , then x1t cannot be equal to x1,t+1 + 1 in any state belonging to S −1 (zt+1 ), because this would mean that the left crane was to the right of both its previous and next stop. The reasoning is similar for the right crane. Rule (b) of the corollary requires the left crane to move toward its next stop if it is to the right of the previous or next stop. This means that if x1,t+1 ≥ Ly′ and x1,t+1 < Ly1,t+1 , then x1t cannot be equal to x1,t+1 +1 in any state belonging to S −1 (zt+1 ), because this would mean that the crane failed to move toward its next stop even though it was to the right of its previous stop. Similarly, if x1,t+1 ≤ Ly′ and x1,t+1 > Ly1,t+1 , then x1t cannot be equal to x1,t+1 − 1 in any state belonging to S −1 (zt+1 ), because this would mean that the crane failed to move toward its next stop even though it was to the right of its next stop. Rules (c) and (d) of the corollary are similarly implemented. By a suitable definition of S −1 (zt+1 ), we can impose any additional constraint that can be defined in terms of the current state and that is consistent with a canonical trajectory. For example, we can require the crane c processing 11 task j to start moving to the next task j ′ as soon as processing is finished. This is possible because the state at time t tells us whether crane c is processing task j (yct = j) and will be finished at time t + 1 (uct = Pj ). The set S −1 (zt+1 ) is again defined by formulating the constraint in reverse: if crane c is assigned task j ′ at time t + 1 (yc,t+1 = j ′ ) and is still in the same location as task j (xc,t+1 = Lj ), then there is no feasible predecessor for the current state (S −1 (zt+1 ) = ∅). Similarly, we can prohibit crane c from yielding (moving away from its next stop) after it finishes processing task j. A variety of precedence constraints can also be implemented. For example, we can require that the right crane start processing task j ′ only after the left crane finishes task j. At any given time t, we can determine whether the left crane has finished task j by checking whether y1t > j, and if so we allow the right crane to start task j ′ . Finally, we can impose bounds on the processing time rather than specify it exactly, because state variable uct indicates how long the current task has been processed so far. For each state zt+1 the recursion (3) computes the minimum gt+1 (zt+1 ) and −1 the state zt = s−1 t+1 (zt+1 ) that achieves the minimum. Thus st+1 (zt+1 ) points to the state that would precede zt+1 in the optimal trajectory if zt+1 were in the optimal trajectory. For a basic recursion, the cost table gt+1 (·) is stored in memory until gt+2 (·) is computed, and then released (this is modified in the next section). Thus only two consecutive cost tables need be stored in memory at any one time. The table s−1 t+1 (·) of pointers is stored offline. Then if zT is the final state, we can retrace the optimal solution in reverse order by reading −1 the tables s−1 t+1 (·) into memory one at a time and setting zt = st+1 (zt+1 ) for t = N − 1, N − 2, . . . , 0. 6 Reduction of the State Space We can substantially reduce the size of the state space if we observe that in practical problems, the cranes spend more time processing than moving. The typical processing time for a state ranges from two to five minutes (sometimes much longer), while the typical transit time to the next location is well under a minute. Furthermore, the state variables representing location and task assignment (xct and yct ) cannot change while the crane is processing. These facts suggests that the processing time state variable uct should be hi lo lo hi replaced by an interval Uct = [ulo ct , uct ] = {uct , uct + 1, . . . , uct } of consecutive hi ≤ P . A single “state” (xt , yt , Uct ) = ≥ 0 and u processing times, where ulo yct ct ct (xt , yt , (U1t , U2t )) now represents a set of states, namely the Cartesian product {(xt , yt , (i, j)) | i ∈ U1t , j ∈ U2t } The possible state transitions for either crane c are shown in Table 1. The transitions in the table are feasible only if they satisfy other constraints in the problem, including those based on time windows, the physical length of the track, and interactions with the other crane. The transitions can be explained, line by line, as follows: 12 Table 1: Possible state transitions for crane c using an interval-valued state variable for processing time. State at time t State at time t + 1 1. (xct , yct , [0, 0]) (x′ , yct , [0, 0])1 or (x′ , yct , [0, 1])1,2 or (x′ , yct , [1, 1])1,2,3 2. (xct , yct , [0, u2 ])4 (xct , yct , [0, u2 + 1]) or (xct , yct , [1, u2 + 1])2,4 3. (xct , yct , [0, Pyct ]) (xct , yct , [0, Pyct ]) or (xct , yct , [1, Pyct ])3 or (xct , y ′ , [0, 0])5 or (xct , y ′ , [0, 1])2,5 or (xct , y ′ , [1, 1])2,3,5 4. (xct , yct , [u1 , u2 ])4,6 (xct , yct , [u1 + 1, u2 + 1]) 5. (xct , yct , [u1 , Pyct ])6 (xct , yct , [u1 + 1, Pyct ]) or (xct , y ′ , [0, 0])5 or (xct , y ′ , [0, 1])2,5 or (xct , y ′ , [1, 1])2,3,5 1 The next location x′ is xct − 1, xct , or xct + 1. 2 This 3 This 4 Here transition is possible only if task yct processes at location x′ . transition is possible only if task yct can start no later than time t + 1. 5 Task 0 < u2 < Pyct . y ′ is the task that follows task yct on crane c. 6 Here u1 > 0. 1. Because the processing time interval is the singleton [0, 0], the crane can be in motion and can in particular move to either adjacent location. When it arrives at the next location, the currently assigned task can start processing if the crane is in the correct position, in which case the state interval is Uct = [0, 1] to represent two possible states: one in which the task does not start processing at time t + 1, and one in which it does (the interval is [1, 1] if the deadline forces the task to start processing at t + 1). If the crane is in the wrong location for the task, the state remains [0, 0]. 2. None of the states in the interval [0, u2 ] allow processing to finish at time t + 1. So all of the processing time states advance by one—except possibly the zero state, in which processing has not yet started and can be delayed yet again if the deadline permits it. 3. The last state in the interval [0, Pyct ] allows processing to finish at time t+ 1. This state splits off from the interval and assumes one of the processing state intervals in line 1. The other states evolve as in line 2. 4. Because the task is underway in all states, all processing times advance by one. 5. This is similar to line 3 except that there is no zero state. 13 There is no need to store a pointer s−1 t+1 (xt , yt , (i, j)) for every state (xt , yt , (i, j)) in (xt , yt , Ut ). This is because when uct ≥ 2, the state of crane c preceding (xct , yct , uct ) must be (xct , yct , uct − 1). Thus we store s−1 t+1 (xt , yt , (i, j)) only when i ≤ 1 or j ≤ 1. However, we must store the cost gt+1 (xt , yt , (i, j)) for every (i, j), because it is potentially different for every (i, j). Fortunately, it is not necessary to update this entire table at each time period, because most of the costs evolve in a predictable fashion. If i, j ≥ 2, then gt+1 (xy , yt , (i, j)) = gt (xt , yt , (i − 1, j − 1)) So for each pair of tasks (y, y ′ ) we maintain a two-dimensional circular queue Qyy′ (·, ·) in which the cost gt+1 ((Ly , Ly′ ), (y, y ′ ), (i, j)) (4) for i, j ≥ 2 is stored at location Qyy′ ((t + i − 2) mod M, (t + j − 2) mod M ) where M is the size of the array Qyy′ (·, ·) (i.e., the longest possible processing time). In each period we insert the cost (4) into Q only for pairs (i, j) in which i = 2 or j = 2; the costs for other pairs with i, j ≥ 2 were computed in previous periods. Thus only one row and one column of the Q array are altered in each time period, which substantially reduces computation time. When i ≤ 1 or j ≤ 1, the cost (4) is stored as a table entry gt+1 (xt , yt , (i, j)) that is updated at every time period, as with pointers. The array Qyy′ (·, ·) is created when the state ((Ly , Ly′ ), (y, y ′ ), (i, j)) is first encountered with i, j ≥ 2. The array is kept in memory over multiple periods until it is no longer updated, at which time it is deleted. 7 Experimental results We report computational tests on a representative problem that is based on an actual industry scheduling scenario. There are 60 jobs, of which four jobs consist of one task, eleven consist of two tasks, and 45 consist of three tasks, for a total of 161 tasks. We obtain smaller instances by scheduling only some of the jobs, namely the first ten (in order of release time), the first twenty, and so forth. Results on other problems we have examined are similar. In particular, we found that the computation time depends primarily on the width of the time windows, regardless of the problem solved. Release times were obtained from the production schedule, but no deadlines were given. Because of the sensitivity of computation time to time windows, we initially set the deadline of each job to be 40 minutes after each release time, with the expectation that these may have to be relaxed to obtain a feasible solution. 14 Table 2: Computational results for subsets of the 60-job problem. Jobs 10 20 30 40 50 60 Time window (mins) 40 40 40 40 40 95 Computation time (sec) 6.8 7.6 15.8 16.7 18.8 48.1 We divided the 108.5-meter track into ten equal segments, so that each distance unit represents 10.85 meters. Each crane can traverse the length of the track in about one minute. Because we want the crane to move one distance unit for each time unit, we set the time unit at six seconds. The 60-job schedule requires about four hours to complete, which means that the dynamic programming procedure has about Tmax = 2400 time stages. Table 2 shows computation times obtained on a desktop PC running Windows XP with a Pentium D processor 820 (2.8 GHz). The assignment and sequencing of jobs used in each instance is the best one that was obtained by a heuristic procedure. Feasible solutions were found for all the instances except the full 60-job problem. To obtain a feasible solution of this problem, we enlarged the time windows from 40 to 95 minutes by postponing the deadlines. This illustrates the combinatorial nature of the problem, because the addition of only ten jobs created new bottlenecks that delayed at least one job nearly 95 minutes beyond its release time. Wider time windows result in a larger state space and thus greater computation time. Nonetheless, the 60-job problem with 95-minute windows was solved in well under a minute. The optimal trajectories for two selected instances appear in Figs. 3 and 4. The horizontal axis represents distance along the track in 10.85-meter units. The vertical axis represents time in 6-second units. Thus the schedule for the 30-job problem spans about 1350 time units, or 135 minutes. The space-time trajectory of the left crane appears as a solid line, and as a dashed line for the right crane. The left crane begins and ends at the leftmost position, and analogously for the right crane. Note that the cranes are at rest most of the time. The trajectories are canonical trajectories as defined above, which ensures a certain consistency in the way the two cranes interact. The number of states was always less than 500 for the 10-job instance, less than 1000 for 30 jobs, and less than 2000 for 60 jobs—even though the theoretical maximum is astronomical. Figure 5 tracks the evolution of state space size over time for the 60-job problem. The horizontal axis corresponds to time stages, which again are separated by six seconds. The vertical axis is the number of states at each time stage. 15 450 ’output/solution-time-LEFT.out’ ’output/solution-time-RIGHT.out’ 400 350 300 250 200 150 100 50 0 0 2 4 6 8 10 Figure 3: Optimal solution of the 10-job instance. Typically, only a few time windows must be wide to allow a feasible solution, because only a few jobs must be delayed. Yet it is difficult or impossible to predict which are the critical jobs. It is therefore necessary to be able to solve problems in which all of the time windows are wide, perhaps on the order of 90 minutes as in the 60-job instance. It was to accommodate wide time windows that we developed the state space reduction techniques of Section 6. Table 3 reveals the critical importance of these techniques. For each of the three problem instances, the table shows the average time and state space size required to compute the optimal trajectories for ten different job assignments and sequencings. Without the state space reduction technique, the dynamic programming algorithm could scale up to only 30 jobs, and even then only for narrow time windows. The time windows were reduced to make the problem tractable without state space reduction, while still maintaining feasibility. State space reduction cuts the peak number of states, and therefore the memory requirements, by a factor of 20 or more. It reduces the computation time by a factor of ten. The advantage is doubtless even greater for larger instances. 8 Conclusions and Future Research We presented a specialized dynamic programming algorithm that computes optimal space-time trajectories for two interacting factory cranes. The state space is economically represented in such a way that medium-sized problems can be solved to optimality. The technique is useful both for solving a signifi16 1600 ’output/solution-time-LEFT.out’ ’output/solution-time-RIGHT.out’ 1400 1200 1000 800 600 400 200 0 0 2 4 6 8 10 Figure 4: Optimal solution of the 30-job instance. 2000 ’output/statecount.out’ 1800 1600 1400 1200 1000 800 600 400 200 0 0 500 1000 1500 2000 2500 Figure 5: Evolution of the state space size for the 60-job instance. 17 Table 3: Effect of state space reduction on state space size and computation time. Each instance is solved for 10 different jobs assignments and sequencings. “Before” and “after” refer to results before and after state space reduction, respectively. Jobs Time window (min) 10 20 30 25 35 35 Avg number of states Before After 3224 3200 3204 139 144 216 Peak number of states Before After Average time (sec) Before After 9,477 22,204 22,204 15.8 82.6 143.8 465 927 940 2.0 8.6 15.0 cant number of practical problems and as a benchmarking and calibration tool for heuristic methods that solve larger problems. The dynamic programming model accommodates a wide variety of constraints that often arise in this type of problem. We also proved structural theorems to show that only certain types of trajectories need be considered to obtain an optimal solution. This not only accelerates solution of the problem but simplifies the operation of the cranes by restricting their movements to certain patterns. An obvious direction for future research is to attempt to generalize the structural results to three or more cranes. Another useful research program would be a systematic empirical comparison of heuristic methods with the exact algorithm described here to determine how best to design and tune a heuristic algorithm. References [1] R. Armstrong, L. Lei, and S. Gu. A bounding scheme for deriving the minimal cycle time of a single-transporter N-stage process with time-window constraints. European Journal of Operational Research, 78:130–140, 1994. [2] A. Che and C. Chu. Single-track multi-hoist scheduling problem: A collision-free resolution based on a branch-and-bound approach. International Journal of Production Research, 42:2435–2456, 2004. [3] C. F. Daganzo. The crane scheduling problem. Transportation Research Part B, 23:159–175, 1989. [4] K. H. Kim and Y.-M. Park. A crane scheduling method for port container terminals. European Journal of Operational Research, 156:752–768, 2004. [5] L. Lei, R. Armstrong, and S. Gu. Minimizing the fleet size with dependent time-window and single-track constraints. Operations Research Letters, 14:91–98, 1993. 18 [6] L. Lei and T. J. Wang. A proof: The cyclic hoist scheduling problem is NP-complete. Working paper, Rutgers University, 1989. [7] L. Lei and T. J. Wang. The minimum common-cycle algorithm for cycle scheduling of two material handling hoists with time window constraints. Management Science, 37:1629–1639, 1991. [8] J. Leung and E. Levner. An efficient algorithm for multi-hoist cyclic scheduling with fixed processing times. Operations Research Letters, 34:465–472, 2006. [9] J. Leung and G. Zhang. Optimal cyclic scheduling for printed circuit board production lines with multiple hoists and general processing sequence. IEEE Transactions on Robotics and Automation, 19:480–484, 2003. [10] J. M. Y. Leung, G. Zhang, X. Yang, R. Mak, and K. Lam. Optimal cyclic multi-hoist scheduling: A mixed integer programming approach. Operations Research, 52:965–976, 2004. [11] R. W. Lieberman and I. B. Turksen. Two operation crane scheduling problems. IIE Transactions, 14:147–155, 1982. [12] J. Liu, Y. Jiang, and Z. Zhou. Cyclic scheduling of a single hoist in extended electroplating lines: A comprehensive integer programming solution. IIE Transactions, 34:905–914, 2002. [13] M.-A. Manier and C. Bloch. A classification for hoist schedling problems. International Journal of Flexible Manufacturing Systems, 15:37–55, 2003. [14] M.-A. Manier, C. Varnier, and P. Baptiste. Constraint-base model for the cyclic multi-hoists scheduling problem. Production Planning and Control, 11:244–257, 2000. [15] L. Mocchia, J.-F. Cordeau, M. Gaudioso, and G. Laporte. A branch-andcut algorithm for the quay crane scheduling problem in a container terminal. Naval Research Logistics, 53:45–59, 2005. [16] W. C. Ng. Crane scheduling in container yards with inter-crane interference. European Journal of Operational Research, 164:64–78, 2005. [17] L. W. Phillips and P. S. Unger. Mathematical programming solution of a hoist scheduling problem. AIIE Transactions, 8:219–321, 1976. [18] D. Riera and N. Yorke-Smith. An improved hybrid model for the generic hoist scheduling problem. Annals of Operations Research, 115:173–191, 2002. [19] R. Rodošek and M. Wallace. A generic model and hybrid algorithm for hoist scheduling problems. In M. Maher and J.-F. Puget, editors, Principle and Practice of Constraint Programming (CP 1998), volume 1520, Pisa, 1998. Springer. 19 [20] C. Varnier, A. Bachelu, and P. Baptiste. Resolution of the cyclic multihoists scheduling problem with overlapping partitions. INFOR, 35:309–324, 1997. [21] G. Yang, D. P. Ju, W. M. Zheng, and K. Lam. Solving multiple hoist scheduling problems by use of simulated annealing. Transportation Research Part B, 36:537–555, 2001. [22] C. Zhang, Y.-W. Wan, J. Liu, and R. J. Linn. Dynamic crane deployment in container storage yards. Ruan Jian Xue Bao (Journal of Software), 12:11–17, 2002. [23] Z. Zhou and L. Li. A solution for cyclic scheduling of multi-hoists without overlapping. Annals of Operations Research, (online), 2008. 20