<<

1

Scheduling Plans of Tasks Internship report. Supervisors: Amal El Fallah Seghrouchni, Safia-Kedad Sidhoum

Davide Andrea Guastella

Abstract—We present a heuristic for solving the is accomplished correctly and by satisfying all the constraints. problem of scheduling plans of tasks. The plans are ordered Moreover, due to both critical contexts and dynamic envi- vectors of tasks, and tasks are basic operations carried out by ronment, it is important to orchestrate the operations of the resources. Plans are tied by temporal, precedence and resource constraints that makes the scheduling problem hard to solve in sensors within a relatively short time. polynomial time. As further case study, consider the in-flight airplane The proposed heuristic, that has a polynomial worst-case time safety [5]. In this context there is a need for detecting and complexity, searches for a feasible schedule that maximize the resolving data errors which could come from faulty sensor number of plans scheduled, along a fixed time window, with measurements, inaccurate data processing, or poor information respect to temporal, precedence and resource constraints. transmission, that can lead to catastrophic accidents as in the case of the Air France 447’s accident. Our scheduling I.INTRODUCTION technique can be employed as a fault recovery technique: for example, once the fault has been detected by the on- Scheduling is a decision-making process that is used on board sensors, a system scheduler could discards the remaining a regular basis in many manufacturing and services indus- flight plans, and schedules a set of emergency plans into the [1]. It deals with the allocation of resources to tasks over current flight schedule. These emergency plans are strictly time given time periods and its goal is to optimize one or more constrained, and their orchestration necessarily needs to lead objectives. to a schedule which can guarantee the safety of passengers. From a theoretical point of view, a scheduling problem is a constrained combinatorial optimization problem where a set of task must be ordered in such a way that all these are arranged, III.DEFINITIONS according to one or more constraints, to constitute a schedule Definition 1 (Plan of Tasks). A plan of tasks Π is a partial that minimize or maximize a given objective function. k ordering of tasks J k to address a specific goal. Each plan One of the most popular scheduling problem is the resource- i Π is characterized by a priority value α . The structure of constrained project scheduling problem (RCPSP) [2]: the k k the plan is depicted by an activity-on-node (AON) network objective of resource-constrained scheduling consists in de- where the nodes and the arcs represent the tasks and the veloping a schedule such that a set of tasks is completed as precedence relations respectively [6]. The precedence relations early as possible considering both the precedence relationships are described by the notation ≺. For example, given two plans and the restricted availabilities of resources. Πk and Πj, Πk ≺ Πj indicates that the plan Πk must be The scheduling problem we are facing can be thought as scheduled before Π . a particular case of the RCPSP problem: in our case we are j A plan is defined by the following notation: facing the problem of scheduling plans of tasks subject to both

precedence, resource and temporal constraints. Also, rather k k Πk = (J , ..., J ) than scheduling tasks as in the RCPSP, our problem aims at 1 nk selecting a maximum number of plans. where k is an arbitrary index for the plan, nk is the number k of tasks in the plan Πk and Ji , with 0 ≤ i ≤ nk is the i-th II.CASESTUDIES task of the plan Πk. The set of tasks is topologically sorted Nowadays, airborne platforms such as Remote Piloted Air (see3). Vehicles (RPAS) are employed in different scenario including A plan Πk could not be scheduled if at least one task arXiv:2102.03555v1 [cs.AI] 6 Feb 2021 k conflicts, surveillance and rescue [3]. In these scenario, air- Ji ∈ Πk could not be scheduled due to unsatisfied constraints. k borne platforms operate in highly dynamic environments with A plan Πk is characterized by a set of resources R ⊆ R. a low predictability. In this context, onboard instruments (i.e. Definition 2. A graph G = (V,E) consists of a set of vertices sensors) allow the platform, hence the mission manager, to V , and a set of edges E ⊆ V ×V . In a the edges collect knowledge from the field. Sensors carried by RPAS are directed from one vertex to another. A directed acyclic are now able to perform a large panel of functions such as graph (or DAG) is a directed graph with no directed cycles: a image acquisition, spectrum analysis, and object tracking [4]. directed is a that starts from any vertex u and ends All these sensors play a major role in operation and their in u. optimization has become essential. Because of the criticality of the context and the mission’s Definition 3 (Topological Sort). A topological sort of a objectives, it is important to develop a method that orchestrates (DAG) G = (V,E) is a linear ordering the operations conducted by the sensors, such that the mission of all its vertices such that if the graph G contains an edge 2

(u, v) then u appears before v in the ordering [7,8]. If the interrupted once started. Moreover, we assume that each task graph contains a cycle, then no linear ordering is possible. could consume more than one resource during its execution. For example, in Figure1 a directed acyclic graph is showed, Definition 7 (Resource). A resource ρ is any hardware or for which a topological sorting can be found, since it has software tool that tasks can use to handle information. A no cycles. Figure2 shows a possible topological sorting for resource ρ has a limited availability value Bρ. Resources the graph in Figure1, where the different colors depict the are typically distinct in renewable and nonrenewable [6]: different frontiers in the corresponding DFS graph. renewable resources have a fixed value of availability in each time period, while nonrenewable resources have a fixed value Definition 4 . frontier f G = (V,E) (Frontier) A for a graph is of availability along the entire project’s time horizon. In the ad- f ⊆ V a set of nodes such that the maximum distance between dressed scheduling problem, we deal with renewable resources each node u ∈ f and the root node in the corresponding DFS with a fixed availability value of Bρ = 1, ∀ρ ∈ R, in each graph is the same. time period. In particular, resources with a fixed availability value of Bρ = 1 are also called unary or disjunctive resources.

Definition 8 (Resource availability). The availability Bρ ∈ N0 7 5 of a resource ρ represents the maximum value of availability of the resource ρ in each time period. The abstract amount of usage of the resource ρ by the task 11 8 3 k k Ji , in each time period, is represented by biρ = {0, 1}. In this work we are concerned with solving the problem of scheduling plans of tasks by using a heuristic that maximizes the number of plans scheduled in a fixed time window, taking 2 9 10 into account precedence, time, and resource constraints.

Fig. 1: A Directed Acyclic Graph. IV. PROBLEM STATEMENT A. Constraints

1) Temporal constraints: When a plan Πk is scheduled, for k k each task Ji ∈ Πk both the starting time si and the comple- 3 5 7 8 11 2 9 10 k k k tion time Ci = si + pi must be inside the temporal window k k [Ws,We] and also inside the temporal window [ri , di ], where

k k k Fig. 2: A possible topological sorting for the DAG in Figure1. (ri ≥ Ws) ∧ (di ≤ We), ∀Ji ∈ Πk.

