Balancing the Average Weighted Completion Times in Large-Scale Two-Agent Scheduling Problems: An Evolutionary-Type Computational Study

: The problem of balancing the average weighted completion times of two classes of jobs is an NP-hard scheduling problem that was very recently introduced in the literature. Interpreted as a cooperative-type two-agent single-machine problem, its applications are in various practical contexts such as in logistics for balancing the delivery times, in manufacturing for balancing the assembly lines and in services for balancing the waiting times of groups of people. The only solution technique currently existing in the literature is a Lagrangian heuristic, based on solving a ﬁnite number of successive linear assignment problems, whose dimension depends on the total number of jobs. Since the Lagrangian approach has not appeared to be particularly suitable for solving large-scale problems, to overcome this drawback, we propose to face the problem by means of a genetic algorithm. Differently from the Lagrangian heuristic, our approach is found to be effective also for large instances (up to 2000 jobs), as conﬁrmed by numerical experiments.


Introduction
Allocating resources to tasks over a given time horizon with the aim of optimizing one or more objectives is the focus of the theory of scheduling.Scheduling, as a decisionmaking process, plays a very important role in a lot of contexts such as manufacturing, production, transportation and distribution (see, for example, [1,2]).The difficulty in solving a scheduling problem, in general, strictly depends on the assumptions made on the problem itself.One of these assumptions concerns the number of agents involved in the considered scenario: while originally the presence of only one agent was always assumed, in the first years of the current century in [3,4], so-called multi-agent scheduling problems were introduced to take into account the possibility of having two or more agents.
In a multi-agent scenario (see [5]), since each agent has its own set of tasks (jobs) to be processed and its own objective function to be optimized, the difficulty in solving such kinds of problems is related to the fact that the agents share the same resources (machines).This has stimulated experts in this field, making the literature grow very fast in this direction.In the seminal paper [3], the authors have addressed a two-agent scheduling problem by considering the following objective functions: the maximum of regular functions (i.e., nondecreasing functions with respect to the completion times) associated with each job, the number of late jobs and the total weighted completion times.Additionally, the complexity of each problem was studied in connection with each objective function and with different structures of the processing system (single machine or shop).In [4], the authors have faced a multi-agent problem by minimizing three different objective functions: the makespan, the maximum lateness and the total weighted completion time.They proved that the problem is polynomially solvable according to any of the three mentioned criteria, showing in addition that the problem becomes NP-hard in case a combination of them is minimized.
The multi-agent scheduling problems are applied in a lot of practical contexts, such as in telecommunication systems with two users [6], where the transmission of on-time data packets to one user is maximized, guaranteeing a certain amount of on-time data packets to the other one.Note that most of these problems are of the competitive type, since the agents compete with each other in using the common resources to optimize their own objective functions.
Differently from the more standard cases, in this work, we deal with a cooperative-type two-agent single-machine scheduling problem, where each agent cooperates in the same objective function aimed at balancing the average weighted completion times of two classes of jobs (one class per agent).This problem, that in the sequel we denote by BAWCT2 (Balancing the Average Weighted Completion Times with 2 agents), finds application in different contexts (see [7] for the details), such as:

•
In logistics, to balance the delivery times in case a single drone is used for shipping; • In manufacturing, to balance the production of semi-finished products characterized by high storage costs; • In services, to balance the average waiting times of groups of people.
In particular, as mentioned in [7], the problem takes inspiration in an academic context, where a professor had the necessity to schedule the oral examinations of two groups of students belonging to two different classes, with the aim of balancing the respective average waiting times.
In passing, we highlight that similar balancing problems arise in general in the multiagent framework whenever unfair solutions, maximizing the system utility, are unacceptable for the worse-off agent (see, for example, [8][9][10]).They are also present in more specific fields, such as in cloud computing when the necessity to balance the workload distribution among different servers occurs (see for example [11]).
BAWCT2 was introduced for the first time in [12], where the authors have considered its basic version, assuming that all the jobs have the same processing time (i.e., they are identical) and unitary weight.Successively, in [7], the problem was extended to the more general case, characterized by different processing times and weights.For such a general problem, the authors have proved the NP-hardness, providing, in addition, a Lagrangian relaxation-based heuristic algorithm, which consists of solving a finite number of linear assignment problems.
Apart from [7,12], to the best of our knowledge, this problem has not been explicitly considered in the literature anywhere else.Then, taking into account that solving a linear assignment problem at each iteration (as proposed in [7]) has a remarkable impact on the execution time, the main contribution of this work is mainly twofold: to propose a different technique based on the adoption of a genetic algorithm aimed at speeding up the resolution process and, at the same time, to test such approach on (new) large-scale instances of the problem.
This paper is organized as follows.In the next section, we formally state the problem, recalling also the two mathematical programming formulations (nonlinear and linear) proposed in [7].In Section 3, we describe the used genetic algorithm, detailing the different strategies adopted in each phase.In Section 4, we present some numerical results showing the efficiency of our approach, which is able to deal with large-scale instances.Finally, in Section 5, some conclusions are drawn.
Throughout the paper, we will use the following notation.Given an index set L, we indicate by L j the index of L in position j and by P(L) a generic permutation of L.Moreover, in correspondence to any real number r, the nearest integer number less than or equal to r is denoted by r .Finally, given a one-dimensional array V, we denote by V[j] the jth element of V.

