Relocation Scheduling in a Two-Machine Flow Shop with Resource Recycling Operations

: This paper considers a variant of the relocation problem, which is formulated from an urban renewal project. There is a set of jobs to be processed in a two-machine ﬂow shop subject to a given initial resource level. Each job consumes some units of the resource to start its processing on machine 1 and will return some amount of the resource when it is completed on machine 2. The amount of resource released by a job is not necessarily equal to the amount of resource acquired by the job for starting the process. Subject to the resource constraint, the problem is to ﬁnd a feasible schedule whose makespan is minimum. In this paper, we ﬁrst prove the NP-hardness of two special cases. Two heuristic algorithms with different processing characteristics, permutation and non-permutation, are designed to construct feasible schedules. Ant colony optimization (ACO) algorithms are also proposed to produce approximate solutions. We design and conduct computational experiments to appraise the performances of the proposed algorithms.


Introduction
Scheduling is a decision-making process that allocates limited resources to tasks in a given time period to optimize certain objectives in manufacturing as well as service industries [1]. Usually, resources are considered as machines that process the assigned tasks in manufacturing industries. In some scheduling contexts, there could be different extra resources, like capital, crews and technicians, storage space, energy, computer memory, and so on, that are required to support the execution of the tasks. Such scheduling problems are known as resource-constrained scheduling. Resource-constrained project scheduling problems (RCPSP) have received considerable attention for decades. Please refer to Brucker, Drexl, Möhring, Neumann, and Pesch [2], Habibi, Barzinpour, and Sadjadi [3] Herroelen, De Reyck, and Demeulemeester [4], Issa and Tu [5] for comprehensive reviews on RCPSP. The resource constraint featured in the relocation problem is different traditional ones in the sense that the amount of resource released by an activity is not necessarily the same as that acquired for commencing the activity. This study investigates the relocation problem in a two-machine flow shop with the specific feature of a resource recycling mechanism.
The construction industry have various optimization decisions to address in the project course [6,7]. The relocation problem originated from the public house redevelopment project in Boston [8,9]. The project had a set of buildings to be torn down and erected for redevelopment. During the redevelopment process, current tenants of the buildings under reconstruction needed to be relocated to temporary housing units. They could be assigned to new housing units. It was not mandatory for tenants to reside at the same place they lived before. Therefore, the authority had to determine a minimum budget of temporary housing units such that all tenants could be successfully relocated. Kaplan [8] first formulated the relocation problem of determining a feasible redevelopment sequence of the buildings with the initial budget. In the view of optimization, this problem can also be described as finding a feasible sequence of the redevelopment buildings that reflects the minimum initial budget. Kaplan and Amir [10] showed that the relocation problem is mathematically equivalent to the two-machine flow shop scheduling problem for minimizing makespan, implying that the basic relocation problem can be solved by the classical Johnson's algorithm [11].
Lin and Huang [12] first introduced the recycling operations for yielding the resource into the study on the relocation problem. In previous studies on the relocation problem, the resource is consumed when a job starts to process and returns immediately when it is completed. However, the concept of the resource recycling is assumed that we need to have a mechanism or procedure to recycle the resource before the resource can be used for later jobs. Therefore, a job is divided into two separate parts on two dedicated machines: one processed on machine 1 and the other for recycling the resource on machine 2. The operations on machine 1 should have sufficient resource so that they can commence the processing, and the operations on machine 2 should wait for the completion of its corresponding counterpart operations jobs on machine 1. However, the job sequences on the two machines are not necessarily the same. Cheng, Lin and Huang [13] presented an integer linear program formulation for the permutation case, in which the job sequences on all machines are the same. They also investigated the non-permutation case. We continue to study this relocation problem and discuss more theoretical proofs. Then, we present heuristic algorithms and ant colony optimization (ACO) algorithms for both permutation and non-permutation sequences to find feasible schedules with resource constraints for minimum makespan.
The rest of this paper is organised as follows. In Section 2, we present problem statements and give a numerical example followed by a literature review. The complexity results of two special cases are discussed in Section 3. In Sections 4 and 5, we present heuristic algorithms and ant colony optimization algorithms for constructing approximate schedules. Computational experiments and performance statics of the algorithms are given in Section 6. We conclude this search and suggest research directions for future study in Section 7.