k k The value of si for a task Ji ∈ P ik is calculated as the Definition 5 (Task). A task J k is an atomic operation that k k i maximum value between Ws, the release date ri of the task Ji a subset of resources must execute. Each task J k belongs k i augmented by the time lag δij, and the maximum completion uniquely to one plan Πk. Tasks are characterized by the k k time Cj for each predecessor Jj ∈ Πk. Formally, following elements: k k • a processing time p ∈ , p ≥ 1; i N0 i k k k k k si = max(Ws, ri , maxj∈predk (Cj + δij)), (1) • a release date ri ∈ N; i k • a due date di ∈ N0; k k k • a time lag δij ∈ N, if Ji ≺ Jj ; k k k k k where pred is the set of predecessors of the task J . • a set of resources R = {ρ , ..., ρ }, R ⊆ R , which i i i 1 n i Given a set P of plans, the plan Π ∈ P satisfies the the task J k is assigned to. k i temporal constraints if The tasks within a plan can be dependent by a precedence graph that provides the precedence constraints between the ∃sk ∀J k ∈ Π :(sk ≥ rk) ∧ (sk + pk ≤ dk). tasks. As for the plans, the precedence relations between tasks i i k i i i i i are described by the notation ≺. For example, given two tasks 2) Precedence constraints: In order to maintain the prece- k k k k J1 and J2 belonging to the same plan Πk, J1 ≺ J2 indicates dence constraints between plans, a set P of plans to be sched- k k that the task J1 precedes the execution of the task J2 . uled is topologically ordered, since the precedence between plans can be represented as an acyclic directed graph (DAG), Definition 6 (Time lag). A time lag δk is a fixed amount of ij as showed in Figure1. In our context, a graph G is a tuple time which separates the finishing and starting times of a pair k k (V,E) where V is a set of vertices and vk ∈ V represents of tasks Ji and Jj respectively. By default, it is 0. a plan Πk ∈ P, and an arc (u, v) represents a precedence In this paper, we assume that there is no preemption in the constraint between the plans that are represented by nodes u task execution. Therefore, the execution of the tasks can not be and v respectively. 3

3) Resource constraints: The scheduling problem we ad- is equal to nk, then Πk is executed. Therefore, the variable xk k dress assumes that each task Ji ∈ Πk which has a feasible is equal to 1. By using this notation, the objective function to k k k starting time si , can be executed by a subset Ri ⊆ R of maximize can be formulated as: k k resources if in the time period [si ,Ci ] the utilization of each k resource ρ ∈ R does not exceed its availability Bρ. K i X max αkxk k B. Classification and mathematical formulation k=1 A typical formal way to describe the scheduling problems such that, is by using the three-field classification [α, β, γ] introduced by

Graham et al. [9], where k nk di • α specifies the machine environment, X X k yit = nk ⇒ xk = 1 ∀Πk ∈ P (2) • β specifies the characteristics of the activities, i=1 t=rk • γ and describes the objective function(s). i k k An extension of the Graham’s classification has been pro- (t + δij ≥ ri ) ∧ k k k k posed in order to provide a more accurate way to formally (t + δij + pi ≤ di ) ⇒ yit = 1 ∀t ∈ [Ws,We], describe the scheduling problems [10]. According to the k ∀Ji ∈ Πk (3) extended notation, the plans of tasks scheduling problem can X k k k k k k be stated as t · (yit − yjt) ≥ pi + δij if Ji ≺ Jj , t ∀J k,J k ∈ Π , i 6= j (4) k k k X i j k PS1, 1, 1 | precΠ; precJ ;[Ws,We]; [ri , di ]; δij | max αkxk k k k nk t+pi where P Sm, 1, 1 ∈ α indicates a resource environment for X X bk · yk ≤ B ∀ρ ∈ R, ∀t ∈ [W ,W ] (5) a project scheduling problem with m resources, a maximum iρ iτ k s e i=1 τ=t availability of 1 unit per time for each resource, and a resource utilization, by each task, of at most 1 unit per time Constraint (2) imposes that for each plan Πk ∈ P all the k k k k tasks J ∈ Πk have a starting time assigned. Constraint (3) period. precΠ; precJ ;[Ws,We]; [r , d ]; δ ∈ β depicts i i i ij imposes that each task J k has a starting time and a completion the characteristics of both plans and tasks: precΠ indicates i time within the time window [rk, dk]. Constraints (4) and (5) a precedence constraints between plans; precJ indicates a i i k k impose respectively the precedence and resource constraints. precedence constraints between tasks; [Ws,We] and [ri , di ] k indicates, for each task Ji ∈ Πk, the time constraints dis- k k ROPOSEDMETHOD cussed in IV-A1; δij indicates that each task Ji can have a V. P k time lag between its starting time si and the completion time In this section is discussed a greedy heuristic for the k Cj of its predecessor. problem of scheduling plans of tasks. The mathematical formulations for the RCPSP can be k conveniently employed to model the objective function with Definition 9 (Schedule). A schedule S is a vector (si ), k respect to the temporal, precedence and resource con- i = 1, ..., nk, k = 1, ..., K such that si ∈ S is a starting k straints [11]. The proposed formulation is based on time time for the task Ji . A schedule represents a solution for the discretization for describing the usage of the resources and scheduling problem if it satisfies the scheduling constraints. the processing of the tasks over time. In our context the time Given a temporal window W = [Ws,We], the goal of horizon, divided into unitary time periods, is a fixed time the proposed heuristic is to create a feasible schedule that window [Ws,We], where the maximum number of plans has contains the maximum number of plans of tasks, inside the k to be scheduled. Given a plan Πk ∈ P and a task Ji ∈ Πk, temporal window [Ws,We], regarding their weight, such that k k k and a time instant t ∈ [ri , di ], let yit be a boolean variable that each scheduled plan Πk satisfies the precedence, temporal k indicates whether the task Ji starts exactly at time t. Also, let and resource constraints discussed inIV. The set P of plans xk be a boolean variable that indicates whether a plan Πk ∈ P given as input to the algorithm is preventively sorted in order is executed. Thus, a plan Πk ∈ P is executed if to maintain their precedence relations, and also to evaluate,

k at each iteration of the algorithm, the plan with the highest nk di X X k priority value. The feasibility of the plans is evaluated in a yit = nk ⇒ xk = 1, schedule Sw until no plans remains to schedule, or there is no i=1 t=rk i plan that can be scheduled due to a violation of the constraints. k where nk is the number of tasks in Πk. If a task Ji has a Each plan Πk ∈ P could have precedence relations between k k feasible starting time si equals to t, then yit = 1 for a time its tasks. The topological sorting of the tasks ensures that k k instant t ∈ [ri , di ]. Thus, if the sum the execution of the tasks is done with respect to the their precedence relations. Example1 shows an example of feasible dk nk i schedule where a precedence relation occurs between the tasks X X k yit of a plan. i=1 k t=ri 4

