Fixed interval scheduling with third‐party machines

We study a problem of scheduling n jobs on machines of two types: in‐house machines and third‐party machines. Scheduling on in‐house machines incurs no additional costs, while using third‐party machines implies costs depending on their number and the time of usage. Each job has a fixed time interval for being processed which can be divided and allocated among several machines, as long as there is only one machine processing the job at any time. No machine can process more than one job at a time. Jobs can be rejected, and they are of different importance that is reflected in the weight of each job. The objective is to find a subset of the jobs and the number of third‐party machines for any period of time so that the accepted jobs can be feasibly scheduled, the total weight of the accepted jobs is maximized, and the total machine usage costs does not exceed a given upper bound. We also study a similar problem in which the objective is to maximize the total time at which at least one job is processed. Both problems are encountered in situations in which certain activities with given start and completion times have to be serviced by human operators. Examples are air traffic control and the monitoring safe vehicle unloading. Other examples are the employment of subcontractors in agriculture, construction or transportation. We will present NP‐hardness proofs, polynomial and pseudo‐polynomial optimal algorithms and an approximation algorithm for these problems and their special cases. These problems admit graph‐theoretical interpretations associated with finding independent sets and a proper vertex coloring in interval graphs.

mainly of two components: a fixed cost share that only depends on the duration of the subcontractor's use of resources (e.g., machinery) and a variable cost share for the amount and duration of the resources (e.g., number of workers on each day) used. The entrepreneur is interested in keeping the number of external workers and their duration of employment low and will agree with the subcontractor on a cost limit that cannot be exceeded.
Problems studied in this paper generally arise in planning human operator services, where both the service quality and ergonomics of the operator's work substantially drop as the load of the operator with simultaneously serviced jobs exceeds a certain threshold. The operator's work costs are fixed if this threshold is not exceeded, but if it is exceeded then extra costs incur which depend on the number of the additional jobs and the time of their servicing. The problems can be formulated as follows.
From the jobs of a set N = {1, … , n}, some can be accepted for processing on machines of two types: m in-house machines and an unlimited number of third-party machines. No machine can process more than one job at a time. Each job j has a fixed processing time interval (a j , b j ] of length d j = b j − a j > 0, and it can either be accepted and processed entirely and without interruption in this interval by the in-house and third-party machines or it can be rejected and not processed at all. Processing of a job can be distributed among several machines, but by a single machine at any time instant reflecting the fact that an operator may immediately continue the service of a colleague. Using in-house machines incurs no additional costs, while using x third-party machines over a time interval of length implies a costs sgn(x )( + x) , where sgn(⋅) is the signum function and and are given numbers. Thus, if no third-party machine is used in any time interval, there are no costs, and if x ≥ 1 third-party machines are used in a time interval of non-zero length, the corresponding costs are a linear function of x in each unit-time sub-interval of the latter interval. Each job j has a weight w j . The objective is to find a set X ⊆ N of accepted jobs, the number of third-party machines and an assignment of in-house and third-party machines to the accepted jobs over time so that the accepted jobs are feasibly scheduled, the total weight of the accepted jobs is maximized, and the total machine costs do not exceed a given upper bound U. All numerical data and function values are assumed to be non-negative integer numbers. We denote this problem as MAXWEIGHT and the value (maximum weight) of an optimal solution as W * .
Furthermore, we study a problem which differs from MAXWEIGHT in that the goal is to maximize the total amount of time at which jobs are processed. We denote this problem as MAXCOVER and the value of an optimal solution as C * . There is an O(nlogn) time algorithm of Gupta et al. [16] for the interval graph coloring problem which can be used to find the minimum number of machines required to feasibly schedule all the jobs with fixed processing intervals. If this minimum number does not exceed m, then the algorithm in Gupta et al. [16] is optimal for both problems MAXWEIGHT and MAXCOVER. In what follows we assume that it is not the case.
Another example of MAXWEIGHT is the work planning of a flight dispatcher, who can qualitatively and ergonomically service at most m flights at the same time in his responsibility area. There are n flights to be serviced, and flight j is permanently present in the responsibility area in a given time interval (a j , b j ]. If there are more than m flights at the same time in the responsibility area, then the ergonomics of the dispatcher's work drops, and he is paid a compensation for each unit-time interval of such a service, which is a linear function of the number of extra flights to be serviced simultaneously. Thus, the compensation includes a fixed part and a variable part x which is proportional to the number x of the extra flights. Both parts are paid for each time unit of the reduced ergonomic work. The compensation payment can be used to motivate the dispatcher and to evaluate the dispatching service quality. Each flight is associated with a value. The problem is to select a subset of flights to be serviced by the dispatcher so that the total value of the selected flights is maximized and the total compensation paid does not exceed a given upper bound. The upper bound bases on past experience as to balance service quality and the compensating payment.
An example of the problem MAXCOVER is similar. It is the work planning of an operator who monitors the safe unloading of vehicles (vessels, trains, buses) with the aid of an electronic video surveillance system. There are n vehicles to be monitored, and vehicle j is unloaded in a given time interval (a j , b j ]. The operator can qualitatively and ergonomically monitor the unloading of m vehicles at the same time at most. If more than m vehicles are unloaded at the same time, the ergonomics of the monitoring process drops and the operator is paid a compensation for each unit-time interval of such service, which is a linear function of the number of extra vehicles monitored simultaneously. The problem is to select a subset of vehicles to be monitored by the operator so that the total duration of the intervals in which unloading of at least one vehicle is monitored, that is, the operator's productive time, is maximized and the total payment compensating low ergonomic service does not exceed a given upper bound. Problems MAXWEIGHT and MAXCOVER belong to the category of fixed interval scheduling problems, see the different surveys and further results in Kolen et al. [19], Kovalyov et al. [20], Krumke et al. [21], Angelelli et al. [1], van Bevern et al. [4] and Bentert et al. [3]. These problems admit graph-theoretical interpretations, associated with finding independent sets and a proper vertex coloring in interval graphs. The set of vertices of the corresponding interval graph is the set of jobs, and an edge between two vertices exists if and only if the corresponding intervals intersect. MAXWEIGHT and MAXCOVER differ from fixed interval scheduling problems in that third-party machines exist and using them causes costs depending on their number and the length of their operating period. If U = 0, no third-party machine can be used, and problem MAXWEIGHT can be solved in O(mnlogn) time by the algorithms of Bouzina and Emmons [6] and Carlisle and Lloyd [7], and problem MAXCOVER can be solved in O(nlogn) time by the algorithm of Gupta et al. [16]. The time window concept is a generalization of the fixed interval concept, according to which there is a flexibility in the time of performing a job in its time window. Studies of scheduling and vehicle routing problems with time windows were initiated by Schrage [30] and Bodin et al. [5]. Recent publications include Sarasola and Doerner [29], Gnegel and Fügenschuh [15], Mohammadi et al. [25], Chen et al. [8] and Lera-Romero et al. [23], among others.
Problems MAXWEIGHT, MAXCOVER and scheduling problems with order acceptance and job rejection are related. The difference is that, with reference to the latter two problems, a job can be either accepted (entirely processed on in-house machines) or rejected (entirely processed on third-party machines). Problems MAXWEIGHT and MAXCOVER allow a job can be rejected and not at all processed. If a job is accepted, then any part of this job can be processed on in-house and third-party machines. Besides, in the order acceptance and job rejection settings the jobs are not restricted to being processed in fixed time intervals. Recent results on scheduling with job rejection can be found in Bartal et al. [2], Engels et al. [12], Dosa and He [11], Shabtay et al. [31], Mnich and Wiese [24] and Hermelin et al. [17], and those on scheduling with order acceptance in Slotnick [32] and Zhong et al. [37].
A large part of the relevant literature deals with scheduling with sub-contracting. It differs from scheduling with order acceptance or job rejection in two ways. In addition to the rejection option, a job can be processed at a sub-contractor facility, and conditions of its processing such as job delivery time, or job sequence, or sub-contractor selection are considered. Again, problems of this kind do not include fixed time intervals for jobs and the possibility of processing the same job by in-house and third-party machines. Publications on scheduling with sub-contracting include Chen and Li [9], Qi [27], Mokhtari and Abadi [26], Zhong and Huo [36], Vairaktarakis [33], Wang et al. [35], Hezarkhani and Kubiak [18], Vairaktarakis and Aydinliyim [34], Ren et al. [28], and the references therein.
Fukunaga et al. [13] studied a "rent-or-buy" scheduling and cost coloring problem, in which machines belong to different classes and the machine usage costs depend on the class of the machine and on the set of jobs assigned to it. Two classes of in-house and third-party machines can be identified for problems MAXWEIGHT and MAXCOVER. However, the problem considered in Fukunaga et al. [13] cannot model the situation in which in-house and third-party machines work on the same set of jobs and the costs depend on the working duration of the third-party machines.
Our results for the problems MAXWEIGHT and MAXCOVER are described in Sections 2 and 3, respectively. Each problem is proved to be NP-hard in the ordinary sense and two dynamic programming algorithms of incomparable computational complexities are presented for each problem. It is convenient to introduce the following notation.
L is the number of integer points in the union of the intervals (a j , b j ], j ∈ N.
Our results are summarized in Table 1. The paper concludes with a short summary of the results and suggestions for future research. In this article, we will use the names "job" and "interval" interchangeably.