Problem Definition
Let A and B be two different classes of jobs having cardinalities n A and n B , respectively.We indicate by n = n A + n B the total number of jobs and by J A = {1, . . ., n A } and J B = {n A + 1, . . ., n} the index sets of A and B. For each j ∈ J = J A ∪ J B , we denote by p j the processing time of the jth job and by w j the corresponding weight.
The objective of BAWCT2 is to determine a schedule of the jobs, with the aim of balancing the average weighted completion times of the two classes A and B. In particular, adopting the Graham notation [13], the problem can be stated as follows: where with C j being the completion time of the jth job.
As mentioned in the previous section, to the best of our knowledge, this problem has been explicitly treated in the literature only in [7,12].
In particular, in [12], a simplified version of BAWCT2 was faced, assuming w j = 1 and p j = p const for j ∈ J.In such case, the problem reduces to a particular instance of the well-known subset-sum problem and it is solvable in linear time, or even in a constant time whenever the job-position assignment is not explicitly considered.
Successively, in [7], the authors have proved the NP-hardness of BAWCT2, providing, in addition, the following mathematical programming formulation of the problem as a nonsmooth quadratic assignment program: where the decision variable x jt , for j ∈ J and t = 1, . . ., n, is equal to 1 if the jth job is assigned to the position t and 0, otherwise, while the two groups of constraints are the classical assignment constraints imposing a bijection between jobs and positions.They have also proved that, by applying the Glover linearization technique [14] and introducing the auxiliary decision variables v and z jt for j ∈ J and t = 1, . . ., n, formulation (2) reduces to the following mixed integer linear program (MILP): where p A = ∑ j∈J A w j p j , p B = ∑ j∈J B w j p j and d t = (t − 1) ∑ j∈J p j for t = 1, . . ., n.
The above MILP is at the basis of the Lagrangian heuristic proposed in [7] and based on solving successive linear assignment problems.Although this technique has provided valuable numerical results, its main limit consists in the fact that solving at each iteration a linear assignment problem has a nonnegligible computational impact in case of large-scale problems (i.e., whenever n is remarkably high).For this reason, to overcome this drawback, in the next section we propose to use a genetic algorithm aimed at speeding up the overall resolution process.
For the reader's convenience, we conclude this section by detailing in Table 1 the main characteristics of our approach with respect to [7,12], taking into account that, in [12], no type of numerical experiments was carried out.

Characteristics of Algorithm Maximum Number of Jobs in the Problem
Type the Numerical Experiments [12] p j = p const and Exact - General values of Lagrangian 500 p j and w j , j ∈ J heuristic Our contribution General values of Genetic 2000 p j and w j , j ∈ J algorithm

The Genetic Algorithm for BAWCT2
Genetic algorithms (GAs) are metaheuristic search approaches that are successfully applied to solve different varieties of NP-hard optimization problems (see [15]).In particular, given an optimization problem, a GA is based on the following evolution paradigm.
One starts from an initial population, where with each individual, a genotype, representing a possible solution to the problem, is associated.The quality of such a solution is measured by its fitness value, obtained by evaluating the so-called fitness function and expressing how well the solution fits the problem.In passing from a generation to the successive one, the aim is to possibly increase the overall fitness of the population, by generating, via specific genetic operators, new individuals (offspring) characterized by better fitness values.
The basic schema of GA is reported in Algorithm 1.
Algorithm 1: GA Even if in the literature there are plenty of strategies to implement the steps of Algorithm 1, each of those strategies can be, in general, adapted and tailored to the specific case, making GAs really attractive for solving many optimization problems.Some examples are [16,17], where the well-known traveling salesman problem was faced, and [18][19][20][21][22][23][24][25][26][27], where GAs were used for solving scheduling problems.
Before describing in detail how each step of Algorithm 1 is implemented for solving BAWCT2, it is worth specifying that, in our approach, at each iteration, the previous population is completely replaced by the new one, maintaining only the fittest current individual in order to preserve a monotonic behavior of the best current fitness value (line 10, Algorithm 1).