Problem Definition
In this section, we first introduce the notation that will be used throughout our research. Then, a formal problem formulation follows. An integer programming model is also proposed. The notations are listed below: Notation: N = {1, 2, . . . , n} set of jobs to be processed; p 1,j processing time of job j on machine 1; p 2,j processing time of job j on machine 2; α j resource requirement of job j; β j amount of the resource returned by job j; σ = (σ 1 , σ 2 , . . . , σ n ) a particular sequence of the jobs (assumed for the case of permutation schedules); v 0 initial resource level; v t resource level at time t ≥ 0; C m,j completion time of job j on machine m, m = 1, 2.
We formally state the problem as follows: From time zero onwards, a set of jobs N = {1, 2, . . . , n} is available to be processed in a two-stage flow shop consisting of machine 1 and machine 2. Initially, the common resource pool contains v 0 units of a single type of resource. Job j ∈ N can start processing only if machine 1 is not occupied and the resource level is larger than or equal to α j . When job j starts processing, it immediately consumes α j units of the resource and takes p 1j units of time on machine 1. After the operation on machine 1 is completed, p 2j units of time are required to complete its resource recycling operation on machine 2. When job j completes on machine 2, it produces and returns β j units of the resource back to the resource pool. No preemption on either machine is permitted. Note that there is no strict relation between α j and β j . That is, β j could be smaller than, equal to, or larger than α j . The goal is to minimize the makespan. In other words, we want to find a feasible schedule that completes all jobs in the shortest time.
To illustrate the problem definition, we consider an instance of four jobs with an initial resource level v 0 = 6. The parameters are shown below in Table 1. We construct two example schedules.  Figure 1 shows an optimal permutation solution with C max = 22, and Figure 2 shows an optimal non-permutation solution with C max = 19. Both of them are feasible. In this example, it is clear that the non-permutation solution can attain a better makespan than the permutation one.

Literature Review
To describe our problem, we denote use the standard three-field notation F2|rp|C max , proposed by Graham et al. [14]. The first field indicates the machine environment of a two-machine flow shop, where the first machine is the operation of the building being torn down and the second machine is about re-constructing buildings corresponding to resource recycling operations. The second field indicates that the specific conditions for the job characteristics, i.e., the relocation problem. The last field specifies the objective function of makespan.
The study on the relocation problem was inaugurated by Kaplan [8] in 1986. The fundamental purpose of the basic relocation problem is to minimize the initial budget required for guaranteeing project feasibility. In Kaplan's study, multiple working crews were considered that if resources were sufficient, i.e., a number of buildings could be simultaneously developed. Kaplan and Amir [10] formulated the application of relocation problem as an integer program. They also noted the relationship between the minimum budget in relocation feasibility and the minimum makespan of two-machine flow shop scheduling, which is solvable in O(n log n) time [11]. To reflect real situations of the housing redevelopment project in East Boston, Kaplan, and Berman [15] refined the integer programming model and scheduling heuristics. Applications like the financial constraints on single machine scheduling problems [16] which can be reduced to the two-machine flow shop scheduling problem as a special case of the relocation problem. The relocation problem is also related to the memory management issue in database system in practical term [17]. Amir and Kaplan [17] showed that minimizing the makespan on parallel machines is NP-hard. Kononov and Lin [18] proved that parallel-machine setting is strongly NP-hard even if there are only two working crews and all jobs have the same processing time. They also designed approximation algorithms with performance ratio analysis for two special cases.
Cheng and Lin [19] presented more proofs and proposed the concept of composite jobs that can reduce the computational time for handling the relocation problem. Cheng and Lin [20] also demonstrated the concept of relocation scheduling to give an economic interpretation of Johnson's algorithm. The concept can also simplify proofs and reduce time complexity in some two-machine flow shop scheduling problems. There are other extensions from the relocation problem. Lin and Tseng [21] considered the problem with processing times and deadline constraints. Furthermore, they provided a complexity result and two polynomial algorithms to solve the restricted problems. Lin and Tseng [22] proposed a branch-and-bound algorithm to maximize the resource level under a specified due date and considered the precedence constraints [23] that is NP-hard even if the precedence constraints are specified by a bi-partite graph. Lin and Cheng [24] showed two relocation problems of minimizing the maximum tardiness is strongly NP-hard and of minimizing the number of tardy jobs under a due date is NP-hard even when all the jobs have an equal tardy weight and resource requirement. Based on the generalized due dates proposed by Hall [25], Lin and Liu [26] extended the scheduling problem and designed a branch-and-bound algorithm to reduce the computational time required. Sevastyanov, Lin and Huang [27] considered the relocation problem with arbitrary release dates. They developed a multi-parametric dynamic programming algorithm to solve the case with a fixed number if distinct due release dates and analyzed complexity of different problem settings. Kononov and Lin [28] considered minimizing the total weighted completion time and proved four special cases are strong NP-hardness. They established the equivalence between the UET (unit-execution-time) case and the unit-weighted case and presented a 2-approximation algorithm for the restricted special cases.
As per the feature of resource recycling in the relocation problem, there are some existing works. Lin and Huang [12] first introduced the concept of resource recycling. This operation can be processed on a secondary recycling machine that the whole procession can be described as a two-machine flow shop scheduling problem. In this paper, they showed that it is NP-hard and designed three heuristic algorithms to compose approximate schedules. Problem formulation and some complexity results were discussed in Cheng, Lin and Huang [13]. They presented integer linear programming models for finding the feasible permutation sequence and non-permutation sequence with minimum makespan. Lin [29] considered the setting where processing and recycling are carried out on the same single machine. The problem is a generalization of the knapsack problem. He designed a pseudo-polynomial time dynamic programming algorithm and formulated an integer program to solve this recycling problem that operations are processed on the same single machine.