PROBLEM MAXWEIGHT
We start with an NP-hardness proof in Section 2.1 and then proceed with two dynamic programming algorithms, denoted as and it is described in Section 2.3.

Ordinary NP-hardness Theorem 1. MAXWEIGHT is NP-hard even if the number of in-house machines m is any non-negative constant, and are any constants satisfying
Proof . We use a reduction from the following NP-complete problem Partition (Garey and Johnson [14]): Given k + 1 positive integer numbers p 1 , … , p k and P such that Given an instance of Partition, construct an instance of MAXWEIGHT, in which the number of in-house machines m is a given non-negative integer number, and are given numbers satisfying + > 0, and the number of jobs is n = (m + 1)k. The jobs are partitioned into k groups numbered 1, … , k. Each group j contains m + 1 identical jobs associated with the same interval of length p j and the same weight w j = p j , j = 1, … , k. It is required that intervals of jobs from any two different groups do not intersect. We show that the instance of Partition has a solution if and only if there exists a solution of the constructed instance of MAXWEIGHT with the total weight of at least (2m + 1)P and the total machine costs of at most ( + )P.
Let X be a solution of the instance of Partition. Construct a solution of the instance of MAXWEIGHT, in which the subset of the selected jobs includes all m + 1 jobs of each group j, j ∈ X, and it includes m jobs of each group j, j ∈ K\X. The total weight of the selected jobs is (m Since the processing intervals of jobs from any two different groups do not intersect, no more than one third-party machine is needed at any time, and therefore, the total machine costs of the selected jobs are equal to ( + ) ∑ j ∈ X p j = ( + )P. Hence, the selected jobs are a solution of the instance of MAXWEIGHT.
Let Y be the set of the selected jobs in a solution of the instance of MAXWEIGHT with the total weight of at least (2m + 1)P and the total machine costs of at most ( + )P. Observe that if r, 0 ≤ r ≤ m − 1, jobs of group j are present in Y for any j, then, since processing intervals of the jobs from any two different groups do not intersect, and the use of in-house machines has zero costs, m − r such jobs can be added to Y with no decrease of the total weight and no increase of the total costs. Therefore, assume without loss of generality that if a job of group j is in Y, then either m + 1 or m such jobs are in Y. Denote by X(Y) the set of indices j ∈ K for which Y includes exactly m + 1 jobs of group j. For the total weight of the jobs in X(Y), we must have Furthermore, for the total machine costs, we must have ( + ) We now describe two dynamic programming algorithms of incomparable computational complexities for the problem MAXWEIGHT. In the algorithms it is assumed that the jobs are re-numbered in a non-decreasing order of the left endpoints of their intervals such that a 1 ≤ · · · ≤ a n , and the following notations are used.

Algorithm DPW1
In the algorithm DPW1, partial solutions are constructed by considering the jobs in the order 1, … , n and deciding for each job j (interval (a j , b j ]) whether to accept or reject it. Once the decision has been made, it will not be changed later. Each partial solution is characterized by a state (j, w, r) and a cost function F j (w, r), where j is the number of jobs considered so far, w is the total weight of the accepted jobs, r = (r 1 , … , r m + 1 ), and r i is the latest endpoint of the accepted intervals, which belongs to at least i accepted intervals, i ∈ M. If an endpoint satisfying this condition does not exist, then r i ≔ 0 by the definition, i ∈ M. If r i = r i + 1 , 1 ≤ i ≤ m, then we assume that r i corresponds to a job accepted later, and r i + 1 corresponds to a job accepted earlier. Consider a partial solution in the state (j, w, r) and assume that it is obtained from a partial solution in the state (j − 1, w 0 , r 0 ) by making a decision about job j (interval (a j , b j ]). Observe that.
by the definition of the state variables. Denote by l 0 i the left endpoint of the interval whose right endpoint is r 0 i . Due to the consideration of jobs in the order 1, … , n, at any state of the dynamic programming.
If job j has been rejected in state (j, w, r), then the previous state is (j − 1, w, r), and F j (w, r) = F j − 1 (w, r). Assume that job j has been accepted. The previous state is (j − 1, w − w j , r 0 ). Consider the current state (j, w, r). It is obvious that if b j < r m + 1 , Consider the case b j ≥ r m + 1 . Define the following sets of indices after job j has been accepted.
These definitions are illustrated in Figure 1.
R are represented by the filled circles. Denote For a set of indices S ∈ M, define r(S) as a sequence of right endpoints r i , i ∈ S, in the non-increasing order. If S = ∅, then define r(S) = ∅. It follows from Equations (1-3) that, if job j is accepted, then the previous state vector r 0 is.
L } = 0. Below we show that, after job j has been accepted, the change of the total costs when passing from state (j − 1, w − w j , r 0 ) to state (j, w, r) depends only on j, r 0 m and r 0 m+1 . Denote this change as Δ j (r 0 m , r 0 m+1 ) = F j (w, r) − F j−1 (w − w j , r 0 ). Taking into account (1) and (2), we have Note that if r 0 m ≤ a j , then job j is fully processed on an in-house machine. If r 0 m+1 ≤ a j < r 0 m , then job j is processed in the time interval (r 0 m , max{b j , r 0 m }) on an in-house machine and it is processed in the interval (a j , min{r 0 m , b j }) on a third-party machine. The fixed cost is accounted for the latter interval because no third-party machine was used in this interval before job j was assigned. If a j < r 0 m+1 , then job j is processed in the time interval (r 0 m , max{b j , r 0 m }) on an in-house machine and it is processed in the interval (a j , min{r 0 m , b j }) on a third-party machine. The fixed cost is accounted for the interval (r 0 m+1 , min{r 0 m , b j }) and it is not accounted for the interval (a j , min{r 0 m+1 , b j }) because it was accounted for this interval before job j was assigned.
we deduce that a partial solution in the state (j, w, r), at which the minimum costs F j (w, r) are attained, dominates all other partial solutions in the same state in the sense that if there is a solution in this state that can be extended to an optimal solution, then the dominant solution can be extended in the same way to an optimal solution as well. Note that, while the change of the total costs depend only on r 0 m and r 0 m+1 , these values can only be recursively calculated if the whole vector r 0 is maintained.
Here and below the term under the minimum is skipped if the condition on the right hand side of it is not satisfied. If the minimum in the recursion is attained at the upper term, then job j is rejected. If it is attained at the middle term, then job j is accepted and it is fully processed on a third-party machine. If this minimum is attained at the lower term, then job j is accepted and the machines and the time intervals where it is processed either on an in-house machine or a third-party machine are determined by the value Δ j (r 0 m , r 0 m+1 ) via (5). The maximum total weight is equal to The corresponding set of accepted intervals and partition of each accepted interval into sub-intervals processed either on an in-house machine or a third-party machine can be found by tracing back optimal solutions of the recursive equation. Then, the O(nlogn) time algorithm of Gupta et al. [16] can be used twice to find an optimal assignment of the "in-house" sub-intervals to the particular in-house machines and to find an optimal assignment of the "third-party" sub-intervals to the particular third-party machines.
The running time of the algorithm DPW1 is

