1 Introduction

We begin with a motivating example for the shared processor scheduling problem before we describe it generally and define formally. Consider three orders (jobs) of size \(p_1=52\), \(p_2=12\), and \(p_3=26\) units. These orders belong to three competing agents (manufactures), each with its own private processor \(\mathcal {P}_1\), \(\mathcal {P}_2\), and \(\mathcal {P}_3\), respectively. If each processor produces one unit per unit of time, the order’s earliest completion times will be 52, 12, and 26, respectively, provided that the private processors start processing their orders right away, i.e., at time 0, and experience no preemptions resulting in undesirable delays. Naturally these completion times cannot be shortened without additional processors. Now suppose a subcontractor with a single processor \(\mathcal {M}\), capable of processing at most one order at a time, offers \(\mathcal {M}\) to be shared by all agents. We refer to \(\mathcal {M}\) as the shared processor. Then the agents may consider subcontracting parts of their orders to the subcontractor but only if this reduces their order’s completion times. Otherwise, they will obviously do better by using only their own private processors. Therefore, schedules that allow the subcontractor to process an order on \(\mathcal {M}\) while the order’s private processor remains idle are undesirable to the order’s agent since they do not reduce the order’s completion time, and moreover they are more expensive to the agent who needs to unnecessarily pay for using \(\mathcal {M}\) when its private processor is idle. These requirements imply that each order is either done on its private processor only or on its private processor and in parallel on \(\mathcal {M}\) (resulting in overlap) at any time in a desirable schedule. Hence, only the overlap can reduce completion times and thus agents strive to have (collectively) as much of it as possible. Clearly, the overlap is beneficial to the agents, by reducing completion times, and at the same time to the subcontractor, by payments from agents for using \(\mathcal {M}\). Observe that while preemptions on private processor are not advantageous, one cannot a priori rule out possible advantages from preemptions on the shared processor where an order could be done in disjoint time intervals, each overlapping with the execution on the order’s private processor. However, we prove later that such preemptions are not advantageous either. Thus, feasible schedules can be limited to non-preemptive schedules only. Finally, the subcontractor needs to find a feasible schedule that maximizes the total (weighted) overlap. In the motivating example such schedule would have order 2 scheduled in (0,6), order 3 in (6,16), and order 1 in (16,34) on \(\mathcal {M}\). Observe that order 2 is also done in (0,6) on \(\mathcal {P}_2\), order 3 in (0,16) on \(\mathcal {P}_3\), and order 1 in (0,34) on \(\mathcal {P}_1\), see Fig. 1a. This schedule is optimal for the unweighted case. Generally, the orders may have individual weights \(w_1\), \(w_2\), and \(w_3\), respectively. This may be because the payoffs to agents resulting from order completion time savings may be order-dependent, or the subcontractor may charge different rates to different orders for using the shared processor.

Fig. 1
figure 1

a An optimal schedule for three unweighted jobs with of processing times \(p_1=52\), \(p_2=12\) and \(p_3=26\) (the total weighted overlap of this schedule is 34); b an optimal schedule when the jobs have weights \(w_1=2\), \(w_2=1\), \(w_3=3\) (the total weighted overlap equals \(\frac{p_3}{2}w_3+\frac{p_1-p_3/2}{2}w_1=78\))

Generally, we consider a subcontracting system where each agent j has a job with processing time \(p_j\) to be executed. Such an agent can perform the work by itself on its private processor, in which case the job completes after \(p_j\) units of time, or it can send (subcontract) a part (overlap) of length \(t_j\le p_j/2\) of this job to a subcontractor for processing on a shared processor. The subcontractor needs to complete this part of agent’s j job by \(p_j-t_j\) bearing in mind that the shared processor can do at most one job at a time which obviously constraints the subcontractor. The speedup in terms of the completion time that the agent achieves in this scenario is exactly \(t_j\), or in other words, the work of agent j is completed at time moment \(p_j-t_j\). Whenever \(t_j>0\), the subcontractor is paid by agent j: the payoff for executing \(t_j\) units of j-th agent’s job is \(t_jw_j\). The goal of the subcontractor is to maximize its total weighted overlap (or total weighted payoff to subcontractor, or total weighted time savings to agents depending on interpretation). Thus, in this subcontracting system all agents try to minimize completion times of their jobs (the parameters \(p_j\) and \(w_j\) are fixed for each agent j) by commissioning the biggest possible part of their jobs to the subcontractor. The subcontractor is the party that decides the overlap \(t_j\) to maximize the total weighted overlap.

The shared processor scheduling problem can be placed in a wider context of scheduling with the presence of private (local) processors (machines), available only to a particular job or a set of jobs, and shared (global) processors that are available to all jobs. Then, some additional rules are given in order to specify the conditions under which a job can gain access to a shared processor in such systems. These systems can be run as either centralized or decentralized. The former typically has a single optimization criterion forcing all parties to achieve the same goal. The latter emphasizes that each party is trying to optimize its own goal, which may (and often does) lead to problems having no solutions which are optimal for each agent (job) individually. These problems can be seen as multi-criteria optimization or coordination problems. The latter can be further subdivided into problems in which agents have complete knowledge about resources of other agents (complete information games) and problems without such a complete knowledge (distributed systems) in the search for coordinating mechanisms. This research falls into the category of centralized problems as the subcontractor is deciding on the schedule that reflects its best interest.

The outline of this paper is as follows. In the next section, we briefly survey the related work to provide a state of the art overview. Section 3 gives a formal statement of the shared processor scheduling problem, and it introduces the necessary notation. Then, in Sect. 4, we recall some facts related to the problem, mainly the fact that when computing optimal schedules one may restrict attention to schedules that are called synchronized. This generally greatly simplifies the formal arguments and algorithmic approach. Section 5 considers a restricted version of the problem in which it is assumed that for any pair of jobs, neither of the jobs can have weight and processing time to be strictly smaller than the other. We give an \(O(n\log n)\)-time optimization algorithm for this case, and we use it subsequently as a building block to obtain an \(O(n\log n)\)-time 1/2-approximation algorithm for the general case in Sect. 6.

2 Related work

The shared processor scheduling problem has recently been studied by Vairaktarakis and Aydinliyim (2007), Hezarkhani and Kubiak (2015), and Dereniowski and Kubiak (2017). Vairaktarakis and Aydinliyim (2007) consider the unweighted problem with a single shared processor and with each job allowed to use at most one time interval on the shared processor. This case is sometimes referred to as non-preemptive since jobs are not allowed preemption on the shared processor. Vairaktarakis and Aydinliyim (2007) prove that there are optimal schedules that complete job execution on its private and the shared processor at the same time; we call such schedules synchronized. It further shows that this guarantees that sequencing jobs in non-decreasing order of their processing times leads to an optimal solution for the case. Hezarkhani and Kubiak (2015) observes that this algorithm also gives optimal solutions to the preemptive unweighted problem where more than one interval can be used by a job on the shared processor. Dereniowski and Kubiak (2017) considers shared multi-processor problem proving its strong NP-hardness and giving an efficient, polynomial-time algorithm for the shared multi-processor problem with equal weights. Also, it is shown in Dereniowski and Kubiak (2017) that synchronized optimal schedules always exist for weighted multi-processor instances. Vairaktarakis and Aydinliyim (2007), Vairaktarakis (2013), and Hezarkhani and Kubiak (2015) also study decentralized subcontracting systems focusing on coordinating mechanisms to ensure their efficiency. Hezarkhani and Kubiak (2015) show such coordination mechanism for the unweighted problem and give examples where such schemes do not exist for the weighted problem.