Complexity Analysis
This section is dedicated to discussion of the complexity results of the problem of several special cases. First, let instance I contain n jobs with p 1,j , p 2,j , α j , and β j given for each job j and an initial resource level v 0 . We create another instanceĪ having n jobs with p 1,j = p 2,j , p 2,j = p 1,j , α j = β j , and β j = α j that is symmetric to the instance I. Set the initial We claim that the two instances have the optimal makespan. The concept follows the results of Kononov and Lin [28]. Proof. Let σ = (σ(1), σ(2), . . . , σ(n)) be a feasible permutation of jobs in the given instance I case. We show that σ = (σ(n), σ(n − 1), . . . , σ(1)) is feasible forĪ we created in the above. Assume V k is the resource level after the jobs σ(n), . . . , σ(k + 1) in σ complete. We The last inequality is feasible with the schedule σ. Therefore, we can get V k ≥ α σ(k) , which shows the schedule σ is feasible. As we know the schedule σ and σ are two-stage flow shop, if their sequences are reversed, they have same processing time. Therefore, we can construct another optimal schedule if we get an optimal one. For n jobs, there are (n!) possible sequences when the permutation schedules are considered. If we consider the non-permutation variant, the number of schedules will become O(n! × n!) because the permutations on the two machines could be different. For technical constraints or dispatching fairness, say first comes first served, the processing sequence could be given and fixed [30,31]. In view of implementations, if an optimal schedule can be efficiently obtained from a given job sequence on either machine, we can then reduce the decision tree size from O(n! × n!) to O(n!). This section will explore the complexity status of the setting with a fixed job sequence.
First, we prove the problems that when the sequence of the jobs on machine 2 is given and fixed, finding the optimal schedule is strongly NP-hard, even if all jobs have the same processing time on machine 2. On the other hand, if the given and fixed sequence of the jobs is on machine 1, we can get the same result that finding optimal schedules is also strongly NP-hard. The proof is given in the following: 3-Partition: Given an integer B and a set A of 3q elements {1, 2, . . . , 3q}, each j ∈ A has a size x j , Theorem 2. If a sequence of the jobs on machine 2 is given and fixed, then finding an optimal schedule is strongly NP-hard, even if all jobs have the same processing time on machine 2.
The the initial resource level v 0 = 3B. The jobs on machine 2 are sequenced in increasing order of their indices. We claim that there is a 3-Partition if there is a feasible schedule whose makespan is no greater than (4q + 1)B.
Assume that there exists a desired partition A 1 , A 2 , . . . , A q of 3-Partition. Because the total actual processing length on machine 2 is (4q + 1)B, we know that no idle time on machine 2 is permitted. Then, we schedule the enforcer job 1 on machine one first followed by the the ordinary jobs corresponding to the three elements of A 1 and the resource level is brought back to 3B. Repeat the dispatching pattern and then schedule the last job. It is to see that the schedule is feasible and the makespan is exactly (4q + 1)B.
Assume that there is a feasible schedule whose makespan is no larger than (4q + 1)B. The total actual processing length on machine 2 of all jobs is (4q + 1)B. There is no idle time on machine 2. On the other hand, the total actual processing length on machine 1 is 4qB. Considering the subsequent operations on machine 2, no idle time is allowed on machine 1. In other words, machine 1 and machine 2 cannot have any idle time in order to attain the makespan (4q + 1)B. As given, machine 2 processes the enforcer jobs 1, 2, . . . , q as in their indices. Since all enforcer jobs have the same parameter values, without loss of generality we assume that the enforcer jobs also follow the same processing order on machine 1.
We first note that job 1 should start first on machine 1 for otherwise non-zero idle time will be incurred on machine 2. After completing job 1 on machine 1, the resource level drops from 3B to B. To start the next enforcer job 2, machine 1 wait for the previous enforcer job 1 to be completed to accumulate sufficient resources. To avoid the idle time between the first and second enforcer jobs on machine 1, we assign ordinary jobs to fill up the idle period. Let A 1 be the set of elements defining these ordinary jobs. If ∑ x j ∈A 1 x j < B, then there is an idle time before job 2 on machine 1. On the other hand, if ∑ x j ∈A 1 x j > B, then the resource is insufficient and the completion time of some ordinary jobs are later than the second enforcer job, leading to the idle time on machine two. As the result, ∑ x j ∈A 1 x j = B must hold. Continuing this process, we can find subsets A 2 , . . . , A n with ∑ x j ∈A l x j = B, 2 ≤ l ≤ q, satisfied for the 3-Partition problem. Figure 3 shows the sequence of the optimal schedule: the purple blocks are enforcer jobs, the red ones are ordinary jobs, and the blue ones are final job. Theorems 1 and 2 together imply the following result.
Theorem 3. If a sequence of the jobs on machine 1 is given and fixed, then finding an optimal schedule is strongly NP-hard, even if all jobs have the same processing time on machine 2.
Proof. Owing to Theorems 1 and 2, we can get the feasibility of a given and fixed sequence of the jobs on machine 1 whose optimal schedule is strongly NP-hard. On the other hand, the idle time before job 1 on machine 2 is inevitable and the total actual processing length is (4q + 1)B. Furthermore, the sequence of Theorem 2 whose jobs on machine 2 is given and fixed, if we reverse this two-stage flow shop sequence, we can get the given and fixed sequence of the jobs on machine 1 which is equivalent to Theorem 3. It can seen that Figure  4 is derived form Figure 3 by reversing the Gantt chart from the right. As a result, the sequences of Theorem 2 and Theorem 3 have same total processing time. Then, we get the optimal schedule.  Proof. Assume that there is a feasible schedule whose sequences of the jobs on machine 1 and machine 2 are given and fixed. We schedule the first job on machine 1 followed by the first job on machine 2. If the resource of second job on machine 1 is insufficient, it should wait for previous job which on machine 2 to return the resource. Otherwise, it can be processed immediately when the previous job finished. Then, the job on machine 2 starts when the job on machine 1 completed. Continuing this process, we can schedule all the jobs and the makespan is minimum. On the other hand, if the job on machine 2 return resource is not enough for the next job to be processed, we can know that this sequence is not feasible. As a result, we can get an optimal schedule if sequences of the jobs on machine 1 and machine 2 are given and fixed.
To simplify the problem, we consider the special case where processing sequences on both machines are given. By problem definition, the two sequences are not necessarily the same. For simplicity in presentation, we re-index the jobs to follow the natural sequence π 1 = (π 1,1 , π 1,2 , . . . , π 1,n ) on machine 1. Let π 2 = (π 2,1 , π 2,2 , . . . , π 2,n ) denote the sequence on machine 2 and v(t) the resource level at a specific time point t. Notations t 1 and t 2 represent the current time points on machines 1 and 2. Note that if an operation whichever finished on machine 1 or machine 2 and another operation starts on next machine simultaneously at time t, we define v(t) as the resource level after the finished operation on one machine and before the starting operation on the other machine. We will use this method, outlined in Algorithm 1, to calculate makespan for the problem.
Algorithm 1: Two Sequences 1 Let π 1 = (π 1,1 , π 1,2 , . . . , π 1,n ) and π 2 = (π 2,1 , π 2,2 , . . . , π 2,n ) be the given processing sequences; 2 t 1,π 1,1 = p 1,π 1,1 ; t 1 = t 1,π 1,1 ; 12 if job π 1,j is not yet scheduled on machine 1 then 13 Report "No feasible solution!"; 14 else 15 t 2 = max{t 1,π 1,j , t 2 } + p 2,π 2,j ; In Algorithm 1, the first job of the sequence on machine 1 is processed first and there should be sufficient resource for it to start. Therefore, the first time point t 1,1 is the processing time of job 1 on machine 1, which is also t 1 , and v(t 1 ) is the resource level when job 1 finishes. In Line 6 we check the resource if we can process the job i on machine 1 or not. If resource is insufficient for job i on machine 1, we execute Line 11 to Line 19 for processing some job j on machine 2 to collect more resource. In Line 12, we need to check if job π 1,j is scheduled first on machine 1 or not. Because we start to process jobs on machine 2 when the resource is not enough for machine 1, there may be several candidate jobs that can be processed on machine 2. Therefore, sometimes, t 2 is less than t 1 when the resource level is sufficient for the next job. In Lines 16 to 17, if t 2 is larger than t 1 , we need to set t 1 equal to t 2 , i.e., the next job on machine 1 should wait for the job on machine 2 to recycle its resource. When all the jobs on machine 1 finish, there are still some jobs on machine 2 not yet processed. As a result, we process the remaining jobs on machine 2 in the While loop of Line 20 to Line 22.