Encoding and Fitness Evaluation
The first choice in the implementation of GA is regarding the encoding of each individual, representing a feasible solution to the problem.Since we are dealing with a single machine scheduling problem, in such a case, the standard way to encode an individual I is to use a one-dimensional array V I , such that V I [t] = j if and only if the job j is scheduled in the position t.As a consequence, according to this notation, the job processed in the position t will be denoted by [t].
Another key point characterizing GAs is the definition of the fitness function, aimed at providing the fitness value of an individual.Since individuals with higher fitness are preferred by GAs, and, on the other hand, BAWCT2 is a minimization problem, we propose using the following fitness function: where f (I) is the objective function value C of BAWCT2 in correspondence to the solution represented by the individual I.Note that using formula (4) ensures the highlighting of even slight differences in function f and, additionally, when f (I) = 0 (corresponding to a perfect balanced optimal solution), it trivially follows that f itness I → +∞.

Initial Population
Once the encoding strategy is defined, the next step to be performed in GAs is the generation of the initial population.A review of the main techniques used in this phase is reported in [28].
For solving BAWCT2, we have tested the following three different techniques: Random generation, Alternated generation and Bidirectional generation.If, on the one hand, using the Random generation strategy could generate strongly unbalanced solutions due to the completely random generation of the population, on the other hand, Alternated generation and the Bidirectional generation techniques should hopefully generate better starting points, since they are based on more elaborate criteria.In particular, while the Alternated generation technique was used for generating a starting point in the Lagrangian relaxation approach proposed in [7], the Bidirectional generation is inspired by the strategy at the basis of the exact algorithm which provides an optimal solution in case w j = 1 and p j = p const for each j ∈ J (see [12]).
In what follows, we formally describe the three strategies according to the above proposed encoding.

•
Random generation.The genotype of each individual I, corresponding to a feasible solution of BAWCT2, is given by a random permutation P(J) of J.In other words, [i] = P(J) i for i = 1, . . ., n.

•
Alternated generation.The genotype of each individual I is given by alternating the jobs of the two classes, until one of the two sets is completely scheduled.The remaining jobs, if any, are accommodated at the end of the sequence.More formally, let P(J A ) and P(J B ) be two random permutations of J A and J B , respectively.Then, for each i = 1, . . ., min{n A , n B }, we initially set Successively, in case n A = n B , the remaining jobs of the largest class are assigned at the end of the sequence, starting from the position 2 • min{n A , n B } + 1.

•
Bidirectional generation.The genotype of each individual is provided by an iterative procedure, which consists of accommodating, at each iteration, two jobs of one class (alternately chosen between A and B) in the first and in the last currently available positions of the sequence, respectively.In particular, let P(J A ) and P(J B ) be two random permutations of J A and J B , respectively.Then, at each iteration k, for k = 0, . . ., n A /2 + n B /2 − 1, we set either or where J C is the index set that coincides, alternately, at each iteration, with either J A or J B .The index t is initialized to 1 and is increased by 2 at the end of each iteration.
Obviously, when only one of the two classes is completely scheduled, J C remains fixed to the index set of the other class.Moreover, in case n A and/or n B are odd, the remaining jobs are put in the middle of the sequence, using a greedy strategy based on the evaluation of the fitness function.The fitness value is also considered in the final choice of the configuration between ( 5) and (6).
It is worth noting that, for all of the above proposed techniques, the probability of obtaining two times the same schedule as the output of the generation process is very low, since they are defined in the function of random permutations.This is a crucial point, as it guarantees a diversification in the initial population.

Selection
Selection (see [29]) is a crucial step in designing GAs, since it defines the chance of a given individual to participate in the reproduction process.Considering that a convergence to optimal solutions is desired, it is recommended to provide a major chance to individuals characterized by high fitness values.
In this work, three different well-known selection techniques were adopted: Roulette wheel, Binary tournment and k-tournment.