Algorithm DPW2
Algorithm DPW2 differs from DPW1 in that the roles of the cost function F j (w, r) and the state variable w are switched. In DPW2, similar to DPW1, partial solutions are constructed by considering jobs in the order 1, … , n and deciding for each job j of whether to accept it or reject. Once the decision has been made, it will not be changed later. Each partial solution is characterized by a state (j, c, r) and a weight function G j (c, r), where c is the total machine usage costs, and j and r are the same as in DPW1. The value of G j (c, r) is equal to the maximum total weight of the partial solutions in the same state (j, c, r). Initialization is G 1 (0, e (0) ) = 0, G 1 (c (1) , e (1) ) = w 1 , and L , vectors r 0 satisfying Equation (4) and values Δ j (r 0 m , r 0 m+1 ) satisfying Equation (5) in the same way as in algorithm DPW1. The recursion for j = 2, … , n, 0 ≤ c ≤ U and r ∈ R (r m+1 >b j ) ∪ R (r m+1 ≤b j ) is as follows.

PROBLEM MAXCOVER
We begin with an important "at most two machines" property of the problem MAXCOVER and a proof of its ordinary NP-hardness for the case m ∈ {0, 1} in Section 3. Proof . A reduction from the Partition problem is used, see the definition of this problem in Theorem 1.
Case m = 0. For any instance of PARTITION, we construct the following instance of MAXCOVER. There are n = k jobs such that job j is associated with an interval of length p j , and the intervals do not intersect, j = 1, … , k. We show that the instance of PARTITION has a solution if and only if the instance of MAXCOVER has a solution with the total amount of time at which at least one job is processed of at least P and the total machine usage costs of at most ( + )P.
Let a set X ⊆ K be a solution of PARTITION. Construct a solution of MAXCOVER in which, if j ∈ X then job j is accepted, else if j ∈ X then job j is rejected. For this solution, the total amount of time at which at least one job is processed is equal to ∑ j ∈ X p j = P, and the total costs are equal to ( + ) ∑ j ∈ X p j = ( + )P. Now, assume that MAXCOVER has a solution of the required quality. Let X denote the set of accepted jobs in this solution. For this solution, the total amount of time at which at least one job is processed is equal to ∑ j ∈ X p j , and the total machine usage costs are equal to ( + ) ∑ j ∈ X p j . Since relations ∑ j ∈ X p j ≥ P and ( + ) ∑ j ∈ X p j ≤ ( + )P must hold, we deduce ∑ j ∈ X p j = P. Case m = 1. For any instance of PARTITION, we construct an instance of MAXCOVER, in which there are n = k pairs of jobs (intervals). The length of any interval of the same pair j is equal to 2p j , and the length of their common part is equal to p j , j = 1, … , k. Intervals of jobs from different pairs do not intersect. We show that the instance of PARTITION has a solution if and only if the instance of MAXCOVER has a solution with the total amount of time, at which at least one job is processed of at least 5P, and the total machine usage costs of at most ( + )P.
Assume that set X ⊆ K is a solution of PARTITION. Construct a solution of MAXCOVER in which, if j ∈ X then both jobs from the pair j are accepted, else if j ∈X then exactly one job of this pair is accepted. For this solution, the total amount of time at which at least one job is processed is equal to 3 ∑ j∈X p j +2 ∑ j ∈X p j = 5P, and the total costs are equal to ( + ) ∑ j ∈ X p j = ( + )P. Assume that MAXCOVER has a solution of the required quality. Let X denote the set of job pairs such that both jobs of the pair are accepted. For this solution, the total amount of time at which at least one job is processed does not exceed 3 ∑ j∈X p j +2 ∑ j ∈X p j , and the total machine usage costs are equal to ( + ) ∑ j ∈ X p j . Since 3 We now describe dynamic programming algorithms DPC1 and DPC2 for the problem MAXCOVER(m ∈ {0, 1}). These algorithms are similar to the algorithms DPW1 and DPW2 for the problem MAXWEIGHT.