Heuristic Algorithms
Since the F2|rp|C max problem is computationally hard, it is hard to find optimal solutions when the problem size is large. We therefore design heuristic algorithms to produce approximate solutions in an acceptable time.

Permutation
We design two heuristic algorithms, using different sequences to construct feasible schedules for F2|rp|C max problem. If the job of the sequence does not violate the resource constraint, it must satisfy two conditions that the current resource level is sufficient for it, and that after its processing the resource level is sufficient for all remaining jobs. We denote the job sequence as σ and the remaining jobs sequenced by Johnson's rule using resource parameters α and β as σ JR . Recall that v 0 is the initial resource requirement using Johnson's rule, and V needed denotes the minimum resource requirement for the remaining jobs that the sequence is the same as σ JR excluding job j. If the job violates the constraints, we will remove it. Then, we can get a set of feasible jobs which are the candidates to be processed next. Algorithm 2 examines each of the remaining jobs to determine if they are feasible candidates for the next position. if v now − α j + β j < V needed or v now ≺ α j then 7 σ.remove(job j); 8 return σ; The first heuristic algorithm, JR-time Permutation Heuristic, is outlined in Algorithm 3. We define σ time as the remaining jobs sequenced by Johnson's rule using p 1,i and p 2,i and σ JR using α i and β i . Before a job is processed, we need to run CheckResource function for checking whether the job can be processed or not. Then, we append the job to the partial schedule σ. Repeat the same step until all the jobs are processed.
The second heuristic, JR-resource Permutation Heuristic, is the same as the previous one except that the job sequence is ordered by Johnson's rule using α i and β i .

