Software Project Scheduling Problemminkull/publications/lecture-spsp.pdfSoftware Project Scheduling...

Post on 17-Apr-2021

10 views 0 download

Transcript of Software Project Scheduling Problemminkull/publications/lecture-spsp.pdfSoftware Project Scheduling...

Software Project Scheduling Problem

Leandro Minku www.cs.bham.ac.uk/~minkull

Nature-inspired Optimisation Lecture

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Outline• What is the Software Project Scheduling Problem

(SPSP)? • Why are automated optimisation methods important

for the SPSP? • How to solve the SPSP?

2

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Each task requires a set of skills and effort.Tasks also have a precedence relation.

Software Project Scheduling Problem (SPSP)

3

Allocate

Different allocations will lead to different

project cost and duration.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Software Project Scheduling Problem (SPSP)

It is very difficult to optimally assign employees to tasks manually.

• The space of possible allocations can be enormous.

4

SPSP: find a good allocation of employees to tasks in a software project so as to minimise its cost and completion time.

We can use optimisation algorithms (e.g., EAs) to solve the SPSP!

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Advantages of Optimisation Algorithms for the SPSP

• Insight into how to optimise objectives -- they may find solutions that no human has thought of.

• Speed up the task of allocating employees to tasks. • Help software manager to find solutions that satisfy

all constraints. • Team must have skills to perform a task. • No overwork is allowed [video].

5

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Formulating the SPSP

6

Setting: assume we are given • n employees e1, . . . , en with salaries and sets of skills; • m tasks t1, . . . , tm with efforts and sets of required skills; • a task precedence graph (TPG).

Problem: allocate employees to tasks so as to: • minimise cost (total salaries paid) and • minimise duration (completion time).

Constraints: • team must have required skills and • no overwork.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Solving the SPSPWhat type of evolutionary algorithm would be adequate?

• Multi-objective Evolutionary Algorithms, e.g., NSGA-II.

7

f1 = cost

f2 = duration

Solution x1 dominates x2 iif: ∀i, fi(x1) ≤ fi(x2) ∃i, fi(x1) < fi(x2)

Non-dominated solutions.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

NSGA-II

8

* From Lecture 15.

[Video: https://youtu.be/sEEiGM9em8s]

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Designing an Evolutionary Algorithm

• Representation / encoding; • mutation and crossover; • fitness / objectives evaluation; • how to deal with constraints.

9

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Designing an Evolutionary Algorithm

10

• Representation / encoding; • mutation and crossover; • fitness / objectives evaluation; • how to deal with constraints.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Formulating the SPSP

11

Setting: assume we are given • n employees e1, . . . , en with salaries and sets of skills; • m tasks t1, . . . , tm with efforts and sets of required skills; • a task precedence graph (TPG).

Problem: allocate employees to tasks so as to: • minimise cost (total salaries paid) and • minimise duration (completion time).

Constraints: • team must have required skills and • no overwork.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

RepresentationDedication: percentage of time an employee spends on a task, respecting a certain granularity k.

Employees can divide their attention among tasks.

12

t1 t2 ... tm

e1 x1,1 x1,2 ... x1,m

e2 x2,1 x2,2 ... x2,m

... ... ... ... ...en xn,1 xn,2 ... xn,m

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Designing an Evolutionary Algorithm

• Representation / encoding; • mutation and crossover; • fitness / objectives evaluation; • how to deal with constraints.

13

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Mutation and Crossover• Mutation of xi,j picks a new dedication uniformly at

random from {0/k, 1/k, ..., k/k} \ xi,j. • Crossover: exchange rows

14

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Mutation and Crossover• Mutation of xi,j picks a new dedication uniformly at

random from {0/k, 1/k, ..., k/k} \ xi,j. • Crossover: exchange rows

15

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Mutation and Crossover• Mutation of xi,j picks a new dedication uniformly at

random from {0/k, 1/k, ..., k/k} \ xi,j. • Crossover: exchange rows

16

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Mutation and Crossover• Mutation of xi,j picks a new dedication uniformly at

random from {0/k, 1/k, ..., k/k} \ xi,j. • Crossover: exchange rows

17

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Mutation and Crossover• Mutation of xi,j picks a new dedication uniformly at

random from {0/k, 1/k, ..., k/k} \ xi,j. • Crossover: exchange rows or columns.

18

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Designing an Evolutionary Algorithm

• Representation / encoding; • mutation and crossover; • fitness / objectives evaluation; • how to deal with constraints.

19

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Formulating the SPSP

20

Setting: assume we are given • n employees e1, . . . , en with salaries and sets of skills; • m tasks t1, . . . , tm with efforts and sets of required skills; • a task precedence graph (TPG).

Problem: allocate employees to tasks so as to: • minimise cost (total salaries paid) and • minimise duration (completion time).

Constraints: • team must have required skills and • no overwork.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Evaluating a Solution

21

t1 t2 t3 t4

e1 x1,1 x1,2 x1,3 x1,4

e2 x2,1 x2,2 x2,3 x2,4

e3 x3,1 x3,2 x3,3 x3,4

+ TPG, tasks required efforts

Cost and duration+ salaries

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Example for 1 employee, 4 tasks, k = 2

22

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

t1

t2

t3

t4

Gan

tt C

hart

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql, java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Example for 1 employee, 4 tasks, k = 2

23

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

t1: 4 / 0.5 = 8 months

t1

t2

t3

t4

Gan

tt C

hart

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql, java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Example for 1 employee, 4 tasks, k = 2

24

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

t1: 4 / 0.5 = 8 months

t2: 4 / 0.5 = 8 months

t1

t2

t3

t4

Gan

tt C

hart

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql, java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Example for 1 employee, 4 tasks, k = 2

25

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

t1: 4 / 0.5 = 8 months

t2: 4 / 0.5 = 8 months

t3: 8 / 0.5 = 16 months

t1

t2

t3

t4

Gan

tt C

hart

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql, java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Example for 1 employee, 4 tasks, k = 2

26

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

t1: 4 / 0.5 = 8 months

t2: 4 / 0.5 = 8 months

t3: 8 / 0.5 = 16 monthst4: 2 / 0.5 = 4

months

t1

t2

t3

t4

Gan

tt C

hart

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql, java}