The motivation to study the shared processor scheduling problem comes from diverse applications. Vairaktarakis and Aydinliyim (2007) consider it in the context of supply chains where subcontracting allows jobs to reduce their completion times by using a shared subcontractor’s processor. Bharadwaj et al. (2003) use the divisible load scheduling to reduce a job completion time in parallel and distributed computer systems, and Anderson (1981) argues for using batches of potentially infinitely small items that can be processed independently of other items of the batch in scheduling job-shops. We refer the reader to Dereniowski and Kubiak (2017) for more details on these applications.

We also remark multi-agent scheduling models in which each agent has its own optimality criterion and performs actions aimed at optimizing it. In these models, being examples of decentralized systems, agents usually have a number of non-divisible jobs to execute (depending on the optimization criterion this may be seen as having one divisible job, but restricted by allowing preemptions only at certain specified points). For minimization of weighted total completion time in such models see Lee et al. (2009) and weighted number of tardy jobs see Cheng et al. (2006). Bukchin and Hanany (2007) give an example of a game-theoretic analysis to a problem of this type. For overviews and further references on the multi-agent scheduling we refer to the book by Agnetis et al. (2014).

3 Problem formulation

We are given a set \(\mathcal {J}\) of n preemptive jobs. Each job \(j\in \mathcal {J}\) has its processing time \(p_j\) and weight \(w_j\). With each job \(j\in \mathcal {J}\) we associate its private processor denoted by \(\mathcal {P}_j\). Moreover, there exists a single shared processor, denoted by \(\mathcal {M}\), that is available for all jobs. We follow the convention and notation from Dereniowski and Kubiak (2017) to formulate the problem in this paper.

A schedule \(\mathcal {S}\) is feasible if it satisfies the following conditions:

  • each job \(j\in \mathcal {J}\) executes non-preemptively in a single time interval \((0,C_{\mathcal {S}}^{\mathcal {P}}(j))\) on its private processor and there is a (possibly empty) collection \(\mathcal {I}_j\) of open, non-empty intervals such that j executes non-preemptively in each time interval \(I\in \mathcal {I}_j\) on the shared processor,

  • for each job \(j\in \mathcal {J}\),

    $$\begin{aligned} C_{\mathcal {S}}^{\mathcal {P}}(j)+\sum _{I\in \mathcal {I}_j}|I| = p_j, \end{aligned}$$
  • the time intervals in \(\bigcup _{j\in \mathcal {J}}\mathcal {I}_j\) are pairwise disjoint (i.e., at most one job on \(\mathcal {M}\) at a time).

Given a feasible schedule \(\mathcal {S}\), for each job \(j\in \mathcal {J}\) we call any maximal time interval in which j executes on both private \(\mathcal {P}_j\) and shared \(\mathcal {M}\) simultaneously an overlap. Observe that this definition allows \(I\in \mathcal {I}_j\) not to be an overlap. Thus, the definition allows for feasible schedules that have jobs done on the shared processor but not on their private processors at the same time. These schedules may not be desirable (because they are not optimal) for the jobs, but they are included by the definition to remain consistent with the definition in Dereniowski and Kubiak (2017). The total overlap \(t_j\) of job j equals the sum of lengths of all overlaps for j. The total weighted overlap of \(\mathcal {S}\) equals

$$\begin{aligned} \varSigma (\mathcal {S})=\sum _{j\in \mathcal {J}}t_jw_j. \end{aligned}$$

A feasible schedule that maximizes the total weighted overlap is called optimal. Figure 1 gives examples of optimal schedules.

The formulation of our weighted single-processor scheduling problem (\({\texttt {WSPS}}\)) is as follows.

  • Instance A set of weighted jobs \(\mathcal {J}\) with arbitrary given processing times.

  • Goal Find an optimal schedule for \(\mathcal {J}\).

4 Preliminaries

The section provides a brief discussion of the main characteristics of optimal schedules on the shared processor. These characteristics simplify the formal arguments and algorithmic approach in Sects. 5 and 6.

Let \(\mathcal {S}\) be a feasible schedule. For j such that \(\mathcal {I}_j\ne \emptyset \), we denote by \(s_{\mathcal {S}}^{\mathcal {M}}(j)\) and \(C_{\mathcal {S}}^{\mathcal {M}}(j)\) the earliest and the latest time points, respectively, in which j executes on \(\mathcal {M}\), i.e.,

$$\begin{aligned} s_{\mathcal {S}}^{\mathcal {M}}(j)=\inf \bigcup _{I\in \mathcal {I}_j}I,\quad C_{\mathcal {S}}^{\mathcal {M}}(j)=\sup \bigcup _{I\in \mathcal {I}_j}I. \end{aligned}$$

For brevity we take \(s_{\mathcal {S}}^{\mathcal {M}}(j)=C_{\mathcal {S}}^{\mathcal {M}}(j)=0\) if \(\mathcal {I}_j=\emptyset \), i.e., j executes on its private processor only. Whenever \(s_{\mathcal {S}}^{\mathcal {M}}(j)<C_{\mathcal {S}}^{\mathcal {M}}(j)\), i.e., some non-empty part of a job j executes on \(\mathcal {M}\), then we say that the job j appears on \(\mathcal {M}\) in schedule \(\mathcal {S}\). If, in a schedule \(\mathcal {S}\), there is no idle time on the shared processor in time interval

$$\begin{aligned} \left[ 0,\max \{C_{\mathcal {S}}^{\mathcal {M}}(j)\,\bigl |\bigr .\,j\in \mathcal {J}\}\right] , \end{aligned}$$

then we say that \(\mathcal {S}\) has no gaps. We have the following results from the literature.

Observation 1

(Dereniowski and Kubiak 2017) There exists an optimal schedule that has no gaps.

A schedule \(\mathcal {S}\) is called non-preemptive if each job j executes in \(\mathcal {S}\) in time interval \([s_{\mathcal {S}}^{\mathcal {M}}(j),C_{\mathcal {S}}^{\mathcal {M}}(j)]\) on the shared processor. We say that a schedule \(\mathcal {S}\) is synchronizedFootnote 1 if it satisfies the following conditions:

  1. (i)

    \(\mathcal {S}\) is non-preemptive and has no gaps,

  2. (ii)

    for each job j that appears on the shared processor it holds \(C_{\mathcal {S}}^{\mathcal {M}}(j)=C_{\mathcal {S}}^{\mathcal {P}}(j)\).

Theorem 1

(Dereniowski and Kubiak 2017) There exists an optimal synchronized schedule.

Consider a synchronized schedule \(\mathcal {S}\). Let \(A=\{j_1,\ldots ,j_k\}\subseteq \mathcal {J}\) be the set of all jobs that appear on \(\mathcal {M}\) in \(\mathcal {S}\), where the jobs are ordered according to increasing order of their completion times in \(\mathcal {S}\), i.e., \(C_{\mathcal {S}}^{\mathcal {M}}(j_1)<\cdots <C_{\mathcal {S}}^{\mathcal {M}}(j_k)\). Note that the set A and the order are enough to determine the schedule \(\mathcal {S}\). Indeed, given the order \((j_1,\ldots ,j_k)\) we obtain that for each \(i\in \{1,\ldots ,k\}\) (by proceeding with increasing values of i in a synchronized schedule),