Non-Permutation
We design two heuristic algorithms that construct non-permutation schedules for F2|rp|C max . Let σ 1 be the sequence of the jobs processed on machine 1, and σ 2 the job sequence on machine 2. Letσ 2 contain the jobs eligible for processing on machine 2. Algorithm 4 processes the jobs on machine 1 first. If a job satisfies the two constraints, it will be appended to the schedule. Since we want to construct a non-permutation schedule, we createσ 2 to collect the jobs which are finished on machine 1 but not yet on machine 2. When the resource level is insufficient for the candidate job, we need to process the jobs on machine 2 for acquiring more resource. Therefore, we choose the job that has the largest β inσ 2 to be processed first. However, this strategy may lead to an idle time when we only process the selected job. To avoid this situation, we first find the arrival time of the selected job that can be processed and we call it LargeBetaArrivalTime here. Then, check if the completion time of any other job is earlier than LargeBetaArrivalTime. Furthermore, we change the f raction such that 1 − f raction is the acceptable time range that exceeds LargeBetaArrivalTime.
In Line 14, if the acceptable completion time is earlier than LargeBetaArrivalTime, then it is appended to σ 2 and removed formσ 2 . This process iterates until all the jobs ofσ 2 are checked. After that, the job having the largest β is appended to σ 2 and removed form σ 2 . We repeat the above steps until all the jobs be processed and then we get a feasible non-permutation schedule.
The second heuristic, JR-time Non-Permutation Heuristic, is similar to the first one except for using p 1,i and p 2,i to arrange the job sequence.