Algorithm DPC1 for MAXCOVER(m ∈ {0, 1})
In DPC1, each partial solution is characterized by a state (j, l, r) and a cost function H j (l, r), where j is the number of jobs considered so far, l is the total amount of time at which at least one job is processed, r = (r 1 , … , r m + 1 ), and r i is the latest endpoint of the accepted intervals, which belongs to at least i ∈ M accepted intervals. If an endpoint r i does not exist, then r i ≔ 0 by the definition, i ∈ M. If r i = r i + 1 , 1 ≤ i ≤ m, then we assume that r i corresponds to a job accepted later, and r i + 1 corresponds to a job accepted earlier. The value of H j (l, r) is equal to the minimum total costs of the partial solutions in the same state (j, l, r).
The initialization is H 1 (0, e (0) ) = 0, H 1 (d 1 , e (1) ) = c (1) , and H 1 (l, r) = U + 1 if (l, r) ∉ {(0, e (0) ), ( 1 , e (1) )}, 0 ≤ l ≤ L, r = (r 1 , … , r m + 1 ), r i ∈ B n , i = 1, … , m + 1. Generate sets R (r m+1 >b j ) , R (r m+1 ≤b j ) , S (j) R , S (j) 0 and S (j) L , vectors r 0 satisfying Equation (4) and values Δ j (r 0 m , r 0 m+1 ) satisfying Equation (5) in the same way as in algorithm DPW1. The recursion for j = 2, … , n, 0 ≤ l ≤ L and r ∈ R (r m+1 >b j ) ∪ R (r m+1 ≤b j ) is. where If the value of H j (l, r) is attained at the upper term of the minimum in the recursion, then job j is rejected, else it is accepted. The maximum total amount of time at which at least one job is processed is equal to and the corresponding optimal solution can be found in the same way as in algorithm DPW1. The running time of the algorithm DPC1 is O(n m + 2 L) for m ∈ {0, 1}. We remark that DPC1 is not optimal for m ≥ 2. If m ≥ 2, then the function j (x) needs to be corrected.