•
Roulette wheel.The selection is performed by simulating a roulette wheel, in which the chance of an individual to be selected is represented by a portion of the roulette.
In particular, for each individual I, since the size of its portion must be proportional to the fitness value, the probability p I to be selected is set as where Pop represents the overall population.• Binary tournament.Between two randomly selected individuals, the one characterized by the highest fitness value is chosen for reproduction.• k-tournament.It is the same as the Binary tournament, apart from the fact that k individuals, with 2 < k ≤ p size , are involved in the tournament, where p size is the size of the population.

Crossover
Once the parents are selected, they have to reproduce in order to generate new children (offspring).The reproduction process is simulated by using crossover operators, aimed at creating new individuals whose features are a mix of the genetic properties of the parents.From the algorithmic point of view, this phase is very important since it allows the exploration of the solution space.
In the literature, a lot of crossover operators have been proposed for the scheduling problems and, in general, for sequencing problems, such as the traveling salesman problem (for a general overview, see [30,31]).
In [26], the authors highlighted that the crossover operators, mainly proposed for the traveling salesman problem, do not perform very well in a scheduling context.As a consequence, taking into account this consideration, for solving BAWCT2, we chose to implement the following three crossover strategies: One-point crossover, Two-point crossover and Position-based crossover.
Given two parents I 1 and I 2 , these operators can be described as follows: • One-point crossover.An index i ∈ [1, n] is randomly selected.Then, with the same probability, either the first i jobs or the last n − i ones are inherited from I 1 , while the remaining ones are inserted in the sequence preserving the order they have in I 2 (see Figure 1).• Two-point crossover.Two indices i, j ∈ [1, n] are randomly selected.Assuming i ≤ j, the first i jobs and the last n − j ones are inherited from I 1 , while the remaining j − i are inserted in the sequence preserving the order they have in I 2 (see Figure 2).

•
Position-based crossover.An index, k ∈ [1, n], is randomly selected and k different positions v i , i = 1, . . ., k, are sampled in the same interval [1, n].Then, the jobs in positions v i , for i = 1, . . ., k, are inherited from I 1 , while the remaining ones are inserted in the sequence, preserving the order they have in I 2 (see Figure 3).

Mutation
Another important operator in GAs is the mutation that, together with the crossover operator, allows the exploration of the solution space.In particular, the aim of a mutation operator is to perturb the current solution by applying random changes.Inspired by [26], in this work, the following mutation operators were tested:

•
Arbitrary two-job change.Two positions i, j ∈ [1, n] are randomly selected and the jobs currently scheduled in these positions are swapped (see Figure 4).• Shift change.Two positions i, j ∈ [1, n] are randomly selected, and the job in the position i is moved to the position j, shifting all the intermediate jobs (see Figure 5).
Additionally, considering any set of adjacent jobs as a batch, we also defined the following mutation operator: • Arbitrary batch change.Given two random positions i, j ∈ [1, n], assume i ≤ j.Then, an integer s (the batch size) is randomly determined in the interval [1, min{j − i, n + 1 − j}] and, for k = 0, . . ., s − 1, the jobs in the positions i + k and j + k are swapped (see Figure 6).

Local Search
The aim of the local search, that we immediately apply after the mutation, is to improve the fitness value of a new offspring and to possibly avoid a premature convergence.
In a lot of scenarios considered in our numerical experiments, the local search has turned out to be very effective, since, starting from a good solution produced in the previous phases, it has often provided a perfect balancing between A and B, i.e., a global solution located in the current In particular we have adopted the following strategy, proposed in [7] and detailed in Algorithm 2. Given an initial offspring O init , for each of the n(n−1) 2 couples of indices (i, j), with i < j, we check whether, by swapping the jobs in the positions i and j, a decreasing in the objective function of BAWCT2 (i.e., a better fitness value) is obtained.If so, the exchange is executed.