Algorithm 4: JR-resource Non-Permutation Heuristic
1 Order the jobs by Johnson's rule using α i and β i .;

Ant Colony Optimization
In this section, we design an ACO algorithm to solve our problem. We will explain the framework and strategies of the algorithm for producing the approximate sequence.
State transition rule: In the ACO search process, each ant selects the next node to visit by calculating the preference for each path according to the pheromone intensity and heuristic visibility. In the proposed ACO algorithm, the preference P ij of an ant, positioned at node i, for selecting node j is defined as: where τ ij is the pheromone intensity on the link from node i to node j, and η ij the visibility value from node i to node j, and I the set of remaining admissible jobs to be processed. Parameters w τ and w η control the relative importance of τ ij and η ij . The greater a parameter is, the more influence of it to the preference value. In our design, the visibility value η ij is based on a greedy strategy. We prefer less processing times on both machines, less resource requirement, and larger amount of the resource returned by job for priority selection. Visibility value is defined as: We use preference values P ij for our exploration strategy. This method is just like the roulette wheel that every node, i.e., every job has their transition probability, based on which we select the next job randomly. Every node has a chance to be selected, even the probability is low.
Pheromone updating rule: After all the jobs are processed, we update the pheromone tails so that the ants can select their future paths according to previous experience. The trail intensity on link (i, j) is updated as below: where ρ represents the pheromone evaporation rate, and ∆τ ij the incremental pheromone between nodes i and j given as: In the above definition, Q is an adjustable parameter and C k the completion time of the last job on machine 2. This strategy is based on policy that the less C k is, the more pheromone on the path enhanced.
Stopping criterion: The proposed ACO algorithm assigns a colony of ants to probe their own sequences and set a maximum number of iterations. When all the ants complete their routes in one iteration, we select the minimum makespan, i.e., the elite, to be our current best solution. Then, we iterate the process until reaching the maximum number of iterations. If there is a better solution in iterations, this new solution will replace the current best one.
Permutation: To take into account the resource constraints on two machines, we only choose the job that would return the sufficient resource for the remaining jobs to be successfully processed. Therefore, we use the function CheckResource before ants select the next job and then enter the ACO algorithm to get the permutation sequence. This method is similar to JR Permutation Heuristic except that we use ACO to choose the job sequence.
Non-Permutation: For non-permutation sequences, we divide the algorithm into two parts. In the first part, we use the ACO algorithm to obtain the sequence on machine 1, similar as in Permutation. In second part, the difference form Permutation is when the resource is insufficient for the next job, we use the same method LargeBetaArrivalTime in JR-resource Non-Permutation Heuristic to select jobs to process on machine 2. Then, we can get a complete sequence and we use it to update the ACO algorithm. As a result, we can get the non-permutation sequence by ACO combined with the heuristic method on machine 2.

Computational Experiments
In this section, we present computational experiments on the proposed methods through test data to compare and analyze the performance of these algorithms. The programs were coded in Python and executed on a personal computer with an Intel(R) Core(TM) i7-8700K CPU running at 3.70 GHz with 32.0 GB RAM. The operating system is Windows 10. We will describe how the test data sets were generated. Then, we present the related parameter settings and discuss the experimental results.
Data generation schemes: In our experiments, all parameters are integer. Processing times p 1,j and p 2,j of jobs on different machines were generated from the uniform distribution, [1,10]. Resource parameters α j and β j were generated from the uniform distribution [1,20]. The initial resource level was considered based on 1.1 and 1.4 times the minimum resource requirement that is at least how much the resource is needed for all the jobs of each data set. Test data sets are categorized into 8 different job numbers n ∈ {10, 20, 30, . . . , 80}. For each job number, 5 independent sets were generated. Each set also has different uniform distributions for processing times p 1,j and p 2,j , the resource parameters α j and β j , and the initial resource requirement. That means that we have 40 different data sets in all. On each data set, say 10 jobs, heuristic algorithms were run only once since they are deterministic. For a specific setting, the values were averaged over 5 independent sets of the same setting. The ACO algorithm, due to its randomness nature, was exercised 5 runs on each data set to get its average performance.