p q q k Example 1. Figure3 shows a Gantt diagram for a feasible Cj s l Cl si schedule for a set of plans P = {Π1, Π2}, which parameters p q k are listed in TableI. A precedence constraint occurs between Jj J ll Ji 2 2 t the tasks J1 and J2 , both belonging to the plan Π2. p k Fig. 4: The time window [Cj , si ] is an idle time because rk dk pk δk Rk Jk ≺ Jk q i i i ij i i j J ∈ Πq can be scheduled in this interval. 1 l J1 2 7 3 0 {1} 2 2 2 J1 3 8 2 0 {2} J1 ≺ J2 k k k k k k k 2 ri di pi δij Ri Ji ≺ Jj J2 4 9 2 0 {1} 1 J1 2 7 3 0 {1} 2 TABLE I: The parameters of the tasks of the plans Π and J1 2 6 2 0 {2} 1 2 J2 4 10 3 0 {1} Π2 in the Example1. 3 J1 4 7 2 0 {3} 4 4 4 J1 3 6 1 0 {4} J1 ≺ J2 4 J2 2 7 3 0 {2} TABLE II: The parameters of the tasks of a set P of 4 plans.

s 2 2 e J1 c Let S be a feasible schedule, and P a set of plans having r αk u each one priority α . The plans of P are scheduled in o k αk

s 1 2 1 e J1 J2 order to minimize the presence of idle times. This is done R by choosing iteratively the plans who minimize the following quantity: 0 1 2 3 4 5 6 7 8 9 X k k Ws We s − C k , ∀J ∈ Πk ∈ Pα Time i Γi (ρi) i k i Fig. 3: A feasible schedule for the set P of two plans. A k 2 2 where C k is the completion time of the task Γ (ρi), that precedence constraint occurs between J and J . Γi (ρi) i 1 2 k is, the predecessor of task Ji in the same resource ρi executing k 2 the task Ji . The task J2 has been scheduled after the end of the 2 Example2 shows how the idle time is used by the proposed execution of the task J1 , since there is a precedence constraint 2 2 2 heuristic to determine the order according to which two plans between J1 and J2 . For this reason, the task J2 has not been scheduled at 5. have to be scheduled. For a given DAG, more than one topological sort could Example 2. Let P = {Π1, Π2, Π3, Π4} be a set of plans to exist. Under this assumption, different topological sorting for schedule, which information are listed in TableII, and let Sw a plans’ precedence graph could lead to different schedules. be a feasible schedule where Π1 and Π2 have been scheduled For this reason, the plans belonging to the same frontier are (Figure 5a). Let Pl = {Π3, Π4} be a set of two plans such sorted by their priority value, since for these plans the order that Π3 and Π4 have priority values α3 = l and α4 = l in which they are scheduled is irrelevant according to the respectively. As showed in Figure 5b-5c, both plans Π3 and Π4 generate two feasible schedules. precedence constraints. Moreover, different plans may have 3 the same priority value: in this case, the plans must be sorted The difference between the starting time s1 and its pre- decessor (in this case Ws since there is no predecessor of according to a different criterion described in the following. 3 4 J1 ) is equal to 2. Within Pl, the plan Π4 has a task J1 Given a feasible schedule Sw and a subset Pαk ⊆ P of 4 3 that can be scheduled at s1 = 3 < s1, where all the plans having the same priority value αk, in order to maximize 4 3 k constraints are satisfied, and both J1 and J1 demand the same the resource utilization for each tasks Ji ∈ Πk ∈ Pαk we k resource. Moreover, scheduling the plan Π4 before Π3 leads calculate an idle time between each task Ji ∈ Πk and its predecessor, in the same resource. to a schedule where no idle times are generated. Therefore, plan Π4 is scheduled before plan Π3. Definition 10 (Idle time). Let S be a feasible schedule k The scheduling algorithm operates in a similar way as the containing two plans Πk, Πp, p 6= k. Let Ji ∈ Πk and p serial scheduling scheme proposed in [11]. In our context, we J ∈ Π be two tasks scheduled on the same resource ρ ∈ R, j p assume that each resource has a maximum availability of 1 where sk > Cp. If there is at least one plan Π schedulable in i j q in each time period. In this case, each resource can execute S such that ∃J q ∈ Π executed by the same resource ρ ∈ R l q one task at a time. The idea of the proposed heuristic is to such that schedule all the plans as soon as possible by respecting the resource, precedence and temporal constraints. The insertion p q k p q k (Cj ≤ sl < si ) ∧ (Cj < Cl ≤ si ), of the plans into a schedule is done by handling an event list EL event 4 (t(e), S(e), C(e), (b (e)) ) p k . An is a -tuple ρ ρ∈R : the time window [Cj , si ] is said to be an idle time. • t(e) denotes the time instant of the event; In Figure4 is showed an idle time between two tasks. • S(e) is the set of tasks starting exactly at time t(e); 5

bρ(e) = 1.

3 A. Description of the heuristic s e c r 2 BuildSchedule

2 The proposed heuristic (Algorithm1)( ) u J1 o

s takes in input a set P of plans and a set R of resources, e R 1 2 and it gives as output a feasible schedule Sl, that is, a vector 1 J1 J2 k k of starting times si for each scheduled task Ji ∈ Πk such that the constraints discussed in the previous section are met. At the beginning, the algorithm initializes the used data 0 1 2 3 4 5 6 7 8 9 10 11 structures. At line1 and2 respectively, two set Ps and Ws Time We Pf are initialized: they will be used to store respectively the (a) successfully scheduled plans and the discarded (unscheduled) plans. Then, two empty schedules Sl and Sw are initialized. They will contain respectively the last feasible schedule found 3

3 J1 and the current working schedule. The working schedule is a

s schedule used for testing the feasibility of the plans during the e c

r 2 search. Finally, an event list EL is initialized at line5. The first 2 u J1 o step of the algorithm is to sort the set P of plans according s e

R to both precedence relations and priority values (line6). This 1 2 1 J1 J2 is done by Algorithm2, that returns a sorted list Pu of plans. Then, a loop over Pu starts until there is a plan left to schedule (line7). At line8, the highest priority plan Πk is taken from 0 1 2 3 4 5 6 7 8 9 10 11 the sorted set Pu of plans. Then, at line 10 the algorithm Ws We Time checks if there exists more than one plan in Pu with the same (b) priority value αk of Πk. If the value of αk is unique among the values of priority of the plans in Pu, the algorithm tries to

schedule the plan (line 11), otherwise a set Pαk ⊂ P of plans 4 is calculated, containing all the plans that have priority value

3 J1 αk. All the plans in Pαk are then scheduled by Algorithm5. s e