What is the completion time of the project?

And the cost?

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Designing an Evolutionary Algorithm

• Representation / encoding; • mutation and crossover; • fitness / objectives evaluation; • how to deal with constraints.

27

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Formulating the SPSP

28

Setting: assume we are given • n employees e1, . . . , en with salaries and sets of skills; • m tasks t1, . . . , tm with efforts and sets of required skills; • a task precedence graph (TPG).

Problem: allocate employees to tasks so as to: • minimise cost (total salaries paid) and • minimise duration (completion time).

Constraints: • team must have required skills and • no overwork.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Infeasible Schedule -- Missing Skills

29

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {java}

No. skills missing: 1

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Infeasible Schedule -- Missing Skills

30

t1 t2 t3 t4

e1 0.5 0.5 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {tcp/ip,sql} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {java}

No. skills missing: 3

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Overwork• There is overwork at time τ if, for a given employee

ei, the total dedication of ei to tasks at time τ is: ∑j active at τ xij > 1

• Overwork for employee ei at time τ = max(0, ∑j active at τ xij - 1)

31

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

32

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / 1 = 4

months

t3: 8 / 0.5 = 16 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

33

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}∑j active at τ x1j =1.5

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / 1 = 4

months

t3: 8 / 0.5 = 16 monthst4: 2 / 0.5 = 4

months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

34

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}∑j active at τ x1j =1.5

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

How to Deal with the Constraints?

• Option 1: assign very high cost and duration if constraints are violated.

Cost = ncost_penal + nover * overwork + nskills * skills_missing Duration = ndur_penal + nover * overwork + nskills * skills_missing

35

Value higher than any feasible cost and duration.

Total amount of overwork time.

Total number of skills missing in the teams.

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

How to Deal with the Constraints?

• Option 1: assign very high cost and duration if constraints are violated.

Cost = ncost_penal + nover * overwork + nskills * skills_missing Duration = ndur_penal + nover * overwork + nskills * skills_missing

36

What are the problems of this solution?

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

How to Deal with the Constraints?

• Option 2: normalise dedications to deal with overwork so that total dedication is at most 1.

If employee i has overwork at any moment τ dij(τ) = xij / ∑j active at τ xij

else dij(τ) = xij

Cost = ncost_penal * 2 * skills_missing Duration = ndur_penal* 2 * skills_missing

37

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / 1 = 4

months

t3: 8 / 0.5 = 16 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

38

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}∑j active at τ x1j =1.5

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / (1/1.5) = 6

months

t3 = 8 / (0.5/1.5) = 24 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

39

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}d1,2 = 1/1.5

d1,3 = 0.5/1.5

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / (1/1.5) = 6

monthst3: 6 months with

d13 = 0.5/1.5 t3: (8 - 2) / 0.5 =12 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

40

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}= 2 person-month

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

t1: 4 / 0.5 = 8 monthst2: 4 / (1/1.5) = 6

monthst3: 6 months with

d13 = 0.5/1.5 t3: (8 - 2) / 0.5 =12 months

t4: 2 / 0.5 = 4 months

Infeasible Schedule -- Overwork (∑j active at τ xij > 1)

41

t1 t2 t3 t4

e1 0.5 1 0.5 0.5

Gan

tt C

hart

t1

t2

t3

t4

t1's required effort and skills: 4 p-month, {sql, java} t2's required effort and skills: 4 p-month, {java} t3's required effort and skills: 8 p-month, {java} t4's required effort and skills: 2 p-month, {java} e1's salary and skills: $1000 per full time month, {sql,java}

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

[Demo -- Ian Watson's final year project (2013)]

42

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Summary• What Software Project Scheduling Problem (SPSP) is. • Why are automated optimisation methods are

important for the SPSP. • How to solve the SPSP:

• suitable EA; • representation; • mutation and crossover; • objectives; • constraints.

43

Leandro Minku (www.cs.bham.ac.uk/~minkull) Software Project Scheduling Problem (SPSP)

Further ReadingL. Minku, D. Sudholt and X. Yao. "Improved Evolutionary Algorithm Design for the Project Scheduling Problem Based on Runtime Analysis", IEEE Transactions on Software Engineering vol. 40, n. 1, p. 83-102, 2014.

F. Luna, D. Gonz ︎alez-A ︎lvarez, F. Chicano, and M. Vega- Rodr ︎ıguez, "On the Scalability of Multi-Objective Metaheuristics for the Software Scheduling Problem", Proceedings of the 11th International Conference on Intelligent System Design and Applications, p. 1110-1115, 2011.

E. Alba and F. Chicano, "Software Project Management with GAs", Information Sciences, vol. 177, p. 2380-2401, 2007.

44