Results of Heuristic Algorithms
In this experiment, we apply the four heuristic algorithms on different data sets. We compare permutation solutions with non-permutation ones in two different methods, namely JR-resource and JR-time. The initial resource level in all experiment results set by multiplying the minimum resource requirement by 1.1. For each problem size, the average objective value of derived solution (minimum makespan) are reported. Since the elapsed execution times of four heuristic algorithms are almost negligible, we do not show the execution time in the following tables. All detail experiment results of different data sets are shown in Appendix A.
In Table 2, the makespan of permutation sequence of perm and non-permutation is maxβ. It can be seen that the JR-resource algorithm can get better makespan than the JR-time algorithm. Since the constraint is considered by resource, it is obviously that when the jobs sequenced by processing time, the resource would insufficient and the jobs should wait for the resource returned which lead to idle time. In most of the data sets, the makespans of permutation heuristics are less than non-permutation ones (maxβ in Table 2). However, sometimes, non-permutation can get a better solution that reported in JR-resource with 10 jobs. We speculate that some jobs on machine 2 can fill up the idle time and thus decrease the waiting time on machine 1.
In the experiment, there are different fractions of the bearable exceeding time, which is the acceptable time length that exceeds LargeBetaArrivalTime, used in JR-resource and JR-time Non-Permutation Heuristics. The fraction ranges from 5/10 to 10/10. Table 3 is for JR-time Non-Permutation Heuristics focused on processing times, and Table 4 for the heuristics focused on α i and β i . If we do not consider the bearable exceeding time, the makespan would be more than others that bear the exceed time because there is longer idle time in the sequences. It is clear that with the 10/10 fraction we get a longer makespan. In most cases, the makespan is the same regardless of the fraction. However, sometimes it is shown that if we bear too much exceeded time, we may get worse makespan with a 5/10 fraction of 20 jobs in JR-time and 5/10 to 6/10 fractions of 10 jobs in JR-resource. The results of fractions are not better than permutation ones, so we do not have further test for different fractions with 1.4 times the initial resource level.   10  92  88  87  87  86  86  20  177  169  166  166  166  167  30  256  252  252  252  252  252  40  345  332  332  333  333  332  50  439  424  424  425  425  425  60  494  475  475  475  475  475  70  605  595  597  597  597  597  80  642  638  638  637 637 637

Results of ACO Algorithms
We discuss the results of ACO algorithms with permutation and non-permutation options. We tuned several parameter values in preliminary tests to determine the setting for further experiments. We observed differences in the results, although not significant. The parameter values leading to better results were adopted as the base setting for the final computational tests. We set the two parameters w τ = 2 and w η = 3 that could get better makespan in the experiment we tested before. The pheromone evaporation ρ is 0.95 to avoid early convergence. Parameter Q is defined as the number of jobs divided by 10 and multiplied by 50. Setting 100 epochs for a solution with the colony size the same as the number of jobs. Then, we have each data set run this process 5 times to get an average makespan and an average elapsed execution time. The time unit here is second and "-" means that no feasible solution was found. All complete experiment results are shown in Appendix A. In Table 5, perm indicates the permutation method, and maxβ the non-permutation method presented in Section 5. M2-enum is also non-permutation sequence that is different from the method we used in maxβ. The difference between them is that when the resource is insufficient on machine 1, M2-enum will enumerate all the possible sequences of candidate jobs on machine 2 to find the minimum makespan and return resource. This procedure is time-consuming because the number of possible sequences we need to compare is a factorial of the number of candidate jobs on machine 2. Therefore, when the job number is larger than 30, we cannot get a solution in 3600 s. We also experiment on the integer programming method (IP) proposed by Cheng et al. [13] to solve the problem. The IP can get the optimal solutions for data sets. However, when the number of jobs is over 10, it cannot find any feasible solution in 3600 s for most data sets. Therefore, it is regarded as no solution found. With the initial resource is multiplied by 1.1, it is clear that perm can obtain a better makespan and the required run time of perm is also less than maxβ.  Table 6 indicates that with more initial resource a better makespan can be achieved, as comapred with those in Table 5. Similarly, M2-enum and IP cannot get any solution when job numbers are over 30 and 10, respectively, in 3600 s. It is also shown that when the initial resource level is larger, for like 30 jobs, M2-enum will waste more time so that it cannot find better solutions in 3600 s (Displayed in Table A18). Then, the permutation method can find an approximate solution with less time. However, results of 1.1 and 1.4 times are within spitting distance when the quantity of jobs increases. It is reckoned that the processing times of the subsequent jobs on machine 2 are larger and the resource is sufficient for them, so their starting times are later than their completion times on machine 1 and they keep processing continuous without idle time. Therefore, the makespan of larger data sets are not quite different when the initial resource increases.  Table 7 shows that different fractions of the bearable exceeding time used in ACO Non-Permutation algorithms with different times of the initial resource. In most cases, it would get less makespan with considering the bearable exceeding time. The makespan resulted from fractions between 5/10 and 9/10 are not quite different. It is clearly shown that the makespan of 10/10 fraction is longer than others. As a result, setting the bearable exceeding time can achieve a better performance.