Algorithm DPC2 for MAXCOVER(m ∈ {0, 1})
Algorithm DPC2 differs from DPC1 in that the roles of the cost function H j (l, r) and the state variable l are switched. Each partial solution is characterized by a state (j, c, r) and a length function K j (c, r), where c is the total machine usage costs, and j and r are the same as in DPC1. The value of K j (c, r) is equal to the maximum total amount of time at which at least one job is processed for the partial solutions in the same state (j, c, r).
A feasible solution of the problem MAXCOVER(m ∈ {0, 1}), in which at most two machines are used, is determined by two non-intersecting independent sets (or 2-coloring) of the interval graph, and vice versa. Vertices of an independent set (of the same color) are jobs processed on the same machine. Denote by C 0 the maximum total length of the intervals of any independent set of the interval graph. An independent set with the value C 0 can be found in O(nlogn) time by the min-cost flow algorithms of Bouzina and Emmons [6] and Carlisle and Lloyd [7], which are intended for maximizing the weighted number of accepted jobs on identical parallel machines. For our purposes, there is a single machine and the weight of each job is equal to the length of its interval.
It is clear that C 0 ≥ max{C * 1 , C * 2 }, which implies C 0 ≥ C * /2. A solution in which intervals of the independent set with value C 0 are processed on a single machine is feasible for the problem MAXCOVER(m ∈ {0, 1}). Hence, the following theorem holds. [6] and Carlisle and Lloyd [7] is a 1/2-approximation algorithm for the problem MAXCOVER(m ∈ {0, 1}).

