Comb Opt 3: Scheduling Problems

Packages Used: No new packages are used in this notebook.

1. Heuristic Effectiveness

The effectiveness of a heuristic can be measured by comparing the result obtained from the heuristic to an equal number of brute force evaluations. Using the QAP considered in Comb Opt 2, a larger instance (n = 25) is randomly generated. Both the W and D generated are not non-symmetric and have zeros along their main diagonals.

Random QAP Instance

Since each element of W and D ranges from 0 to 1, an upper bound on the solution would correspond to the case where all of the elements of each matrix are at 1:

The TC of the expected random solution would correspond to each element of W and D being equal to 0.5:

Multistart SDPI Solution

Brute-Force Solution

In order to make a brute-force solution commensurate with the heuristic solution, the number of times the cost of a solution was evaluated in sdpi (i.e., TC was calculated) was output as cnt. This number of random solutions was then evaluated:

2. Scheduling Decisions

Scheduling decisions involve both (1) the allocation of tasks to resources and (2) determining, for each resource, the sequence in which its allocated tasks should occur. Unlike bin packing, the number of resources (bins) is predetermined, and unlike QAP, a resource (cf. site) can be allocated (cf. assigned) more than one task. If there is only a single resource, then only the sequencing decision needs to be determined; for multiple resources, if all of the tasks are independent of each other and do not have due dates or priorities, then only the allocation decision needs to be made.

Ex 1: Independent Jobs on Parallel Identical Machines

Given three identical machines (resources) and eight independent jobs (tasks) 1 to 8 that each take 1 to 8 units of time to complete, respectively, determine how the jobs should be allocated to the machines so that all processing is completed as soon as possible (i.e., minimize the makespan). Once processing starts on a machine, a job cannot be preempted.

With preemption, it is easy to determine an optimal allocation by just filling each resource in sequence, and when a task exceeds the lower bound, stop processing at that point, move the preempted task to the beginning of processing on the current resource, and then allocate the remaining processing later on a different resource. Without preemption, it may not be possible to reach the LB.

For this simple problem instance, an optimal solution can be generated by just pairing tasks on each machine so that they total the LB:

An array comprehension can be used to determine the total time on each resource, and then taking the maximum gives the makespan:

Brute Force

The number of ways that n distinguishable balls can be placed into m indistinguishable cells can be determined using the Stirling number of the second kind:

$ \begin{eqnarray} \quad \left\{{n \atop m}\right\} = \frac {1}{m!} \sum _{i=0}^{m}(-1)^{i}{\binom {m}{i}}(m-i)^{n} \implies \left\{{8 \atop 3}\right\} = 966. \end{eqnarray}$

Even for moderately size problem instances, the number of possible solutions makes any type of brute force approach infeasible:

Random Construction Procedure

A simple approach to randomly generating an allocation array is to randomly generate integers between 1 and m:

In the above, if the maximum index in the allocation array does not include m, then the array is regenerated. This is to ensure that only the array is needed to create m resources. As a result, only a is needed to create an m-element array T listing the times of the tasks allocated to each resource (any unallocated resources less than m are not a problem since they would just result in an empty task-index array being created in T):

The total time on each resource can then be determined. Since the makespan will be used in the improvement heuristics, it can be defined as the one-line function makespan that determines the makespan directly from the allocation vector without the creation of the m-element array T. In makespan, the maximum element in the allocation array a is used as the upper limit to search for matches:

The following function is used to display the total time concatenated with the task times allocated to each resource:

Relocate Improvement Procedure

A simple heuristic that can be applied to improve the solution is to relocate a task from one resource to another if it results in a decrease in makespan (e.g., moving any task from resource 1 to resource 3 reduces the makespan from 16 to 15); continuing to consider relocations until there is no improvement and makespan. This is the idea of the following relocate improvement heuristics:

SDPI Improvement Procedure

Another simple improvement procedure is to consider pairwise interchanges, similar to what was done for the QAP:

Not unsurprisingly, in this case, there was no improvement with pairwise interchanges. This was due to their being two resources with total times equal to the makespan; in this case, there is no way of reducing makespan because an interchange between these two resources would, at best, not change and, more likely, increase the makespan. Interchanges between only one of these two resources and any other resource could reduce its total time but would not reduce the makespan because the total time on the other resource would not change.

Constructing a different random solution and then applying the relocate heuristic finds, by chance, the global optimal solution:

Equal-Number Construction Procedure

Another construction procedure is to try to allocate an equal number of tasks to each resource in order to avoid, as was seen in just randomly allocating tasks, having one resource with significantly larger numbers of tasks allocated to it. First, the tasks are randomly reordered:

Then, a sequence of m task is then allocated to each resource:

In order to see how the indices of each sequence is determined, the following code just outputs the indices (note: min(i*step,n) is used so that the final ending index does not exceed n):

The relocation and pairwise improvement heuristics are then applied to the constructed solution:

Ex 2: Repair Shop Scheduling

A repair shop has four identical stations available. Today, 10, 7, 4, 2, 9, 8, 4, and 10 repairs will be performed for each of eight different types of repair, where each type takes, on average, 53, 20, 53, 15, 30, 55, 32, and 21 minutes, respectively. Determine a lower bound on the maximum time that it will take to complete all of the repairs, assuming that it takes five minutes to switch between each repair at the station no matter the type of repair or the type of the preceding repair.

MILP Formulation

MILP formulation of schedule independent tasks on parallel identical resources without preemption to minimize makespan problem:

$ \begin{eqnarray} \quad \mbox{Minimize} \quad y \\ \quad \mbox{subject to} \quad y &\ge& \sum_{i \in N} t_i x_{ij}, &\quad j \in M \\ \sum_{j \in M} x_{ij} &=& 1, &\quad i \in N \\ y &\ge& 0 \\ x_{ij} &\in& \bigl\{ 0, 1 \bigr\}, \end{eqnarray} $

where

$ \begin{eqnarray} \quad y &=& \mbox{makespan} \\ x_{ij} &=& \begin{cases} 1, & \mbox{if task } i \mbox{ is allocated to resource } j \\ 0, & \mbox{otherwise} \end{cases} \\ M &=& \bigl\{ 1, \dots, m \bigr\}, \quad \mbox{set of } m \mbox{ resources} \\ N &=& \bigl\{ 1, \dots, n \bigr\}, \quad \mbox{set of } n \mbox{ tasks} \\ \end{eqnarray} $