The Overall Algorithm
The overall GA, proposed for solving BAWCT2, is named GA-BAWCT2 and is detailed in Algorithm 3 (see also Figure 7 for a graphical description).The input parameters are the following: • p size : size of the population; • p c : probability of performing the crossover; • p m : probability of performing the mutation; • GenerateIndividual: adopted strategy for generating the initial population; • Selection: adopted strategy for the selection operator; • Crossover: adopted strategy for the crossover operator; • Mutation: adopted strategy for the mutation operator; • maxIter: maximum number of iterations.The following comments on Algorithm 3 are in order.Given the current population (Pop), initialized at Steps 1-5, at each iteration we create a new population (NewPop), by randomly selecting 2p size numbers in the interval [0, 1] to decide whether, in generating the new current individual, the crossover and mutation have to be applied.In case the crossover is not carried out, the offspring coincides with the first parent, selected at Step 11.Once an offspring is generated, we proceed with the eventual mutation (Step 17, depending on p m ) and we evaluate the corresponding fitness value (Step 18), in order to perform the local search ( Step 19).Then, the new current population (Step 22) is obtained by substituting, in the new population, one individual (different from the best one) with the best one of the old population.In this way, we guarantee the monotonicity of the fitness function in corresponding to the best individual (I best ) of the current population, which, at the end of the algorithm, constitutes a heuristic solution to the problem.Finally, we observe that the algorithm either by reaching the maximum number of iterations or because a perfect balancing (i.e., f (I best ) = 0) has been determined, with the latter corresponding to f itness I best = +∞.

Numerical Experiments
Algorithm 3 (GA-BAWCT2) was implemented in Java (version 14.02) and run on a Windows 11 system, characterized by 16 GB of RAM and a 2.30 GHz Intel Core i7 processor.For each run, the time limit was fixed to 3600 s, as in [7].
We recall that a preliminary step in the implementation of GAs is the parameters setting, which is crucial since it strongly affects the performance of the algorithm.Moreover, because a vast number of possible settings has to be considered, this is not a trivial step.
In particular, apart from the maximum number of iterations (maxIter) that we have set equal to 1000 as in [7], our heuristic is defined in a function of three numerical input parameters (p size , p c , p m ) and four categorical parameters (the inner procedures Initial population, Selection, Crossover and Mutation), the latter to be chosen among the different strategies proposed in the previous section and summarized in Table 2. On the possible values of the numerical parameters, our proposal is reported in Table 3 (three different values for each parameter), resulting in a total of seven parameters and 3 7 = 2187 combinations for the overall setting of the algorithm.Due to the huge number of these combinations, the parameters' setting was simplified by adopting the strategy described in the next subsection.

Testing Phase
In correspondence with the above parameters' setting, the code was tested on some of the instances used in [7] (see Table 5 therein), and on some new larger randomly generated instances.We recall, in fact, that our main purpose is to show the effectiveness of GA, especially in solving large-scale problems.
The dataset used in Table 5 of [7] consists of six scenarios, each of them composed of 20 instances.
These scenarios were defined by taking n A = n B = k, with k ∈ {30, 50, 100, 150, 200, 250}, and by randomly sampling p j and w j from the uniform interval [1, 3n].Our results are reported in Table 4, in comparison with the results obtained by the authors in [7], exactly on the same machine, where the GA-BAWCT2 code was further run.In particular, for both the algorithms and for each scenario, we report:

•
The average execution time (in seconds); • The average best incumbent, i.e., the average of the best objective function values of BAWCT2, found by the algorithm; • The number of instances certainly solved to optimality, i.e., how many times the algorithm exited with a zero objective function value.Looking at the results, it is evident that Algorithm GA-BAWCT2 overcomes the Lagrangian heuristic: in fact, differently from the Lagrangian approach, our algorithm is able to solve to optimality all of the 120 instances, and moreover, in terms of execution time, it is clearly the winner with a difference of two orders of magnitude.
In order to test our approach on more and larger instances, we randomly generated a new large-scale dataset consisting of seven scenarios, each of them constituted by ten instances.In such case, a maximum number of jobs equal to 2000 is considered, taking again p j and w j as random integer numbers from a uniform distribution on the interval [1, 3n].The obtained results are reported in Table 5, from which we can observe that Algorithm GA-BAWCT2 was certainly able solve to optimality in more than 50% of the overall instances, providing, for each scenario, an average value of the incumbent that is less then 0.001.

Conclusions
In this paper, a genetic algorithm was adopted for balancing the average weighted completion times of two classes of jobs in a single-machine scheduling problem.
For implementing each phase, different techniques were tested, with some of them taken from the literature, while others were introduced for the first time in this work.
The numerical results obtained on a dataset taken from the literature demonstrated the efficiency of the new proposal, which is able to significantly speed up the resolution process with respect to the state of the art.Additional numerical experiments also proved that our approach is able to effectively deal with large-scale instances of up to 2000 jobs.
Future research could be devoted to the extension of the genetic algorithm to the biobjective case, by taking into account the additional minimization of the average weighted completion times of one of the two agents.
Funding: This research received no external funding.