Theorem 3. Any of the algorithms of Bouzina and Emmons
Note that the approximation ratio 1/2 is asymptotically tight. Indeed, consider an instance, in which m = 1, there are two intervals of the same length Y + 1, the length of their intersection is 1, and U = + , which implies that at most one third-party machine can be used during one time unit. The algorithm in Bouzina and Emmons [6] will deliver a single interval solution with value Y + 1, while the optimal solution includes both intervals with value 2Y + 1. Hence, the approximation ratio is Y+1 2Y+1 = 1 2 + 1 4Y+2 , which approaches 1/2 for sufficiently large Y.

An O(n log n) time algorithm for MAXCOVER(m ≥ 2)
We now demonstrate that the problem MAXCOVER(m ≥ 2) can be solved in O(nlogn) time. The solution consists of two stages. The first stage is a pre-processing algorithm, denoted as Remove, which removes all intervals which are inside of another one. The algorithm of Kung et al. [22] designed to find the set of maximal 2-dimensional vectors (intervals) with respect to a partial order can serve as algorithm Remove. Below we describe algorithm Remove for completeness. Due to Property 1, an optimal solution of the new problem, in which (a i , b i ] ⊈ (a j , b j ] for all i and j, is an optimal solution of the original problem. The second stage is an algorithm, denoted as Greedy, which solves the new problem as follows. Firstly, an interval with the earliest endpoint is accepted. Secondly, intervals are processed in a non-decreasing order of their left endpoints. Thirdly, among intervals that intersect with the interval accepted last, the interval with the latest endpoint is accepted. If no unprocessed interval intersects with the last accepted interval, then the interval with the earliest endpoint is accepted.
Algorithm Remove. Initialization. Denote by V a maximal set of intervals from N such that (a i , b i ] ⊈ (a j , b j ] for i ∈ V and j ∈ V. Re-number intervals from N according to a 1 ≤ · · · ≤ a n breaking ties so that b i ≤ b i + 1 ≤ · · · ≤ b j if a i = a i + 1 = · · · = a j . Initialize V ≔ {(a s , b s ]}, where s = max{j ∈ N| a j = a 1 }. Let (a * , b * ] denote the interval included last into the set V. Process intervals in the order s, s + 1, … , n.
General step. If s = n then stop: set V is constructed. If s ≤ n − 1, then perform the following computations. If b s + 1 ≤ b * , then re-set s ≔ s + 1 and repeat General step.
where t = max{j| a j = a s + 1 }, re-set s ≔ t and repeat General step. Let us show that algorithm Greedy is optimal for the problem MAXCOVER(m ≥ 2) with the set of intervals V. Denote by O * an arbitrary optimal set of accepted intervals. It is obvious that inclusion (a 1 , b 1 ] ∈ O * must be satisfied. Assume that O * contains intervals selected by Greedy up to the interval (a s , b s ]. If a s + 1 > b s , then inclusion (a s + 1 , b s + 1 ] ∈ O * must be satisfied, else inclusion (a t , b t ] ∈ O * must be satisfied, where (a t , b t ], t ≥ s + 1, is the interval intersecting with (a s , b s ], which has the latest endpoint. Observe that a t + 1 > b s , which implies that, among the intervals which intersect with (a s , b s ], only (a t , b t ] is present in O * . Hence, two machines are enough to process these intervals without intersection. Continuing in the same fashion, we see that Greedy outputs an optimal set of accepted intervals. The running time of this algorithm is O(nlogn) because in General step each interval is considered at most twice: when comparing with b * and when selecting the interval with the latest endpoint b r . The following theorem holds.