$$\begin{aligned} s_{\mathcal {S}}^{\mathcal {M}}(j_i)= & {} C_{\mathcal {S}}^{\mathcal {M}}(j_{i-1}) \quad {\mathrm{and}}\\ C_{\mathcal {S}}^{\mathcal {M}}(j_i)= & {} C_{\mathcal {S}}^{\mathcal {P}}(j_i)=\left( p_i+s_{\mathcal {S}}^{\mathcal {M}}(j_i)\right) /2, \end{aligned}$$

where \(C_{\mathcal {S}}^{\mathcal {M}}(j_0)=0\). Hence, the start times and completion times can be iteratively computed for all jobs in a synchronized schedule. Thus, for synchronized schedules we write for brevity \(\mathcal {S}=(j_1,\ldots ,j_k)\) to refer to the schedule computed above.

Fig. 2
figure 2

Transformation from \(\mathcal {S}'\) to \(\mathcal {S}''\) in proof of Lemma 2

5 A \(O(n \log n)\)-time optimal algorithm for antithetical instances

We call an instance \(\mathcal {J}\) of the problem antithetical if for any two jobs i and j it holds: \(p_i\le p_j\) implies \(w_i \ge w_j\). We call a schedule \(\mathcal {S}\) processing time ordered if \(\mathcal {S}=(j_1,\ldots ,j_n)\), where \(p_{j_i}\le p_{j_{i+1}}\) for each \(i\in \{1,\ldots ,n-1\}\). In other words, all jobs are present on the shared processor, they are arranged according to non-decreasing order of their processing times and the schedule is synchronized. The definition is correct since we observe that by the construction at the end of Sect. 4, \(\mathcal {S}\) is synchronized and all jobs from \(\mathcal {J}\) appear on the shared processor, see Vairaktarakis and Aydinliyim (2007) and Hezarkhani and Kubiak (2015). We now prove that any optimal solution for an antithetical instance is a processing time ordered schedule. We remark that this algorithm generalizes the previously known solutions for the unweighted case (\(w_1=\cdots =w_n\)) from Hezarkhani and Kubiak (2015), Vairaktarakis and Aydinliyim (2007).

Before giving the main result of this section in Lemma 3, we prove a technical lemma which shows how to transform a schedule with \(k-1\) synchronized jobs, i.e., jobs completing on the shared and private processors at the same time, into a schedule that has k jobs synchronized. This transformation will be used in the proof of Lemma 3.

Lemma 2

Let \(\mathcal {S}'\) be a non-preemptive schedule with no gaps. Consider a subset of jobs \(j_1,\ldots ,j_k\) for some \(k\in \{1,\ldots ,n\}\) and let \(i\in \{1,\ldots ,k-1\}\). Suppose that \(p_{j_i}\le p_{j_{i+1}}\le \cdots \le p_{j_k}\), and \(C_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})=C_{\mathcal {S}'}^{\mathcal {P}}(j_{i'})\) for each \(i'\in \{1,\ldots ,k\}\setminus \{i\}\), and one of the two cases holds:

  1. (i)

    exactly the jobs \(j_1,\ldots ,j_k\) appear on the shared processor in \(\mathcal {S}'\) in this order and \(C_{\mathcal {S}'}^{\mathcal {M}}(j_{i})<C_{\mathcal {S}'}^{\mathcal {P}}(j_{i})\), or

  2. (ii)

    exactly the jobs \(j_1,\ldots ,j_{i-1},j_{i+1},\ldots ,j_k\) appear on the shared processor in \(\mathcal {S}'\) in this order, \(p_{j_i}>s_{\mathcal {S}'}^{\mathcal {M}}(j_{i+1})\) and \(j_i\) does not appear on \(\mathcal {M}\).

Then, the synchronized schedule \(\mathcal {S}''=(j_1,\ldots ,j_k)\) satisfies

$$\begin{aligned} \varSigma (\mathcal {S}'') = \varSigma (\mathcal {S}') + \varepsilon w_{j_i} - \varepsilon \sum _{i'=i+1}^{k}\frac{w_{j_{i'}}}{2^{i'-i}} \end{aligned}$$

for some \(\varepsilon >0\).

Proof

The transformation described in the proof is shown in Fig. 2. Informally speaking, we obtain \(\mathcal {S}''\) by moving a part of \(j_i\) from its private processor to the shared processor \(\mathcal {M}\), so that \(j_i\) becomes synchronized, i.e., it ends on both of these processors at the same time. This move forces all jobs that follow \(j_i\) on \(\mathcal {M}\), i.e., the jobs \(j_{i+1},\ldots ,j_k\), to be postponed on \(\mathcal {M}\) as described below. Note that the transformation is exactly the same for both case (i) and case (ii) but Fig. 2 depicts case (i) only.

Let

$$\begin{aligned} \varepsilon = \frac{1}{2}\left( C_{\mathcal {S}'}^{\mathcal {P}}(j_i) -s_{\mathcal {S}'}^{\mathcal {M}}(j_{i+1})\right) . \end{aligned}$$

Note that \(\varepsilon >0\) by the lemma assumption. We now obtain a schedule \(\mathcal {S}''\) as follows. For \(i'\in \{i+1,\ldots ,k\}\), the start of the job \(j_{i'}\) is postponed by \(\varepsilon /2^{i'-i-1}\) on \(\mathcal {M}\), i.e.,

$$\begin{aligned} s_{\mathcal {S}''}^{\mathcal {M}}(j_{i'})=s_{\mathcal {S}'}^{\mathcal {M}}(j_{i'}) +\frac{\varepsilon }{2^{i'-i-1}}=s_{\mathcal {S}'}^{\mathcal {M}}(j_{i'}) +\frac{2\varepsilon }{2^{i'-i}}, \end{aligned}$$
(1)

the completion of job \(j_{i'}\) is postponed by \(\varepsilon /2^{i'-i}\) on \(\mathcal {M}\) and on \(\mathcal {P}_{j_{i'}}\), i.e.,

$$\begin{aligned} C_{\mathcal {S}''}^{\mathcal {M}}(j_{i'})=C_{\mathcal {S}''}^{\mathcal {P}}(j_{i'}) =C_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})+\frac{\varepsilon }{2^{i'-i}}. \end{aligned}$$
(2)

Thus, \(j_{i'}\) completes on both \(\mathcal {M}\) and \(\mathcal {P}_{j_{i'}}\) at the same time for \(i'\in \{i+1,\ldots ,k\}\). Moreover, \(s_{\mathcal {S}''}^{\mathcal {M}}(j_i)=s_{\mathcal {S}'}^{\mathcal {M}}(j_i)\) in case (i) and \(s_{\mathcal {S}''}^{\mathcal {M}}(j_i)=s_{\mathcal {S}'}^{\mathcal {M}}(j_{i+1})\) in case (ii). Then, let \(C_{\mathcal {S}''}^{\mathcal {M}}(j_i)=s_{\mathcal {S}''}^{\mathcal {M}}(j_{i+1})\) (thus in both cases the duration of \(j_i\) on \(\mathcal {M}\) increases by \(\varepsilon \)) and the remaining part of length \(C_{\mathcal {S}}^{\mathcal {P}}(j_i)-\varepsilon \) of \(j_i\) executes on \(\mathcal {P}_{j_i}\) so that \(j_{i}\) completes on both \(\mathcal {M}\) and \(\mathcal {P}_{j_{i}}\) at the same time as well. Finally, \(\mathcal {S}''\) and \(\mathcal {S}'\) are identical in time interval \([0,C_{\mathcal {S}'}^{\mathcal {M}}(j_{i}))\). From the transformation we obtain that

$$\begin{aligned} \varSigma (\mathcal {S}'')=\varSigma (\mathcal {S}')+\varepsilon w_{j_i}-\varepsilon \sum _{i'=i+1}^k \frac{w_{j_{i'}}}{2^{i'-i}}. \end{aligned}$$
(3)

Indeed, the amount of \(j_i\) present on \(\mathcal {M}\) increases by \(\varepsilon \), and the amount of \(j_{i'}\) decreases by \(\varepsilon /2^{i'-i}\) for each \(i'\in \{i+1,\ldots ,k\}\).

Clearly the transformation ensures that \(\mathcal {S}''\) is non-preemptive and has no gaps as long as \(\mathcal {S}'\) is non-preemptive and has no gaps, which holds by assumption. By lemma’s assumption, the execution time of \(j_i\) in \(\mathcal {S}''\) is well defined. Thus, it remains to argue that the jobs \(j_{i+1}, \ldots , j_{k}\) are present on \(\mathcal {M}\) in \(\mathcal {S}''\), i.e., that the execution times of these jobs are properly defined. To that end we need to prove that

$$\begin{aligned} C_{\mathcal {S}''}^{\mathcal {M}}(j_{i'})- s_{\mathcal {S}''}^{\mathcal {M}}(j_{i'})= C_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})- s_{\mathcal {S}'}^{\mathcal {M}}(j_{i'}) -\frac{\varepsilon }{2^{i'-i}}>0, \end{aligned}$$

for each \(i'\in \{i+1,\ldots ,k\}\). By induction on \(i'\) we get

$$\begin{aligned} C_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})- s_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})=\frac{p_{j_{i'}}}{2}- \sum _{\ell =i+1}^{i'-1} \frac{p_{j_{\ell }}}{2^{i'-\ell +1}} - \frac{x}{2^{i'-i}} \end{aligned}$$

for each \(i'\in \{i+1,\ldots ,k\}\), where \(x= s_{\mathcal {S}'}^{\mathcal {M}}(j_{i+1})\). Since \(p_{j_i}\le p_{j_{i+1}}\le \cdots \le p_{j_k}\), we have

$$\begin{aligned} C_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})- s_{\mathcal {S}'}^{\mathcal {M}}(j_{i'})\ge \frac{p_{j_{i'}}}{2^{i'-i}}-\frac{x}{2^{i'-i}}. \end{aligned}$$

Thus, it suffices to show that

$$\begin{aligned} p_{j_{i'}}-x > \varepsilon . \end{aligned}$$

By definition of \(\varepsilon \) this boils down to showing that

$$\begin{aligned} 2p_{j_{i'}}>C_{\mathcal {S}'}^{\mathcal {P}}(j_i)+x. \end{aligned}$$

This inequality holds since \(p_{j_i}\ge C_{\mathcal {S}'}^{\mathcal {P}}(j_i)>x\) and thus we get

$$\begin{aligned} 2p_{j_{i'}}\ge 2p_{j_i}>C_{\mathcal {S}'}^{\mathcal {P}}(j_i)+x, \end{aligned}$$

which completes the argument and proves that \(\mathcal {S}''\) is feasible. This implies that \(\mathcal {S}''\) is feasible and synchronized. Observe that though we assumed \(C_{\mathcal {S}'}^{\mathcal {M}}(j_{i}) - s_{\mathcal {S}'}^{\mathcal {M}}(j_{i})>0\) in case (i) of the lemma, we have not used this assumption in the proof. Hence, the proof also works for case (ii) in which one can equivalently take \(C_{\mathcal {S}'}^{\mathcal {M}}(j_{i}) - s_{\mathcal {S}'}^{\mathcal {M}}(j_{i})=0\). We use this observation in the proof of Lemma 3 where the case of \(j_{i}\) absent from \(\mathcal {M}\) in \(\mathcal {S}'\) needs to be considered (i.e., when we refer to case (ii) of this lemma). \(\square \)

We remark that it is still premature to conclude from Lemma 2 that no job is missing on \(\mathcal {M}\) in an optimal schedule \(\mathcal {S}\). This would simplify the proof of Lemma 3 as it would eliminate case (5) in the proof. However, an insertion of a job missing on \(\mathcal {M}\) in \(\mathcal {S}\) requires the jobs on \(\mathcal {M}\) to the right of the insertion point to be ordered according to the non-decreasing order of processing times. Otherwise, if this key assumption in Lemma 2 is not met, then the synchronized schedule \(\mathcal {S}''\) from Lemma 2 may not be feasible or may not satisfy the formula for its total weighted overlap given in the lemma. Unfortunately, at this point we cannot guarantee that \(\mathcal {S}\) satisfies the assumption.

Lemma 3

An optimal schedule for an antithetical instance of the problem \({\texttt {WSPS}}\) is a processing time ordered schedule.

Proof

Let \(\mathcal {S}\) be an optimal schedule for an antithetical instance \(\mathcal {J}\). By Theorem 1 we can assume that \(\mathcal {S}\) is synchronized. We assume without loss of generality that the jobs in \(\mathcal {J}=\{1,\ldots ,n\}\) are ordered in non-decreasing order of their processing times, i.e., \(p_1\le p_2 \le \cdots \le p_n\). Let \(A \subseteq \mathcal {J}\) be the set of jobs that appear on the shared processor in \(\mathcal {S}\). Let \(\pi (1), \pi (2), \ldots ,\pi (k)\), \(k=|A|\), be the order of jobs on the shared processor in \(\mathcal {S}\), i.e., \(\mathcal {S}=(\pi (1), \pi (2), \ldots ,\pi (k))\). We have \(n\in A\). Indeed, by Vairaktarakis and Aydinliyim (2007) and Hezarkhani and Kubiak (2015) regardless of the ordering of the jobs \(1,\ldots ,n-1\), it is always possible to add the job n as the last one on \(\mathcal {M}\) and increase the total overlap.

If for an index \(i\in \{1,\ldots ,k-1\}\) it holds

$$\begin{aligned} p_{\pi (i)}>p_{\pi (i+1)} \end{aligned}$$
(4)

or if for an index \(i\in \{1,\ldots ,k\}\) it holds

$$\begin{aligned} \bar{j}=\pi (i)-1\notin A, \end{aligned}$$
(5)

then the job \(\pi (i)\) is called a violator. Informally speaking, the condition (4) detects whether some jobs in \(\mathcal {S}\) do not follow the non-decreasing order of the processing times required by the processing time ordered schedule. The condition (5) detects whether some job is missing on the shared processor in \(\mathcal {S}\), namely, the job \(\bar{j}\) should precede the job \(\pi (i)\) on \(\mathcal {M}\) in the processing time ordered schedule but \(\bar{j}\) does not appear on \(\mathcal {M}\) in \(\mathcal {S}\).

Since \(n\in A\), we have that if there is no violator, then \(\mathcal {S}\) is a processing time ordered schedule and the proof of the lemma is thus completed. Therefore, we assume in the following that at least one violator exists. Then, the maximal index \(i\in \{1,\ldots ,k\}\) such that \(\pi (i)\) is the violator is called the violation point in \(\mathcal {S}\).

Among all optimal and synchronized schedules for \(\mathcal {J}\) we take \(\mathcal {S}\) to satisfy the following:

  1. (a)

    |A| is maximum, and

  2. (b)

    with respect to (a): the violation point of \(\mathcal {S}\) is minimum.

Let \(i>0\) be the violation point of \(\mathcal {S}\). By definition, we have that one of the cases (4) or (5) holds. We should arrive at a contradiction in both cases, and we start by analyzing the case of (4), that is, we assume that (4) holds for the violation point i. For antithetical instances we have \(w_{\pi (i)}\le w_{\pi (i+1)}\). Also, for convenience and without loss of generality we denote \(j=\pi (i+1)\) and \(j+1=\pi (i)\). Thus, \(p_{j+1}>p_j\) by (4). In the next two paragraphs we describe a transition from \(\mathcal {S}\) to a new schedule \(\mathcal {S}'\). This transition is depicted in Fig. 3.

Fig. 3
figure 3

Transition from \(\mathcal {S}\) to \(\mathcal {S}'\) in proof of Lemma 3

Consider the intervals in which the two jobs j and \(j+1\) execute on \(\mathcal {M}\) in \(\mathcal {S}\) and suppose that \(j+1\) starts at t on \(\mathcal {M}\), \(s_{\mathcal {S}}^{\mathcal {M}}(j+1)=t\). Since \(\mathcal {S}\) is synchronized, the length \(l=C_{\mathcal {S}}^{\mathcal {M}}(j)-s_{\mathcal {S}}^{\mathcal {M}}(j+1)\) of this sequence on the shared processor equals

$$\begin{aligned} l= & {} \left( C_{\mathcal {S}}^{\mathcal {M}}(j) - s_{\mathcal {S}}^{\mathcal {M}}(j)\right) + \left( C_{\mathcal {S}}^{\mathcal {M}}(j+1) - s_{\mathcal {S}}^{\mathcal {M}}(j+1)\right) \nonumber \\= & {} \frac{p_{j}-t}{2}+\frac{p_{j+1}-t}{4}, \end{aligned}$$
(6)

and its contribution x to the total weighted overlap equals

$$\begin{aligned} x&=\left( C_{\mathcal {S}}^{\mathcal {M}}(j+1) - s_{\mathcal {S}}^{\mathcal {M}}(j+1)\right) w_{j+1}\nonumber \\&\quad +\,\left( C_{\mathcal {S}}^{\mathcal {M}}(j) - s_{\mathcal {S}}^{\mathcal {M}}(j)\right) w_j\nonumber \\&=\frac{p_{j+1}-t}{2}\left( w_{j+1}-\frac{w_j}{2}\right) +\frac{p_{j}-t}{2}w_{j}. \end{aligned}$$
(7)

Thus, we can express the total weighted overlap of \(\mathcal {S}\) as follows:

$$\begin{aligned} \varSigma (\mathcal {S})=c+x \quad \text {for some } c\in \mathbb {R}. \end{aligned}$$
(8)

Before we formally define \(\mathcal {S}'\), we analyze the impact the reversed order of the two jobs j and \(j+1\) in the interval \((t,t+l)\) has on \(\mathcal {S}\) and its total weighted overlap. Suppose for the time being that j starts at t on \(\mathcal {M}\) and is followed by the job \(j+1\), and that each of these jobs completes both on \(\mathcal {M}\) and its private processor at the same time. Then the length \(l'\) of the interval \((t,t+l')\) occupied by these two jobs on the shared processor equals

$$\begin{aligned} l'=\frac{p_{j+1}-t}{2}+\frac{p_j-t}{4} \end{aligned}$$

and its contribution \(x'\) to the total weighted overlap equals

$$\begin{aligned} x'=\frac{p_j-t}{2}\left( w_j-\frac{w_{j+1}}{2}\right) +\frac{p_{j+1}-t}{2}w_{j+1}. \end{aligned}$$
(9)

Clearly, \(l'>l\) for \(p_{j+1}>p_j\) by

$$\begin{aligned} l'-l=\frac{p_{j+1}-p_{j}}{4}. \end{aligned}$$
(10)

The job j completes at

$$\begin{aligned} t'=t+\frac{p_j-t}{2}<t+\frac{p_j-t}{2}+\frac{p_{j+1}-t}{4}=t+l \end{aligned}$$
(11)

after the exchange. We construct the schedule \(\mathcal {S}'\) as follows: \(\mathcal {S}\) and \(\mathcal {S}'\) are identical in time intervals [0, t) and \((t+l,+\infty )\), the job j executes in time interval

$$\begin{aligned} (t,t')=(t,t+(p_j-t)/2) \end{aligned}$$
(12)

in \(\mathcal {S}'\) and the job \(j+1\) executes in time interval

$$\begin{aligned} (t',t+l)=(t+(p_j-t)/2,t+l) \end{aligned}$$
(13)

on processor \(\mathcal {M}\) in \(\mathcal {S}'\). Note that j finishes at the same time on its private and shared processor in \(\mathcal {S}'\) while the job \(j+1\) does not have this property. Since \(p_{j+1}>p_j\), \(j+1\) completes \((p_{j+1}-p_{j})/4\) units later on its private processor than on \(\mathcal {M}\). Thus, \(\mathcal {S}'\) is not synchronized; see also Fig. 3. The total weighted overlap of \(\mathcal {S}'\) is then by (6), (12) and (13):

$$\begin{aligned} \begin{aligned} \varSigma (\mathcal {S}')&= c + (t'-t)w_j+(t+l-t')w_{j+1}, \\&= c + \frac{p_j-t}{2}w_j + \frac{p_{j+1}-t}{4}w_{j+1} \end{aligned} \end{aligned}$$
(14)

where c is defined in (8). By (8) and (14) we obtain that the difference (in total weighted overlaps) between \(\mathcal {S}'\) and \(\mathcal {S}\) is

$$\begin{aligned} \varSigma (\mathcal {S}')-\varSigma (\mathcal {S}) = \frac{p_{j+1}-t}{4}(w_j-w_{j+1}). \end{aligned}$$
(15)

Since \(p_{j+1}-t>0\) (this holds since the job \(j+1\) appears on the shared processor in \(\mathcal {S}\)) and \(w_{j}\ge w_{j+1}\), we have that \(\varSigma (\mathcal {S}')-\varSigma (\mathcal {S})\ge 0\). Note that if \(w_j\) is strictly greater than \(w_{j+1}\), then we obtain the desired contradiction with the optimality of \(\mathcal {S}\). However, if \(w_j=w_{j+1}\), then \(\varSigma (\mathcal {S})=\varSigma (\mathcal {S}')\) and we need to use different arguments to arrive at a contradiction.

Fig. 4
figure 4

Transition from \(\mathcal {S}'\) to \(\mathcal {S}''\) in proof of Lemma 3 when proving (16)

To that end denote

$$\begin{aligned} q=\sum _{i'=i+2}^k \frac{w_{\pi (i')}}{2^{i'-i-1}}. \end{aligned}$$

We show that

$$\begin{aligned} w_{j+1}\ge q. \end{aligned}$$
(16)

Suppose for a contradiction that \(w_{j+1}<q\). To obtain a contradiction with this assumption we will convert \(\mathcal {S}'\) into a schedule \(\mathcal {S}''\) with strictly greater total weighted overlap, which will contradict the optimality of the original schedule \(\mathcal {S}\). This conversion is described in the next two paragraphs and depicted in Fig. 4. Let

$$\begin{aligned} \varepsilon =C_{\mathcal {S}'}^{\mathcal {M}}(j+1)-s_{\mathcal {S}'}^{\mathcal {M}}(j+1). \end{aligned}$$

Observe that \(\varepsilon >0\) by (10). By assumption, \(\mathcal {S}\) is synchronized and \(\mathcal {S}\) and \(\mathcal {S}'\) are identical on \(\mathcal {M}\) in time intervals \([C_{\mathcal {S}'}^{\mathcal {M}}(j+1),+\infty )\). Thus,

$$\begin{aligned} C_{\mathcal {S}'}^{\mathcal {M}}(i')=C_{\mathcal {S}}^{\mathcal {M}}(i')=C_{\mathcal {S}}^{\mathcal {P}}(i')=C_{\mathcal {S}'}^{\mathcal {P}}(i') \end{aligned}$$

for each job \(i'\) that appears on \(\mathcal {M}\) and completes in \(\mathcal {S}'\) later than the job \(j+1\). The schedule \(\mathcal {S}''\) is defined as follows. Let, \(\mathcal {S}''\) and \(\mathcal {S}'\) be identical on \(\mathcal {M}\) in time interval

$$\begin{aligned} \left[ 0,C_{\mathcal {S}'}^{\mathcal {M}}(j+1)-\varepsilon \right) =\left[ 0,s_{\mathcal {S}'}^{\mathcal {M}}(j+1)\right) . \end{aligned}$$

Then, the job \(j+1\) is not present on \(\mathcal {M}\) in \(\mathcal {S}'\), i.e., it executes only on \(\mathcal {P}_{j+1}\) in \(\mathcal {S}''\). Finally, for each job \(\pi (i')\), \(i'\in \{i+2,\ldots ,k\}\), we set:

$$\begin{aligned} s_{\mathcal {S}''}^{\mathcal {M}}(\pi (i'))= & {} s_{\mathcal {S}'}^{\mathcal {M}}(\pi (i')) -\frac{\varepsilon }{2^{i'-i-2}},\\ C_{\mathcal {S}''}^{\mathcal {M}}(\pi (i'))= & {} C_{\mathcal {S}'}^{\mathcal {M}}(\pi (i')) -\frac{\varepsilon }{2^{i'-i-1}},\\ C_{\mathcal {S}''}^{\mathcal {P}}(\pi (i'))= & {} C_{\mathcal {S}'}^{\mathcal {P}}(\pi (i')) -\frac{\varepsilon }{2^{i'-i-1}}. \end{aligned}$$

Both \(\mathcal {S}''\) and \(\mathcal {S}'\) are the same on \(\mathcal {P}_{i'}\) for each \(i'\in \mathcal {J}\setminus \{j+1,\pi (i+2),\ldots ,\pi (k)\}\), i.e., on each processor not specified by the formulas above.

Clearly, \(\mathcal {S}''\) is feasible and synchronized. To compare its total weighted overlap to that of \(\mathcal {S}'\), note that on the one hand the total weighted overlap of \(\mathcal {S}''\) decreases by \(\varepsilon w_{j+1}\) in comparison with \(\mathcal {S}'\) since the job \(j+1\) does not appear on \(\mathcal {M}\) in \(\mathcal {S}''\), on the other hand it increases since the subintervals with the jobs that follow \(j+1\) on \(\mathcal {M}\) get longer due to disappearance of \(j+1\) from \(\mathcal {M}\). Precisely, we have

$$\begin{aligned} \varSigma (\mathcal {S}'')= & {} \varSigma (\mathcal {S}')-\varepsilon w_{j+1}+\varepsilon \sum _{i'=i+2}^k \frac{w_{i'}}{2^{i'-i-1}}\\= & {} \varSigma (\mathcal {S}')+\varepsilon (q-w_{j+1})>\varSigma (\mathcal {S}') \end{aligned}$$

because \(\varepsilon >0\) and \(w_{j+1}<q\) by assumption. Thus, we obtain a contradiction with the optimality of \(\mathcal {S}\) (recall that \(\varSigma (\mathcal {S})\le \varSigma (\mathcal {S}')\)). Hence, (16) holds.

By Lemma 2, we obtain a synchronized schedule \(\mathcal {S}^*\) from \(\mathcal {S}'\). Moreover by (16) we have \(\varSigma (\mathcal {S}^*)\ge \varSigma (\mathcal {S}')\). In particular, if \(\varSigma (\mathcal {S}^*)>\varSigma (\mathcal {S}')\), then we have immediately a contradiction with the optimality of \(\mathcal {S}\) since \(\varSigma (\mathcal {S}')\ge \varSigma (\mathcal {S})\). On the other hand, if \(\varSigma (\mathcal {S}^*)=\varSigma (\mathcal {S}')\), then the contradiction comes from the selection of \(\mathcal {S}\) to be a schedule that minimizes the violation point i. Observe that since the intervals in (12) and (13) are non-empty then all \(\mathcal {S}\), \(\mathcal {S}'\), and \(\mathcal {S}^*\) have the same number |A| of jobs that appear on the shared processor.

Fig. 5
figure 5

An example of the key sequence (the area of the gray part equals \(u^{*}\))

We now consider case (5). We can assume

$$\begin{aligned} p_{\pi (i-1)}\le p_{\pi (i)} \end{aligned}$$
(17)

since if the inequality does not hold we get case (4) which we already considered. We assume \(p_{\pi (0)}=0\) in (17). Recall that \(\mathcal {S}=(\pi (1),\ldots ,\pi (k))\) and \(\bar{j}\notin A\). By (17) and (5) we have

$$\begin{aligned} C_{\mathcal {S}}^{\mathcal {M}}(\pi (i-1))<p_{\pi (i-1)}\le p_{\bar{j}}\le p_{\pi (i)} \end{aligned}$$
(18)

for \(i>1\). We apply Lemma 2(ii) to \(\mathcal {S}'\) with \(j_1=\pi (1),\ldots ,j_{i-1}=\pi (i-1)\), \(j_i=\bar{j}\) and \(j_{i+1}=\pi (i),\ldots \), when \(i>1\) and with \(j_1=\bar{j}\), \(j_2=\pi (1),j_3=\pi (2),\ldots \) when \(i=1\). Observe that since i is the violation point of \(\mathcal {S}\) and (5) holds, we have \(w_{\bar{j}}\ge w_{\pi (i')}\) for each \(i'\in \{i,\ldots ,k\}\) in the antithetical instance \(\mathcal {J}\). Therefore,

$$\begin{aligned} \sum _{i'=i}^k \frac{w_{\pi (i')}}{2^{i'-i+1}} \le w_{\bar{j}}\sum _{i'=i}^k \frac{1}{2^{i'-i+1}}< w_{\bar{j}}. \end{aligned}$$

Hence, by Lemma 2(ii), there exists a schedule \(\mathcal {S}^*\) for which we have \(\varSigma (\mathcal {S}^*)>\varSigma (\mathcal {S}')\). Thus, we again have a contradiction by the optimality of \(\mathcal {S}\) since clearly \(\varSigma (\mathcal {S}')=\varSigma (\mathcal {S})\). This completes the proof of the lemma. \(\square \)

Due to the fact that some jobs may have equal processing times yet different weights in an antithetical instance not all processing time ordered schedules are optimal for the instance. However any processing time ordered schedule \(\mathcal {S}=(j_1,\ldots ,j_n)\) such that \(w_{j_1}\ge \cdots \ge w_{j_n}\) is optimal for the instance. To prove that we observe that any maximal sequence of jobs having the same processing times occupies the same interval (sC) on \(\mathcal {M}\) in any processing time ordered schedule. However, the earlier the job appears in the sequence the longer is its overlap, moreover the overlaps in (sC) remain the same regardless of the sequence of jobs having equal processing times. Hence, the first position should be occupied by the heaviest job, the second position by the second heaviest job etc. among the jobs with the same processing times to ensure total weighted overlap maximization. This gives an \(O(n\log n)\)-time optimization algorithm for the antithetical instances.

6 A 1/2-approximation algorithm

Let \(0=q_0<q_{1}<\cdots <q_{\ell }\) and \(u_{1},\ldots ,u_{\ell }\ge 0\) for some \(\ell \ge 1\). An envelope for \(q_{1},\ldots ,q_{\ell }\) and \(u_{1},\ldots ,u_{\ell }\) is a step function of non-negative x defined as follows

$$\begin{aligned} e(q_{1},\ldots ,q_{\ell },u_{1},\ldots ,u_{\ell },x)=\left\{ \begin{array}{ll} u_{1} &{} \text {if }q_{0}\le x\le q_{1} \\ u_{2} &{} \text {if }q_{1}<x\le q_{2} \\ &{}\ldots \\ u_{\ell } &{} \text {if }q_{\ell -1}<x\le q_{\ell } \\ 0 &{} \text {if }q_{\ell }<x. \end{array} \right. \end{aligned}$$

The area of the envelope e is

$$\begin{aligned} \sum _{i=1}^{\ell }u_{i}(q_{i}-q_{i-1}). \end{aligned}$$

Let \(\mathcal {J}\) be a set of jobs. Without loss of generality we assume \(p_{1}\le \cdots \le p_{n}\), and for any tie (i.e., for equal processing times) we assume that the jobs are ordered in non-decreasing order of their weights, i.e., the heaviest tied job comes last in the tie. A sequence of jobs \(i_1,\ldots ,i_{\ell }\) for some \(\ell \ge 1\), where \(1\le i_{1}<\cdots <i_{\ell }\le n\), is called a key sequence for \(\mathcal {J}\) if it satisfies the following conditions:

  1. (i)

    \(i_{\ell }=n\),

  2. (ii)

    \(w_{i_{1}}>\cdots >w_{i_{\ell }}\),

  3. (iii)

    \(w_{k}\le w_{i_{j}}\) for each \(k\in I_{i_{j}}=\{i_{j-1}+1,\ldots ,i_{j}\}\) and \(j\in \{1,\ldots ,\ell \}\), where \(i_0=0\).

Clearly \(p_{i_{1}}<\cdots <p_{i_{\ell }}\), thus \(u(p_{i_{1}},\ldots ,p_{i_{\ell }},w_{i_{1}},\ldots ,w_{i_{\ell }},x)\) is an envelope; we refer to it as the upper envelope for \(\mathcal {J}\). Let \(u^{*}\) be the area of the upper envelope for \(\mathcal {J}\). See Fig. 5 for an example.

Note that the key sequence always exists. This follows from the fact that it can be constructed ‘greedily’ by starting with picking the last job of the sequence [(see (i)] and then iteratively selecting the predecessor of the previously selected job so that the predecessor has strictly bigger weight [see (ii)] and satisfies the condition (iii). Also, the key sequence is unique by the same argument.

We have the following simple observation.

Claim

For each \(k \in \{1,\ldots ,\ell \}\), \(w_{i_{k}}=\max \{w_{j}\,\bigl |\bigr .\,i_{k}\le j\le n\}\). \(\square \)

The key sequence for \(\mathcal {J}\) defines a synchronized schedule \(\mathcal {S}_{{\mathrm{key}}}\) for \(\mathcal {J}\) with the set of jobs executed on the shared processor being \(\mathcal {J}_{{\mathrm{key}}}=\{i_{1},\ldots ,i_{\ell }\}\) and the permutation of the jobs on the processor being \(\pi (j)=i_{j}\) for \(j\in \{1,\ldots ,\ell \}\). The jobs in \(\mathcal {J}\setminus \mathcal {J}_{{\mathrm{key}}}\) are executed on their private processors only. Following our notation introduced in Sect. 4, we get \(\mathcal {S}_{{\mathrm{key}}}=(i_1,\ldots ,i_{\ell })\). We have the following lemma.

Lemma 4

For the schedule \(\mathcal {S}_{{\mathrm{key}}}\) it holds \(2\varSigma (\mathcal {S}_{{\mathrm{key}}})\ge u^{*}\).

Proof

We argue that for each \(k\in \{1,\ldots ,\ell \}\),

$$\begin{aligned} w_{i_{k}}\left( C_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k}) -s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})\right) \ge w_{i_{k}}\frac{p_{i_{k}} - p_{i_{k-1}}}{2}, \end{aligned}$$
(19)

where \(p_{i_0}=0\). Note that \(s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})\le p_{i_{k-1}}\) for each \(k\in \{1,\ldots ,\ell \}\). Thus,

$$\begin{aligned} C_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})-s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})= & {} \frac{s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})+p_{i_k}}{2} -s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k}) \\\ge & {} \frac{p_{i_k}-p_{i_{k-1}}}{2} \end{aligned}$$

for each \(k\in \{1,\ldots ,\ell \}\), which proves (19).

By (19),

$$\begin{aligned} \varSigma (\mathcal {S}_{{\mathrm{key}}})= & {} \sum _{k=1}^{\ell } w_{i_{k}}\left( C_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k}) -s_{\mathcal {S}_{{\mathrm{key}}}}^{\mathcal {M}}(i_{k})\right) \\\ge & {} \sum _{k=1}^{\ell } w_{i_{k}}\frac{p_{i_{k}} - p_{i_{k-1}}}{2} = \frac{u^{*}}{2}. \end{aligned}$$

\(\square \)

We now prove that the area \(u^{*}\) of the upper envelope for \(\mathcal {J}\) is an upper bound on the total weighted overlap of an optimal solution for \(\mathcal {J}\). By Theorem 1, there exists an optimal synchronized schedule \(\mathcal {S}_{{\mathrm{opt}}}\) for \(\mathcal {J}\). Let \(\mathcal {J}_{{\mathrm{opt}}}\subseteq \mathcal {J}\) be the set of jobs that appear on the shared processor in \(\mathcal {S}_{{\mathrm{opt}}}\) and let \(\pi \) be the permutation of jobs on the shared processor in \(\mathcal {S}_{{\mathrm{opt}}}\). Thus, we have \(\mathcal {S}_{{\mathrm{opt}}}=(\pi (1),\ldots ,\pi (|\mathcal {J}_{{\mathrm{opt}}}|))\). It holds \(0<C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (1))< \cdots< C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (|\mathcal {J}_{{\mathrm{opt}}}|)) <p_{n}\) and therefore

$$\begin{aligned} e\left( C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (1)),\ldots , C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (|\mathcal {J}_{{\mathrm{opt}}}|)),w_{\pi (1)},\ldots ,w_{\pi (|\mathcal {J}_{{\mathrm{opt}}}|)},x\right) . \end{aligned}$$

is an envelope for \(C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (1)), \ldots , C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (|\mathcal {J}_{{\mathrm{opt}}}|))\) and \(w_{\pi (1)},\ldots ,w_{\pi (|\mathcal {J}_{{\mathrm{opt}}}|)}\). Let the area of this envelope be \(e^{*}\). We have the following key result.

Lemma 5

It holds \(e^{*}\le u^{*}\).

Proof

Observe that for each index \(j\in \{1,\ldots ,|\mathcal {J}_{{\mathrm{opt}}}|\}\) there exists \(\tau (j)\in \{1,\ldots ,n\}\) such that

$$\begin{aligned} C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (j)) \le p_{i_{\tau (j)}}. \end{aligned}$$
(20)

This follows from condition (i) in definition of key sequence. If, for a given j, there are several jobs \(\tau (j)\) that satisfy the above, then take \(\tau (j)\) to be the smallest one.

We argue that

$$\begin{aligned} w_{\pi (j)}\le w_{i_{\tau (j)}} \end{aligned}$$
(21)

for each \(j\in \{1,\ldots ,|\mathcal {J}_{{\mathrm{opt}}}|\}\). Suppose for a contradiction that (21) does not hold. We consider two cases. In the first case let

$$\begin{aligned} p_{\pi (j)}\le p_{i_{\tau (j)}}. \end{aligned}$$

By condition (iii) in definition of the key sequence and the minimality of \(\tau (j)\), \(\pi (j)\) does not belong to the key sequence. But then, \(w_{\pi (j)} > w_{i_{\tau (j)}}\) implies that there is t such that \(p_{\pi (j)}<p_{i_t}<p_{i_{\tau (j)}}\), which contradicts the choice of \(\tau (j)\). In the second case let

$$\begin{aligned} p_{\pi (j)} > p_{i_{\tau (j)}}. \end{aligned}$$

Take the minimum index t such that \(p_{i_t}\ge p_{\pi (j)}\). By condition (iii) in definition of the key sequence, \(w_{i_t}\ge w_{\pi (j)}\). Since \(w_{\pi (j)} > w_{i_{\tau (j)}}\), condition (ii) in definition of the key sequence implies that \(i_{\tau (j)}\) does not belong to the key sequence — a contradiction. This completes the proof of (21).

Let \(x\in [C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (j-1)),C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (j))]\) for some \(j\in \{1,\ldots ,|\mathcal {J}_{{\mathrm{opt}}}|\}\), where we take \(C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (0))=0\). Denote for brevity

$$\begin{aligned} \tilde{e}(x) = e\left( C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (1)), \ldots ,C_{\mathcal {S}_{{\mathrm{opt}}}}^{\mathcal {M}}(\pi (|\mathcal {J}_{{\mathrm{opt}}}|)),w_{\pi (1)},\ldots ,w_{\pi (|\mathcal {J}_{{\mathrm{opt}}}|)},x\right) \end{aligned}$$

and

$$\begin{aligned} \tilde{u}(x)=u\left( p_{i_{1}},\ldots ,p_{i_{\ell }}, w_{i_{1}},\ldots ,w_{i_{\ell }},x\right) \end{aligned}$$

for each real x. By definition,

$$\begin{aligned} \tilde{e}(x) \le w_{\pi (j)}. \end{aligned}$$

By (21), \(w_{\pi (j)}\le w_{i_{\tau (j)}}\). By (20), \(x\le p_{i_{\tau (j)}}\) and hence by the monotonicity of u,

$$\begin{aligned} w_{i_{\tau (j)}}\le \tilde{u}(x). \end{aligned}$$

Hence, we obtain:

$$\begin{aligned} \tilde{e}(x) \le \tilde{u}(x). \end{aligned}$$
(22)

Since the index j was selected arbitrarily, the above inequality holds for each \(x\ge 0\). Note that the inequality in (22) implies that the integral of \(\tilde{e}(x)\) is less than or equal to the integral of \(\tilde{u}(x)\). Since the former equals \(e^{*}\) and the latter equals \(u^{*}\), this completes the proof. \(\square \)

Since \(\varSigma (\mathcal {S}_{{\mathrm{opt}}})=e^{*}\) and \(\varSigma (\mathcal {S}_{{\mathrm{key}}})\le \varSigma (\mathcal {S}_{{\mathrm{opt}}})\), Lemmas 4 and 5 give the following.

Corollary 1

It holds \(e^{*}/2\le \varSigma (\mathcal {S}_{{\mathrm{key}}}) \le e^{*}\). \(\square \)

Theorem 2

The key sequence for \(\mathcal {J}\) provides a 1/2-approximate solution to the problem \({\texttt {WSPS}}\). This sequence can be found in time \(O(n\log n)\) for any set of jobs \(\mathcal {J}\), where \(n=|\mathcal {J}|\). Moreover, the bound of 1 / 2 is tight, i.e., for each \(\varepsilon >0\) there exists a problem instance such that \(\varSigma (\mathcal {S}_{{\mathrm{key}}})<\left( \frac{1}{2}+\varepsilon \right) \varSigma (\mathcal {S}_{{\mathrm{opt}}})\).

Proof

The fact that the key sequence is a 1/2-approximation of the optimal solution follows from Corollary 1. The key sequence can be constructed directly from the definition and sorting the jobs in \(\mathcal {J}\) according to their processing times determines the \(O(n\log n)\) running time.

To close we show that the 1/2 bound for the key sequences is tight. Fix \(\varepsilon >0\) arbitrarily and assume without loss of generality that \(\varepsilon <1\). Take \(\mathcal {J}\) to contain \(n=\lceil \log _2(3/(2\varepsilon ))\rceil \) jobs, each of the same weight \(w>0\) and the same processing time \(p>0\). The key sequence consists of one job and therefore the total weighted overlap of the corresponding schedule \(\mathcal {S}_{{\mathrm{key}}}\) is \(\varSigma (\mathcal {S}_{{\mathrm{key}}})=wp/2\). Take a schedule \(\mathcal {S}\) that places all jobs in \(\mathcal {J}\) on the shared processor. We have \(\varSigma (\mathcal {S})=wp(1-1/2^{n})\). If \(\mathcal {S}_{{\mathrm{opt}}}\) is an optimal schedule, then

$$\begin{aligned} \frac{\varSigma (\mathcal {S}_{{\mathrm{key}}})}{\varSigma (\mathcal {S}_{{\mathrm{opt}}})} \le \frac{\varSigma (\mathcal {S}_{{\mathrm{key}}})}{\varSigma (\mathcal {S})} \le \frac{1}{2(1-2\varepsilon /3)}<\frac{1}{2}+\varepsilon \end{aligned}$$

for \(0<\varepsilon <1\). \(\square \)

7 Open problems and further research

The complexity status of \({\texttt {WSPS}}\) remains open. The generalized problem with multiple shared processors is strongly NP-hard (Dereniowski and Kubiak 2017) when the number of shared processors is a part of the input. However, it remains open whether the generalized problem with fixed number of processors is NP-hard or whether it is FPT, for instance when the parameter is defined to be the number of shared processors. This complexity result and the open complexity questions clearly underline the difficulty in finding efficient optimization algorithms for the shared processor scheduling problem. The development of an efficient branch-and-bound algorithm for the problem remains unexplored so far. The 1/2-approximation algorithm along with the structural properties of optimal schedules presented in this paper and in Dereniowski and Kubiak (2017) may prove useful building blocks of such an algorithm.