Comparison between Heuristics and ACO Algorithms
We discuss the experiment results of the heuristic and the ACO algorithms with special focus on permutation results of JR-time and JR-resource because the makespan of permutation cases are less than other non-permutation heuristic algorithms. ACO-10/10 is the 10/10 fraction of exceeding time bearable in the non-permutation ACO algorithm. We also choose the 5/10 fraction (ACO-5/10) and the permutaion of ACO (ACO-perm) as the control groups.
In Figures 5 and 6, both heuristic algorithms produced larger makespan no matter if the initial resource is multiplied by 1.1 or 1.4, especially for the JR-time. However, there is still some deviations in the ACO algorithms owing to the randomness nature. Except for the above situation, 1.4 times are still better than 1.1 times in most cases with permutation and non-permutation methods, especially JR-time. We reckon that with a higher initial resource level, more jobs on machine 1 can keep continuous processing, thus reducing the idle time waiting for resource return. Concerning the ACO algorithm, it is clear that that the 5/10 fraction is better than the 10/10 case.

Conclusions and Future Works
In this paper, we considered the relocation problem in a two-machine flow shop scheduling problem with the second machine introduced for recycling the resource returned by jobs completed on the first machine. For this problem, we proved that given a sequence of jobs on whichever machine, the problem is still strongly NP-hard. The case with two fixed sequences of jobs on both machines can be solved in polynomial time. For the computationally hard problem, we proposed two heuristic algorithms to construct feasible schedules with permutation and non-permutation sequences. ACO algorithms were designed to find processing sequences on the two machines. Computational experiments indicates that JR-resource produced better makespan than JR-time, and both of their permutation algorithms are better than the non-permutation ones. This result is similar as in ACO algorithm that the makespan of permutation solutions are better. However, when we considered the bearable exceeding time, non-permutation sequences can get better solutions. Between heuristics and ACO algorithms, it is shown that ACO algorithms yielded schedules with less makespan.
For further studies, there is room for further improvements of our proposed solution methods by developing effective methods to arrange the job sequence on machine 2 to mitigate the incurred idle time. Furthermore, we can also combine processing time and resources as a control factor in the heuristic algorithms. It would be also interesting to deploy machine learning and reinforcement learning approaches for finding better parameter settings and updating strategies. We also note that to optimally solve the problem is still limited to small-scale instances. For larger instances, we need tighter lower bounds to facilitate the development of exact methods and provide a tight comparison base for approximation methods. Another direction is identifying application contexts in which the unique type of resource constraints, the amount of consumed resource and the amount of returned resource could be different, is applicable.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A. Detail Experiment Results
All of the experiment results mentioned in Section 6 are summarized from the detail information shown below. We show the makespan (C max ) and execution time for each data set followed by the average over five data sets in different job numbers. In the tables, "perm" means permutation method, and "maxβ" non-permutation with a 10/10 fraction. We also set the execution time to stop the program if it exceeds 3600 s. Therefore, if we cannot obtain any solution in 3600 s, we indicate the situation by an "-" entry. In ACO, owing to its randomness property, we run each data sets for five times which is "Run." in the tables. In Tables A18 and A19, when the numbers of jobs are over 30 and 10, we cannot obtain solutions for most cases so that we do not experiment on the cases with more jobs. It is clear that most results are associated with an "-", indicating that no solutions were found within 3600 s. Avg. ----