CONCLUSIONS
We have proved that the problems MAXWEIGHT and MAXCOVER(m ∈ {0, 1}) are NP-hard in the ordinary sense and developed dynamic programming algorithms for them which are pseudo-polynomial if the number of in-house machines m is a constant. An O(nlogn) time 1/2-approximation algorithm is designed for MAXCOVER(m ∈ {0, 1}). Surprisingly, the problem MAXCOVER(m ≥ 2) is solvable in O(nlogn) time.
For future research, it is interesting to develop faster optimal algorithms and (Fully) Polynomial Time Approximation Schemes for the problems MAXWEIGHT and MAXCOVER(m ∈ {0, 1}) as well as to prove or disprove their NP-hardness in the strong sense and fixed parameter tractability (Cygan et al. [10], Mnich and Wiese [24]). Considering time windows instead of fixed intervals and different but still realistic cost functions for using third-party machines are other promising research directions.
We conjecture that the dynamic programming algorithms DPW1, DPW2, DPC1 and DPC2 can be modified to solve more general problems than MAXWEIGHT and MAXCOVER(m ∈ {0, 1}). One way of modification is to introduce costs for the activation and deactivation of third-party machines. Using in-house machines entails no costs regardless of the time as assumed in this paper, while using x ab third-party machines in a time interval (a, b], b > a would incur costs u(x ab )(b − a) + h(x a−1,a , x a,a+1 ) + f (x b−1,b , x b,b+1 ), where • u(x ab ) are the costs for using x ab third-party machines a time unit such that u(0) = 0 and u(x ab ) = + x ab if x ab > 0, as it is in the problems MAXWEIGHT and MAXCOVER, • h(x a − 1, a , x a, a + 1 ) are activation costs such that h(x a − 1, a , x a, a + 1 ) > 0 if x a − 1, a = 0 and x a, a + 1 > 0, and h(x a − 1, a , x a, a + 1 ) = 0 if x a − 1, a > 0, • f (x b, b + 1 ) are deactivation costs such that f (x b, b + 1 ) > 0 if x b − 1, b > 0 and x b, b + 1 = 0, and f (x b, b + 1 ) = 0 if x b, b + 1 > 0.