The special-time-constrained RCPSP enforces critical barriers when scheduling special activities. We propose a tailored priority-based heuristic algorithm and a hybrid genetic algorithm to tackle it.
3.2. Hybrid Genetic Algorithm
Hartmann [
25] proposed an effective genetic algorithm for RCPSP. We have borrowed the principles of this algorithm, and further designed specific crossover operators for forbidden time windows, as well as adopting double justification and elite selection strategy. Our hybrid genetic algorithm could provide final solutions of an improved quality.
The Algorithm 1 proceeds as follows.
Algorithm 1: Hybrid genetic algorithm |
Step 1; initialization: define popsize, Gen, and Pm
|
Step 2; initiate population pop
|
Step 3; double-justify chromosomes in pop
|
Step 4; calculate fitness of each individual
|
Step 5; select parent
|
Step 6; use the crossover operator for forbidden time windows
|
Step 7; exert exchange mutilation
|
Step 8; generate new population
|
If the maximum number of iterations are reached end the algorithm
|
otherwise
|
go to Step 3.
|
First, the algorithm sets that the initial population contains popsize individuals: where popsize is an even integer, Gen is the number of iterations, and Pm is the mutation probability. Second, it deploys a simple and effective local search strategy, double justification, to adjust the chromosomes, as illustrated in the following content, and then calculates fitness for each individual. Third, it uses the crossover operator designed specifically for forbidden time windows (as explained in
Section 3) to generate two new offspring, and mutates them. Thus, the population is enlarged to a size of 2·popsize. Finally, the algorithm sorts the chromosomes and selects the best ones, such that a new population is generated with a size of popsize. This procedure is repeated until Gen is reached or the prescribed CPU time is up.
- (1)
Initial population and fitness function
The proposed algorithm deploys a precedence feasible activity list to represent activity priorities. This activity list can be used to generate a possible solution using serial SGS. Differing from Hartmann’s method, SGS here must take forbidden time windows into account. Some of the solutions in the initial population are randomly assigned, and others are selected from the results of a classic priority-based heuristic algorithm, as mentioned earlier.
Fitness function chooses the highest fitness; thus, the minimum optimized goal has to be transformed to fitness function as
where
Fmax represents the maximum duration of individual
i in the latest five generations and
Si the solution resulting from the decoding individual
i, that is, the optimized goal.
- (2)
Double justification
Many scholars have appropriated local search operators in genetic approaches and obtained better schedules. We borrowed a double justification operator to improve the quality of the final results. Thanks to its simplicity, fast speed, and effectiveness, it is convenient to be applied to RCPSP [
26,
27].
Definition 1. An active (or left active) schedule is a solution where no activity can be executed in advance without delaying any other activities or violating any rules. Similarly, a right active schedule is one where no activity can be postponed without delaying any other activities, violating any rules, or extending the total makespan.
Definition 2. A justification procedure refers to that given a schedule S, after the right (left) justification of an activity
, S becomes a new schedule of S′ where si′ = si, ij; s′j
sj (s′j
sj), and s′j is as large/small as possible. The procedure is to start activity j as late (early) as possible while the other activities’ starting times remain unchanged.
The double justification of a schedule follows a specific agenda. First, all the activities are sorted in a descending order of their ending times. Second, each activity is justified to the right and the latest completing time of each activity is obtained. The latest completing time of an activity refers to the point that is right before the earliest starting time of its immediate successors and the latest of the time intervals that feed all the recourse constraints. Third, each activity is justified to the left, and all the activities are sorted in an ascending order of their starting times. Fourth, each activity is arranged on its earliest starting time point, such that precedence and recourse constraints are both satisfied. When the procedure is completed, a solution that is no worse than the original one is obtained.
- (3)
Crossover operators for forbidden time windows
For the proposed time-bound RCPSP model, schedules that accommodate vacant forbidden time windows, meaning no activity is undertaken during those time intervals, must be less efficient than those where all the forbidden time windows are filled with activities. Therefore, to obtain a minimized makespan, we design a crossover operator for forbidden time windows, inspired by the peak crossover operator in Valls et al.’s [
18] algorithm. Given a schedule
S, [
U1,
U2] represents a forbidden time window, and SA(
u) the set of activities being executed during [
U1,
U2], such that
. Thus, the resource utilization ratio (RUR) of schedule
S during the special time interval [
U1,
U2] can be described as:
If RUR(u) is higher than a threshold δ, say 0.7, we can claim that schedule S holds a high RUR during a certain time interval. Let λ be the list of activities that could be executed during a certain special time interval, such that λ = (jp, jp+1, …, jq), and λ could be vacant.
Then, the crossover operator for the forbidden time windows can be used in the following matter. Suppose there are two individuals F, M. If RURs of F and M are both lower than
δ, one-point crossover is employed to obtain their off-springs; if either RUR of F or M is higher than
δ, two-point crossover is deployed and the two switch points are the starting time and the ending time of each individual, as explained in
Figure 4.
It seems that the crossover operator for forbidden time windows is highly related to activities’ RURs during special time intervals. If the RUR of the parent is high, the two-point operator can ensure that this high RUR is passed on to its offspring; if RURs of the parents are below the threshold, the one-point operator can facilitate diversity among the offspring.
- (4)
Mutation and selection
We applied exchange mutation to the precedence feasible activity list, that is, we randomly selected two genes and switched them according to a mutation probability; if the mutation violated precedence constraints, the two genes were restored back. We also incorporated elite strategy in the selection to guarantee that the best chromosomes would be directly replicated in the next generation. Here the probability of selecting elites is defined as