c Thus, the plans successfully scheduled are added into Ps r 2 4 2 u J1 J2 (line 20), and the plans not scheduled are removed from the o s

e working schedule (line 22). Finally, the last feasible schedule R 1 2

1 S is updated (line 24). J1 J2 l Algorithm1 takes at most O(K3n3) time, where K = |P| is the number of plans to schedule. 0 1 2 3 4 5 6 7 8 9 10 11 All the data structures used for storing plans, P, Pu, Ps Ws Time We and Pf , are implemented as self-balancing binary search trees to ensure insertion, removal and get operations in logarithmic (c) time [7]. At line5 the event list EL is initialized. As the data Fig. 5: Scheduling plans with the same priority value into structures used for storing plans, the event list is implemented a schedule with two plans schedule (Figure 5a). Scheduling as self-balancing binary search . At line6 the plans are plan Π3 before plan Π4 (Figure 5b) leads to a schedule with sorted by the Algorithm2. 4 an idle time of 2, since in the interval [2, 4] the task J1 of The while loop7-26 iterates until the set of plans Pu is not the feasible plan Π4 can be scheduled. Scheduling plan Π4 empty. In the worst case, if the plans belongs all to the same before Π3 (Figure 5c) leads to a schedule with an idle time frontier, the inner loop takes at most O(K3n3) time. of 0. Therefore, Π3 is scheduled before Π4. The Get operations at line8 takes logarithmic time with respect to the number of elements in Pu. At line9 the algorithm get the number of plans in Pu that • C(e) is the set of tasks completing exactly at time t(e); have priority value αk. We use an auxiliary to • bρ(e) represents the usage of resource ρ during interval store this information and get the value in O(1). [t(e), t(nexte)[, where nexte is the first event following The Add and Remove operations at line 13 and 15 re- e in EL. spectively require both O(log K) time. Getting the plans with k When a feasible task Ji is scheduled and inserted into S(e) priority αk (line 18) requires constant time, since a hash map for a an event e ∈ EL, the usage of the resource bρ(e) is is used to store the plans with the same priority value: the key set to 1. The resource constraints for the scheduling problem of a record is a value of priority αk, and the value is a list of we address assumes that no task can be scheduled at t(e) if plans having each one αk as priority value. 6

The Add operation at line 20 requires O(K log K) time. frontier f are sorted by using the algorithm [12]. The The Remove operations at line 21 and 22 require both for loop requires at most O(K log K) time if all the plans O(K log K) time. belong to the same frontier.

Algorithm 1 BuildSchedule Algorithm 2 SortPlans Require: A set of plans P Require: A set of plans P Ensure: A feasible schedule Sl, a set Ps of scheduled plans, Ensure: A sorted set of plans Pu a set Pf of unscheduled plans 1: Pt ← T opologicalSort(P) 1: Ps ← {} {Scheduled plans} 2: compute Fi for i = 1, ..., f 2: Pf ← {} {Discarded plans} 3: Pu = ∅ 3: Sl ← () {Feasible schedule} 4: for i = 1, ..., f do 4: Sw ← () {Working schedule} 5: sort Fi according to α 5: EL ← {} 6: Add(Fi, Pu) 6: Pu ← SortPlans(P) 7: end for 7: while Pu 6= ∅ do 8: return Pu 8: Πk ← Get(Pu)

9: Nαk ← number of plans in Pu with priority αk Algorithm3( ScheduleP lan) schedules a single plan Πk

10: if Nαk = 1 then into a schedule Sw using an event list EL. It iterates over k 11: success ← SchedulePlan(Πk, Sw, EL) all the tasks Ji ∈ Πk and for each task, the precedence 12: if success then constraints are checked, and then the task is scheduled into the 13: Add(Πk, Ps) schedule Sw. If at least one task could not be scheduled, the 14: else algorithm immediately breaks the loop, and false is returned, 15: Remove(Πk, Sw) since the plan could not be scheduled such that all the 16: end if constraints are satisfied. 3 P 17: else Algorithm3 takes O(n ) time, where n = k nk, ∀Πk ∈ P

18: Pαk ← plans of P with priority αk is the total number of tasks already scheduled in Sw. Inside

19: U ← SchedulePlanSet(Pαk , Sw, EL) the loop the Algorithm4 is executed O(nk) time. 20: Add(Pα \U, Ps) k Algorithm 3 SchedulePlan 21: Remove(Pαk , Pu) 22: Remove(U, Sw) Require: A plan Πk, a schedule Sw, an event list EL 23: end if Ensure: true if Πk has been scheduled in Sw, false other- 24: Sl ← Sw wise. k 25: Pf = P\Ps 1: for all task Ji ∈ Πk do k 26: end while 2: success ← scheduleTask(Ji , Sw, EL) 3: if not success then Algorithm2( SortP lans) sort a set P of plans in decreasing 4: mark Πk as unschedulable order of priority so that the precedence constraints between 5: return false plans are also respected. At line1 a topological sort algorithm 6: end if is executed for the plan set. A set of couples (Πi,Fi) is 7: end for returned, where Πi is the i-th plan in the topological sorting, 8: return true and Fi is the subset of plans of the frontier fi which the plan Πi belongs to. Then, let F be the set of subsets Fi of plans Algorithm4( ScheduleT ask) do the actual task insertion for each frontier fi (line2), a loop over each set Fi is done into a schedule. It starts by calculating the earliest possible (line4-7), where each Fi is sorted according to the priority starting time given by (1) if we do not consider the resource value the plans in the frontier fi (line5), and then added to availability. At line2 the algorithm searches for an event e in k the set Pu of sorted plans (line6). EL such that t(e) = si . If such event does not exist, a new k Algorithm2 takes at most O(K log K+nk), where K = |P| event e is created at t(e) = si . At line4, the algorithm starts is the number of the plans to be sorted. At line1, the set of a loop to search for the earliest feasible start and end events e k plans is topologically sorted. The topological sort requires at and f for the task Ji . The loop iterates until f is not the last k most O(K + nk) where nk is the number of predecessors in event or the remaining duration µ, initially set to pi , it is not the precedence’s graph of the plan Πk. null. If the condition of the while loop is satisfied, g is assigned At line2 the set of frontiers discovered by the topological the event following f (line5), and the algorithm proceeds by sort is assembled: this set is implemented as an checking the resource availability and the constraints test for k where the key of a record is a priority value αk, and the value Ji in t(e) (line6). If both the tests succeed, µ is decreased is a list of plans having each one αk as priority value. by t(g)−t(f) and g is assigned to f. If the tests fail, then e is The loop4-7 iterates over each frontier in the precedence’s not a valid insertion position, and then e is set to g while µ is k graph, and sort the plans belonging to that frontier according reset to pi . After the loop, a final check for the constraints is to their priority value. At line5, plans belonging to a specific done (line 13). If the final check fails, then all the tasks of the 7

plan Πk are removed from each event e in the event list EL Algorithm 4 ScheduleTask (line 14), the plan Πk is marked as unschedulable (line 15) k Require: A task Ji , a schedule Sw, an event list EL and false is returned. k Ensure: true if Ji has been scheduled in Sw, false other- Once the constraints are verified for e at line 13, the wise. k k k k k algorithm proceed with the insertion of the task Ji into the 1: s = max(Ws, r , max k (C + δ )) i i j∈predi j ij working schedule (line 18), and into the event e (line 19). k 2: e ← GetEvent(si , EL) Then, at line 21, the event e is added into the event list EL k 3: µ ← pi ; f ← e if it is not already in. The steps (23-31) update the event list. 4: while (f is not the last event of EL) ∧ (µ > 0) do The last step consists in updating the resources usage by the 5: g ← nextf scheduled tasks (line 32). k 6: if (bρ(f) = 0, ∀ρ ∈ R )∧ 2 i Algorithm4 has a of O(n ), where n = (CheckConstraints(t(e),J k)) then P k i k nk. Searching for a feasible starting time si (line1) re- 7: µ ← max(0, µ − t(g) + t(f)) k quires at most O(n−1) time if task Ji has n−1 predecessors. 8: f ← g k Searching for the event e such that t(e) = si (line2) requires 9: else at most O(log |EL|) since a balanced tree data structure is k 10: µ ← pi ; e ← g; f ← g used for the event list. 11: end if In the worst case, for a set P of plans with cardinality 12: end while |P| = K, the maximum number of events in EL is 2n if we k 13: if not CheckConstraints(t(e),Ji ) then suppose that all the tasks are scheduled consecutively with a k 14: remove all tasks Ji ∈ Πk from e, ∀e ∈ EL minimal lag between each task, that is 15: mark Πk as unschedulable 16: return false |S(e)| = 1 ∧ |C(e)| = 0 ∨ 17: end if k 18: Add(Ji , Sw) |S(e)| = 0 ∧ |C(e)| = 1, ∀e ∈ EL. k 19: Add(Ji , S(e)) 20: if e∈ / EL then The while loop (lines4-12) iterates over the event list EL. 21: EL ← EL ∪ e Since there are less than 2n events, the while loop takes O(n) 22: end if time. k 23: if t(e) + pi = t(f) then Searching for the event following f in EL (line5) takes at k 24: Add(Ji , C(f)) most O(log |EL|) time. Checking if the temporal constraints k 25: else if t(e) + pi > t(f) then are satisfied at t(e) (line6) takes O(1) time. The remaining k 26: insert g = (t(e) + pi , ∅, {t}, (bρ(f))∀ρ∈Rk ) in EL operations inside the loop require constant time. i 27: f ← g Removing all the tasks J k ∈ Π from each event e ∈ EL i k 28: else (line 14) takes O(nk log |EL|). k 29: insert g = (t(e) + p , ∅, {t}, (bρ(predf )) k ) in EL k i ∀ρ∈Ri Adding the task Ji to the schedule Sw (line 18) requires at most O(log n) since an efficient balanced tree data structure 30: f ← g is used for the schedules. Adding the task J k to the set S i e 31: end if (line 19) requires constant time. k 32: bρ(g) = 1 ∀ρ ∈ R , ∀g between e and predf in EL Adding the event e to the event list EL (line 21) requires i 33: return true O(log |EL|) time. The event list update takes O(log |EL|) if the event g has to be inserted in EL (lines 26,29), otherwise the insertion of 2 3 k Algorithm5 takes at most O(K n ) time. The main loop Ji into C(f) (line 24) requires O(1) time. (lines3-25) is repeated until there is some plan left to schedule, Algorithm5( ScheduleP lanSet) schedules a set P of αk and it is repeated at most O(K) time. The inner loop (lines6- plans such that each plan Πk ∈ Pαk has a priority value αk. 19) schedule each plan Πk ∈ Pαk and keeps the plan which The idea of the algorithm is to find, at each iteration, the plan minimize the idle times between each task and its predecessor. who minimizes the sum of the size of the idle time windows The inner loop takes O(Kn3) time. generated by its tasks. The algorithm starts by creating a copy Algorithm6( CheckConstraints) checks if a starting time V of the plan set P (line1). The while loop (lines3- αk t(e) satisfies the temporal constraints, discussed in IV-A1, for a 25) iterates until there is no plan left in V to schedule. At k task Ji . If the temporal constraints are satisfied, the algorithm each iteration, two variables minIdleT ime and bestP lan are returns true. used to keep the next candidate plan to schedule. The loop Algorithm6 requires constant time. at (6-19) iterates over the plans in V and searches for the In Table III are resumed the functions employed by the candidate plan to schedule. Each plan Π is scheduled into k proposed method, together with a short description and their a temporary schedule S (line9). At each iteration, the temp time complexity. algorithm chooses the plan Πk ∈ Pαk that minimizes the sum of the time differences between t(e) and t(prede) (line 11), Example 3. In this example we show how different plans k k for each event e such that Ji ∈ S(e), ∀Ji ∈ Πk. are scheduled according to the proposed heuristic. We start 8

Time Algorithm 5 SchedulePlanSet Function name and description complexity

Require: A set Pαk ⊂ P of plans, a schedule Sw, an event BuildSchedule(P) Entry point algorithm. It is responsible list EL O(K3n3) for assembling a feasible schedule for a set P of plans. Ensure: A set U of unscheduled plans ScheduleP lan(Πk,Sw, EL) 3 1: V ← Pαk Schedule the plan Πk into the schedule Sw. O(n )

2: U ← ∅ ScheduleP lanSet(Pαk ,Sw, EL) Schedule a set of plans P that have the same priority 3: while V 6= ∅ do αk O(K2n3) value into the schedule Sw. 4: minIdleT ime ← +∞ k ScheduleT ask(Ji ,Sw, EL) k 2 5: bestP lan ← ∅ Schedule the task Ji into the schedule Sw. O(n ) 6: for all Πk ∈ Pα do SortP lans(P) k Sort a set of plans P according to their precedence 7: S ← S temp w relations by using T opologicalSort algorithm. Then, the O(K log K+ 8: ELtemp ← EL plans that belong to the same frontier in the topological nk) 9: success ← scheduleP lan(Πk,Stemp, ELtemp) sorting are sorted by their priority value. T opologicalSort(P) 10: if success then Sort a set of plans P according to their precedence P k 11: it = i(t(e) − t(prede)), ∀Ji ∈ S(e) relations by using a topological . It O(K + nk) 12: if it ≤ minIdleT ime then returns a sorted copy of the plan set given as input. k 13: minIdleT ime ← it GetEvent(si , EL) k Get the event e ∈ EL such that t(e) = si . If such event 14: bestP lan ← Πk k does not exists, a new event e is created at t(e) = si . O(log |EL|) 15: end if Get(P) Get the highest priority plan from P. O(log K) 16: else 17: Remove(Πk,V ) TABLE III: Descriptions of the functions used by the schedul- 18: end if ing algorithm. 19: end for k k k k k k k 20: success ← scheduleP lan(bestP lan, Sw, EL) ri di pi δij Ri Ji ≺ Jj 1 1 1 21: if not success then J1 1 7 4 0 {1} J1 ≺ J2 1 J2 5 8 2 1 {3} 22: Add(bestP lan, U) 2 2 2 J1 4 7 2 0 {2} J1 ≺ J2 23: end if 2 J2 5 9 3 0 {1} 24: Remove(bestP lan, V ) 3 J1 1 8 3 0 {3} 4 4 4 25: end while J1 2 7 2 0 {2} J1 ≺ J2 4 26: return U J2 3 7 1 2 {3} 5 5 5 J1 5 10 3 0 {2} J1 ≺ J2 5 J2 5 11 1 0 {1, 3} Algorithm 6 CheckConstraints TABLE IV: The parameters of the tasks of the plans in k k Require: A task Ji , a starting time t(e) for Ji Example3. k Ensure: true if Ji satisfies the temporal constraints, false otherwise. k k  1: if t(e) ∈ [ri , di ] ∧ (t(e) ∈ [Ws,We]) ∧ temporal and resource constraints for J 4 are satisfied, so it k  1 t(e) + p ∈ [Ws,We] then 4 i is scheduled at s1 = t(e1) = 2, and then the resource usages 2: return true b2(e1) is updated. Following, an insertion point is searched for 3: end if 4 4 4 the task J2 . The earliest starting time for J2 is s2 = t(e4) = 6, 4: return false 4 4 since there is a time lag between J2 and its predecessor J1 . 4 The event e4 is a good insertion point for the task J2 , since here the precedence, resource and temporal constraints are 4 4 from a feasible schedule containing two plans Π1 and Π2, met. J2 is finally scheduled at s2 = t(e4) = 6. The resource and we try to schedule in order the plans Π3, Π4 and Π5. usage b3(e4) is updated. Since a feasible insertion point has 4 4 In TableIV are listed the parameters of the plans of tasks been found for both J1 and J2 , the plan Π4 is scheduled P = {Π1, Π2, Π3, Π4, Π5}. correctly and the schedule generated is considered as feasible Let Π3 be the next plan to be scheduled, which has only one schedule. 3 3 task J1 . The earliest starting time s1 is set to the release time TableVI shows the resulting Gantt diagram and the event 3 3 r1 = 1. The event e1 ∈ EL has a time instant t(e) = r1 = 1, list EL after the insertion of the plan Π4. 3 thus e1 is the first event in which J1 can be scheduled. The Finally, plan Π5 is the last plan to be scheduled. The earliest 3 5 5 resource constraints in e1 are satisfied for J1 , so it can be starting time for J1 is s1 = 5. At t(e3) = 5 the temporal and 5 scheduled at t(e1) = 2. The resource usages b3(e1) and b3(e2) resource constraints for J1 are not satisfied (b2(e3) = 1). The 5 are finally updated. next event e4 is a good insertion point for the task J1 , since TableV shows the resulting Gantt diagram and the event here the resource constraint and also the temporal constraints 5 5 list EL after the insertion of the plan Π3. are met. The task J1 is finally scheduled at s1 = t(e4). 5 Following, plan Π4 is the next plan to be scheduled. The Following, an insertion point is searched for the task J2 , which 4 4 4 earliest starting time s1 for J1 is s1 = t(e1) = Ws. At e1 the consumes both the resources 1 and 3. The earliest starting time 9

3 1

3 J1 J2

e t(e) S(e) C(e) b1(e) b2(e) b3(e) s e

e1 2 {J1, J 3} ∅ 1 0 1 c 1 1 r 2 2 e2 4 {J2} ∅ 1 1 1 u J1 1 o

3 s

e3 5 ∅ {J1 } 1 1 0 e

2 2 1 R e4 6 {J2 }{J1 ,J1 } 1 0 0 1 2 1 1 J1 J2 e5 7 {J2 } ∅ 1 0 1 1 2 e6 9 ∅ {J2 ,J2 } 0 0 0

0 1 2 3 4 5 6 7 8 9 10 11 Ws Time We

TABLE V: Insertion of the plan Π3 into a feasible schedule.

3 4 1

3 J1 J2 J2

e t(e) S(e) C(e) b1(e) b2(e) b3(e) s 4 e e1 2 {J1,J3, J } ∅ 1 1 1 c 1 1 1 r 4 2 2 e2 4 {J2}{J 4} 1 1 1 u J1 J1 1 1 o

3 s

e3 5 ∅ {J1 } 1 1 0 e

4 2 2 1 R e4 6 {J2 ,J2 }{J1 ,J1 } 1 0 1 1 2 1 4 1 J1 J2 e5 7 {J2 }{J2 } 1 0 1 1 2 e6 9 ∅ {J2 ,J2 } 0 0 0

0 1 2 3 4 5 6 7 8 9 10 11 Ws Time We

TABLE VI: Insertion of the plan Π4 into a feasible schedule.

5 5 for J2 is s2 = 5. The resources constraints are not satisfied eight different scenarios, which results are listed in TableIX. in the events e3, e4 and e5. The event e6 is the first feasible Following are listed the differences between each scenario: J 5 t(e ) insertion point for the task 2 , since at 6 the precedence • Scenario 1: set of plans listed in Table VIII; e 1 and temporal constraints are met. Also, in 6 both resources • Scenario 2: in this scenario all the plans have the 5 and 3 are available (b1(e6) = 0 and b3(e6) = 0). The task J2 same temporal window [rk, dk] fixed to [0, 180], and 5 is finally scheduled at s2 = t(e6), and the usages of resources the plans are all tied by precedence relations, so that 1 and 3, respectively b1(e6) and b3(e6), are updated. Since a ∀i, j, j > i, Πi ≺ Πj; J 5 J 5 feasible insertion point has been found for both 1 and 2 , • Scenario 3: in this scenario we modified the release time the plan Π5 is scheduled correctly and the schedule generated of each plan in such way to have the maximum number is considered as feasible schedule. of events; Table VII shows the resulting Gantt diagram and the event • Scenario 4: in this scenario we duplicated all the plans list EL after the insertion of the plan Π5. with priority 6 and 8; • Scenario 5: in this scenario we duplicated all the plans VI.COMPUTATIONAL RESULTS with priority 1 and 3; In this section we present the computational results for the • Scenario 6: in this scenario we used the same benchmark proposed heuristic. All the experiments were run on an entry- as the scenario 1, but we used a time window [Ws,We] level machine (Intel i5-4210U, 6GB RAM, Linux OS). The fixed to [0, 90]; were entirely written in Java (version 8). • Scenario 7: in this scenario we used the same benchmark We run different experiments of our algorithm by using a as the scenario 1, but we used a time window [Ws,We] benchmark that depicts a realist scenario of a mission carried fixed to [0, 270]; out by a Remote Piloted Air Vehicle (RPAS), which set of • Scenario 8: in this scenario we used the same benchmark plans, listed in Table VIII, has to be scheduled. The validity as the scenario 1, but each plan has a duplicate. of the mission is constrained between 0 and 180 seconds. TableIX presents the execution times for each scenario. Therefore, the time window [Ws,We] is fixed to [0, 180]. Each execution time is calculated as the mean of the execution We first evaluated the proposed heuristic on the benchmark times of ten runs of the algorithm on the same benchmark. listed in Table VIII. Then, we evaluated the performance The obtained computational results of the algorithm gave of the proposed heuristic on different benchmarks obtained us a first proof of concept concerning the complexity of the by modifying the set of plans listed in Table VIII. These scheduling problem we address. Moreover, the results are yet modified benchmarks are opportunely set up in such a way satisfactory in the context of scheduling plans for RPAS. As that the constraints are more or less relaxed. Thus, we studied the problem of scheduling plans of tasks is difficult due to its 10

3 4 1 5

3 J1 J2 J2 J2 e t(e) S(e) C(e) b1(e) b2(e) b3(e) 1 3 4 s e1 2 {J ,J ,J } ∅ 1 1 1 e

1 1 1 c e2 4 {J2}{J4} 1 1 1 r 4 2 5 2 1 1 u

J1 J1\ J11

3 o

e3 5 ∅ {J1 } 1 1 0 s e4 6 {J4,J2, J 5}{J2,J1} 1 1 1 e 2 2 1 1 1 R 1 4 1 2 5 e5 7 {J2 }{J2 } 1 1 1 1 J1 J2 J22 5 1 2 5 e6 9 {J2 }{J2 ,J2 , J1 } 1 0 1 5 e7 10 ∅ {J2 } 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 Ws Time We

TABLE VII: Insertion of the plan Π5 into a feasible schedule.

k k k k k k k k k k Πk nk αk R [r , d ] p1 p2 p3 p4 δij Πk ≺ Πj Ji ≺ Jj 1 1 Π1 2 3 {1, 2} [0, 180] 3 3 J1 ≺ J2 Π2 2 3 {3, 4} [0, 180] 4 4 Π3 1 3 {5} [0, 180] 3 Π4 1 3 {6} [0, 180] 3 Π5 1 3 {7} [0, 180] 1 Π6 1 3 {8} [0, 180] 1 7 7 Π7 4 1 {5, 9, 10, 11} [80, 160] 20 20 20 20 J3 ≺ J4 8 8 Π8 4 1 {5, 9, 10, 11} [40, 120] 20 20 20 20 J3 ≺ J4 9 9 Π9 4 1 {5, 9, 10, 11} [40, 120] 20 20 20 20 J3 ≺ J4 10 10 Π10 3 5 {1, 2, 10} [50, 80] 5 5 5 J1 ≺ J2 11 11 Π11 4 5 {5, 9, 10, 11} [80, 120] 20 20 20 20 Π10 ≺ Π11 J3 ≺ J4 12 12 Π12 4 1 {5, 9, 10, 11} [0, 80] 20 20 20 20 J3 ≺ J4 13 13 Π13 3 5 {1, 2, 10} [0, 40] 5 5 5 J1 ≺ J2 14 14 Π14 4 5 {5, 9, 10, 11} [40, 80] 20 20 20 20 Π13 ≺ Π14 J3 ≺ J4 15 15 Π15 3 6 {1, 2, 10} [0, 20] 5 5 5 J1 ≺ J2 16 16 Π16 4 6 {5, 9, 10, 11} [20, 80] 20 20 20 20 Π15 ≺ Π16 J3 ≺ J4 17 17 Π17 2 8 {3, 4} [60, 120] 2 2 J1 ≺ J2 18 18 Π18 2 8 {3, 4} [60, 120] 2 2 J1 ≺ J2 19 19 Π19 2 8 {3, 4} [60, 120] 2 2 J1 ≺ J2 20 20 Π20 3 6 {1, 2, 10} [0, 20] 5 5 5 J1 ≺ J2 21 21 Π21 4 6 {6, 9, 10, 11} [20, 60] 20 20 20 20 Π20 ≺ Π21 J3 ≺ J4 Π22 2 6 {14, 10} [30, 70] 2 2 23 23 Π23 4 1 {6, 9, 10, 11} [40, 90] 20 20 20 20 J3 ≺ J4 24 24 Π24 4 1 {6, 9, 10, 11} [80, 150] 20 20 20 20 J3 ≺ J4 25 25 Π25 4 1 {6, 9, 10, 11} [80, 130] 20 20 20 20 J3 ≺ J4 26 26 Π26 4 1 {6, 9, 10, 11} [130, 160] 20 20 20 20 J3 ≺ J4 Π27 2 4 {14, 10} [0, 180] 2 2 28 28 Π28 3 6 {1, 2, 10} [80, 120] 5 5 5 J1 ≺ J2 29 29 Π29 2 6 {3, 4} [120, 140] 2 2 Π28 ≺ Π29 J1 ≺ J2 Π30 2 6 {14, 10} [120, 140] 2 2 31 31 Π31 4 1 {6, 9, 10, 11} [150, 190] 20 20 20 20 J3 ≺ J4 32 32 Π32 2 4 {3, 4} [120, 140] 2 2 J1 ≺ J2 TABLE VIII: The benchmark used for evaluating the performance of the proposed method.

K = |P| Knk |Ps| |Ps|nk Time (in ms) Scenario 1 32 91 24 56 ∼ 183 VII.FUTUREWORKS Scenario 2 32 91 24 67 ∼ 183 Scenario 3 32 91 24 64 ∼ 219 A. Variable resource availability Scenario 4 42 118 30 68 ∼ 316 Scenario 5 47 135 29 64 ∼ 345 The proposed heuristic considers only resources with a Scenario 6 32 91 16 35 ∼ 197 fixed availability of Bρ = 1, ∀ρ ∈ R. A generalization of Scenario 7 32 91 24 60 ∼ 228 the algorithm could take into account resources with variable Scenario 8 64 182 37 81 ∼ 538 availability values, so that one resource could be used by TABLE IX: Execution times of the eight scenarios. different tasks at the same time. Augmenting the resource availability could also lead to better schedules in terms of number of plans scheduled into a fixed time window, as showed in Example4. tight constraints, we conclude that the quality of the schedules Example 4. Let P = {Π1, Π2} be a set of two plans Π1 and 1 1 1 provided by the proposed heuristic is good with respect to the Π2 which have each one task, respectively J1 (r1 = 1, d1 = 6, 1 2 2 2 2 complexity of the evaluated benchmarks. p1 = 3) and J1 (r1 = 4, d1 = 10, p1 = 4). In Figure6 are 11

2 showed two possible schedules for the task J1 . If the resource 1 has a maximum availability B1 = 1 (Figure 6a), the earliest 2 starting time for the task J1 would be 6, because otherwise the usage of resource would exceed its availability. Instead, if t=t0+50 the availability of the resource is 2 (Figure 6b), the earliest starting time would be set to 4 (that is, the release time of the task), and so the use of the resource is maximized. Also, in the schedule showed in Figure 6b the time interval [5, 8] can t=t0+40 be employed for scheduling other tasks, whereas this is not possible in the schedule in Figure 6a. t=t0+30 R s

e t=t0+20 c

r 1 2 1

u J1 J1 o s e R Object’s t=t +10 0 1 2 3 4 5 6 7 8 9 10 11 range 0 Ws Time We (a) RPAS RPAS’s t=t range 0

2 s

e J1 c

r 1 1

u J1 o s Fig. 7: An example of RPAS that has to communicate in- e R formations to an object R. The processing time of the tasks 0 1 2 3 4 5 6 7 8 9 10 11 communicating with R could vary according to the distance Ws Time We between the object R and the RPAS with respect to the time instant t. (b) Fig. 6: Scheduling of task J 2, which has a release time of 4, 1 d max into a resource with availability B1 = 1 (6a) and a resource with availability B1 = 2 (6b).

k B. pi as function of time k k The value of the processing time pi for a task Ji could be k modeled as a function of time pi (t) in such a way that the k processing time of a task Ji can vary according to the time instant in which it is scheduled. To motivate this extension, we present in Example5 a case study of a RPAS that has to accomplish some in-flight operation. Example 5. Let us consider a RPAS that has to accomplish a mission where it has to follow a straight trajectory and collect data from an object R located in the terrain during a fixed d min t +20 t +30 t +40 time range, as depicted in Figure7. During the the time range 0 0 0 in which the RPAS is within the object’s range it has to send Fig. 8: An inverse Gaussian used to model the processing time information to the object R in the terrain. The operation of p(t) of the the operation of sending information to a fixed sending information could require more time when the RPAS object for the RPAS in Figure7. is far from the object, but less time when it is near the object. Thus, the processing time function related to the operation of sending information could be modeled as an inverse Gaussian C. Alternative schedules function, as showed in Figure8, where dmax and dmin are respectively the maximum and the minimum distance between The proposed heuristic works in an incremental fashion, the RPAS and the object R. adding plans in order to a working schedule Sw and keeping 12

a set Ps of successfully scheduled plans, as well as a set Pf [6] C. Schwindt and J. Zimmermann, eds., Handbook on Project Manage- of unscheduled plans. The incremental process of construction ment and Scheduling Vol.1. Cham: Springer International Publishing, 2015. DOI: 10.1007/978-3-319-05443-8. of a feasible schedule can be represented as an directed [7] T. H. Cormen, C. Stein, R. L. Rivest, and C. E. Leiserson, Introduction acyclic graph, as shown in the example graph in Figure9. to Algorithms. McGraw-Hill Higher Education, 2nd ed., 2001. According to this representation, each vertex represents a [8] A. B. Kahn, “Topological sorting of large networks,” Communications of the ACM, vol. 5, pp. 558–562, Nov. 1962. feasible schedule, while a directed arc (i, j), which has label [9] R. L. Graham, E. L. Lawler, J. K. Lenstra, and A. H. G. R. Kan, Πk, represents the insertion of the plan Πk into the schedule “Optimization and Approximation in Deterministic Sequencing and Scheduling: a Survey,” Annals of Discrete Mathematics, vol. 5, pp. 287– Si, that leads to a new feasible schedule Sj. 326, Jan. 1979. [10] P. Brucker, A. Drexl, R. Mohring,¨ K. Neumann, and E. Pesch, “Resource-constrained project scheduling: Notation, classification, mod- Π8 Π9 els, and methods,” European Journal of Operational Research, vol. 112, S7 S8 pp. 3–41, Jan. 1999. [11] C. Artigues, S. Demassey, and E. Neron, Resource-Constrained Project Scheduling: Models, Algorithms, Extensions and Applications. ISTE, 2007. Π1 Π2 Π3 ∅ S1 S2 S3 [12] T. Peters, “Timsort.” http://bugs.python.org/file4451/timsort.txt, 2002.

Π5 Π6 Π7 S4 S5 S6

Fig. 9: The graph representation of a feasible schedule with four plans (in blue), and two possible alternative schedule (yellow and green).

The incremental manner of constructing the schedules has the advantage of being able to return a feasible schedule at each iteration of the algorithm. Since the proposed method builds only a graph with no branches (no alternative schedule paths), a possible extension could consider different metrics to build alternative paths in the graph of solutions. For example, as the proposed heuristic returns a set Pf of plans unscheduled due to constraints violations, one possible extension could increase the priority values of the unscheduled plans in Pf while lowering those of a subset of feasible plans in Ps. In this manner, alternative paths in the solution graph could be found. Also, these al- ternative paths could maximize further the objective function, thus allowing the heuristic method to escape from the local optima.

VIII.CONCLUSIONS This article presented a heuristic algorithm for the problem of scheduling plans of tasks. The algorithm may be employed in realistic scenarios where the classical scheduling technique can not be used due to the considered constraints.

REFERENCES [1] M. L. Pinedo, Scheduling. Springer US, 2012. DOI: 10.1007/978-1- 4614-2361-4. [2] R. Klein, Scheduling of Resource-Constrained Projects, vol. 10 of Operations Research/ Interfaces Series. Boston, MA: Springer US, 2000. DOI: 10.1007/978-1-4615-4629-0. [3] L. Grivault, A. E. Fallah-Seghrouchni, and R. Girard-Claudon, “Agent- Based Architecture for Multi-sensors System Deployed on Airborne Platform,” pp. 86–89, IEEE, Sept. 2016. [4] S. Kemkemian and M. Nouvel-Fiani, “Toward common radar & EW multifunction active arrays,” pp. 777–784, IEEE, Oct. 2010. [5] S. Imai, E. Blasch, A. Galli, W. Zhu, F. Lee, and C. A. Varela, “Airplane flight safety using error-tolerant data stream processing,” IEEE Aerospace and Electronic Systems Magazine, vol. 32, pp. 4–17, Apr. 2017.