Presentation is loading. Please wait.

Presentation is loading. Please wait.

Applications of Genetic Algorithms to Resource- Constrained Scheduling Tasks Keith Downing Dept. of Computer and Information Sciences The Norwegian University.

Similar presentations


Presentation on theme: "Applications of Genetic Algorithms to Resource- Constrained Scheduling Tasks Keith Downing Dept. of Computer and Information Sciences The Norwegian University."— Presentation transcript:

1 Applications of Genetic Algorithms to Resource- Constrained Scheduling Tasks Keith Downing Dept. of Computer and Information Sciences The Norwegian University of Science & Technology Trondheim, Norway

2 Outline Introduction to Evolutionary Algorithms –Basic Concepts –Simple Scheduling Example Applying EA’s to Scheduling Problems –Travelling Salesman –Job Sequencing –Classic Job-Shop Scheduling * Main Focus: Representational Issues

3 Darwinian Evolution Genotypes Phenotypes Morphogenesis Natural Selection Recombination & Mutation Ptypes Gtypes Reproduction Sex Genetic Physiological, Behavioral

4 Evolutionary Algorithms Bit Strings Parameters, Code, Neural Nets, Rules Translate Performance Test Recombination & Mutation P,C,N,R Bits Generate Semantic Syntactic R &M

5 Evolutionary Computation = Parallel Stochastic Search Biased Roulette Wheel CrossoverMutation Next Generation Selection Translation & Performance Test Selection Biasing

6 Types of Evolutionary Algorithms Genetic Algorithms (Holland, 1975) Representation: Bit Strings => Integer or real feature vectors Syntactic crossover (main) & mutation (secondary) Evolutionary Strategies (Recehenberg, 1972; Schwefel, 1995) Representation: Real-valued feature vectors Semantic mutation (main) & crossover (secondary) Evolutionary Programs (Fogel, Owens & Walsh, 1966; Fogel, 1995) Representation: Real-valued feature vectors or Finite State Machines Semantic mutation (only) View each individual as a whole species, hence no crossover Genetic Programs (Koza, 1992) Representation: Computer programs (typically in LISP) Syntactic crossover (main) & mutation (secondary)

7 Evolutionary Computation Requirements Domain that supports quantitative fitness assignment Fitness function that accurately evaluates performance Representation for solutions that tolerates mutation & crossover P1 P2 P X Classic Genetic Algorithm

8 Using Evolutionary Algorithms When Large, rough search spaces Satisficing or Optimization problems Entire solutions are easily generated and tested Exhaustive search methods are too slow Heuristic search methods cannot find good solutions (e.g. Stuck at local max) How Determine EA-amenable representation of solutions Define fitness function Define selection function = roulette-wheel biasing function (f: fitness -> area) Set key EA parameters: population size, mutation rate, crossover rate, # generations, etc. * EA’s are easy to write, and there’s lots of freeware! * Specific problems often require specific representations & genetic operators

9 Application Areas for Evolutionary Algorithms Optimization: Controllers, Job Schedules, Networks(TSP) Electronics: Circuit Design (GP) Finance: Stock time-series analysis & prediction Economics: Emergence of Markets, Pricing & Purchasing Strategies Sociology: cooperation, communication, ANTS! Computer Science –Machine Learning: Classification, Prediction… –Algorithm design: Sorting networks Biology –Immunology: natural & virtual (computer immune system) –Ecology: arms races, coevolution –Population genetics: roles of mutation, crossover & inversion –Evolution & Learning: Baldwin Effect, Lamarckism…

10 Process Scheduling (Kidwell, 1993) Task pairs (run + communicate result) to be run on a set of processors –((7, 16) (11, 22) (12, 40), (15, 22)….) A task’s run must finish before result sending begins All processors share a central communication line (bus) Each processor can handle only one task at a time. Each processor is capable of running any of the tasks Only one processor at a time can send its message A task cannot be removed from a processor until both run & send are finished Tasks run on the main processor, P0, require no communication time, whereas tasks run on all other processors must send their message to P0 Goal: Schedule the tasks on processors so as to minimize the total timespan P7P6P4P2P0P3P5P1

11 Process Schedule Optimization using the Genetic Algorithm Use GA to search the space of possible schedules (solutions) 1. Represent schedule in a GA-amenable form (i.e. linearize it) Processor for Task #1Processor for Task #4... ( …….) …. 2. Define a fitness function Fitness = MaxTimespan - Timespan * Lower timespan => Higher fitness Other possibilities: 1/(1 + (Timespan - MinTimespan))

12 GA-based Schedule Optimization *Compute schedule’s timespan by running on a process-network simulator. 1. Remove next task (whose assigned processor is open) from task-list and start simulating it on that processor. 2. Remove tasks from processors as soon as they finish running & sending 3. Define a biasing function to convert fitness to a proportion of the roulette wheel Sigma Scaling: (One of many standard biasing functions): ExpVal(x) = Max ( 0, 1 + (Fitness (x) - AvgFitness) / (2 * StDevFitness)) Normalizing: Roulette-Wheel%(x) = ExpVal(x) / SumofAllExpVals 4. Select Mutation and Crossover Rates: pmut = 0.01; pcross = Select a population size popsize = Select # of generations:numgen = Run the Genetic Algorithm Generates a random initial population (of schedules) and evolves them via sigma-scaling selection, crossover and mutation for numgen generations

13 Kidwell’s (1993) Task List ((7 16) (11 22) (12 40) (15 22) (17 23) (17 23) (19 23) (20 28) (20 27) (26 27) (28 31) (36 37) (31 29) (28 22) (23 19) (22 18) (22 17) (29 16) (27 16) (35 15)) MaxTime = Sum of all run & send times = 916 time units Use 8 processors: P0 - P7, with P0 being the master processor

14 Population of Schedules (Generation # 0) These are randomly-generated: Processor List 1: Span: 401 Fitn: 515 (11.0%)| ( ) 2: Span: 383 Fitn: 533 (13.7%)| ( ) 3: Span: 426 Fitn: 490 ( 7.1%)| ( ) 4: Span: 415 Fitn: 501 ( 8.8%)| ( ) 5: Span: 377 Fitn: 539 (14.7%)| ( ) 6: Span: 435 Fitn: 481 ( 5.7%)| ( ) 7: Span: 439 Fitn: 477 ( 5.1%)| ( ) 8: Span: 410 Fitn: 506 ( 9.6%)| ( ) 9: Span: 337 Fitn: 579 (20.9%)| ( ) 10: Span: 449 Fitn: 467 ( 3.5%)| ( ) Avg Fitness: StDev Fitness: 32.28

15 Roulette Wheel (Generation # 0)

16 1: Span: 366 Fitn: 550 (12.1%)| ( ) 2: Span: 406 Fitn: 510 ( 7.9%)| ( ) 3: Span: 377 Fitn: 539 (11.0%)| ( ) 4: Span: 464 Fitn: 452 ( 1.8%)| ( ) 5: Span: 366 Fitn: 550 (12.1%)| ( ) 6: Span: 337 Fitn: 579 (15.2%)| ( ) 7: Span: 337 Fitn: 579 (15.2%)| ( ) 8: Span: 415 Fitn: 501 ( 7.0%)| ( ) 9: Span: 465 Fitn: 451 ( 1.7%)| ( ) 10: Span: 329 Fitn: 587 (16.0%)| ( ) Avg Fitness: StDev Fitness: Population of Schedules (Generation # 1)

17 Roulette Wheel (Generation # 1)

18 1: Span: 337 Fitn: 579 (11.7%)| ( ) 2: Span: 465 Fitn: 451 ( 0.0%)| ( ) 3: Span: 366 Fitn: 550 ( 8.8%)| ( ) 4: Span: 329 Fitn: 587 (12.5%)| ( ) 5: Span: 329 Fitn: 587 (12.5%)| ( ) 6: Span: 270 Fitn: 646 (18.4%)| ( ) 7: Span: 364 Fitn: 552 ( 9.0%)| ( ) 8: Span: 337 Fitn: 579 (11.7%)| ( ) 9: Span: 347 Fitn: 569 (10.7%)| ( ) 10: Span: 410 Fitn: 506 ( 4.5%)| ( ) Avg Fitness: StDev Fitness: Population of Schedules (Generation # 2)

19 Roulette Wheel (Generation # 2)

20 1: Span: 263 Fitn: 653 (10.6%)| ( ) 2: Span: 232 Fitn: 684 (16.7%)| ( ) 3: Span: 325 Fitn: 591 ( 0.0%)| ( ) 4: Span: 261 Fitn: 655 (11.0%)| ( ) 5: Span: 249 Fitn: 667 (13.3%)| ( ) 6: Span: 255 Fitn: 661 (12.1%)| ( ) 7: Span: 292 Fitn: 624 ( 4.8%)| ( ) 8: Span: 269 Fitn: 647 ( 9.4%)| ( ) 9: Span: 247 Fitn: 669 (13.7%)| ( ) 10: Span: 274 Fitn: 642 ( 8.4%)| ( ) Avg Fitness: StDev Fitness: Population of Schedules (Generation # 6)

21 Roulette Wheel (Generation # 6)

22 1: Span: 265 Fitn: 651 ( 0.4%)| ( ) 2: Span: 241 Fitn: 675 (12.3%)| ( ) 3: Span: 238 Fitn: 678 (13.8%)| ( ) 4: Span: 258 Fitn: 658 ( 3.8%)| ( ) 5: Span: 248 Fitn: 668 ( 8.8%)| ( ) 6: Span: 246 Fitn: 670 ( 9.8%)| ( ) 7: Span: 246 Fitn: 670 ( 9.8%)| ( ) 8: Span: 242 Fitn: 674 (11.8%)| ( ) 9: Span: 226 Fitn: 690 (19.7%)| ( ) 10: Span: 246 Fitn: 670 ( 9.8%)| ( ) Avg Fitness: StDev Fitness: (Convergence) Population of Schedules (Generation # 9)

23 Roulette Wheel (Generation # 9)

24 Process-Schedule Evolution GA falls off a peak Convergence

25 Travelling Salesman Problem (TSP) Given: N cities & matrix of distances between them. Find: Shortest cyclic tour that visits all cities. NP-Hard: Exponential to both find solutions & to verify solutions Heuristic Methods: Find optimal solutions when N< Genetic Algorithm: Find good solutions for any N Applications: Network building, Delivery routing, Sequence scheduling...

26 Applying GAs to TSP Fitness Function: 1/tour-length or optimal-tour-length/tour-length Chromosome: Direct Representation: List of cities (standard approach) …. Indirect Representation: List of next city to pull from ordered list and insert into the solution sequence …. => … Crossover Standard Bit or Integer Cross: Only works for indirect representations Location Preserving: Children inherit, as much as possible, cities in same gene location as parents Edge Preserving: Children inherit, as much as possible, city-city edges from parents (actual edge locations in the chromosome may vary from parent to kid) *Crossover is the key element to TSP GA’s - and where most research is done.

27 Representational Issues for GA-based TSP Standard Crossover & Mutation are purely syntactic => pay no attention to semantics (i.e. The meanings of the bits or integers that they manipulate). Direct representations often embody constraints that simple crossover & mutation cannot enforce. Indirect representations usually involve fewer constraints, so simple crossover & mutation are often sufficient. Compare to Process Scheduling (Kidwell), where constraints (i.e. All alleles between 0 and N) were easy to enforce x 6; 0 x 4 2 x 4; 0 x 6 X

28 Partially-Mapped Crossover (PMX) Goldberg (1985) 1. Choose equal-length segments to swap 2. Create a mapping between corresponding elems of the segments 3. Swap the segments 4. Apply the map to each child to restore completeness Select Segments P1: P2: Create Map (4 5; 5 8; 7 1) Swap K1’: Blue positions must be changed via mapping K2’: Apply Map (twice for last position in this eg.) K1: K2:

29 Subtour Operations (Cleveland & Smith, ‘89) Subtour Chunking Select random chunks from the parents Prune chunk of cities that already exist in the child Insert chunk into child position as close as possible to its position in parent P1: (9 4 3) 3 2 ( ) 1 (5 10) 5 P2: ( ) 2 9 (2 1) 4 K1: Subtour Replacement Find chunks with same elems in both parents and swap them P1: P2: K1: K2:

30 Inheritance For GA’s to make progress, they must pass on many of the good features from generation G to generation G+1. Hence, when parents crossover, the good features of each should be preserved in at least one of the children. Biology: Heritability = degree to which children resemble their parents (X kid-avg - X pop-avg ) = heritability*(X parent-avg -X pop-avg ) Location Preservation ( ) With PMX & Subtour exchanges, kids inherit many cities in the same position as in one of the parents. Results not that promising => GA viewed as inappropriate for TSP. Edge Preservation ( present) Edges are the key contributors to TSP costs (fitness), so what we really need to preserve are city pairs (i.e. Edges) of TSP tours. GA’s with edge focus perform much better, near optimal => GA useful for TSP!

31 Edge Recombination Operator (ERO) Whitley, Starkweather & Fuquay (1989) Maximizes edge inheritance 1. Create Edge Map 2. Init Kid with one of the parent’s first city: 3. Remove new kid city, NKC, from edge map 4. NKC = neighbor of NKC with the smallest edge list. If no remaining neighbors, randomly pick an unvisited city (=> violate edge inheritance) 5. If tour not complete goto 3 Edge Map A {C B E} B {A C F } E.g. ACDEFB x EABCFD C {A B D F} D {C E F} E {A D F}F {B C D E} A =>{C(3), B(2), E(2) => AE => {D(2), F(3)} => AED => {C(2), F(2)} => AEDC => {B(1), F(1)} => AEDCB => {F(0)} => AEDCBF * All edges in kid except FA come from one or another parent

32 Binary Matrix Crossover Homaifar, Guan & Liepins (1993) During crossover convert TSP tours to unidirectional connection matrices (c a b e f d) x (e b f a d c) => illegal tour => (a d c e b f) a b c d e f a b c d e f a b c d e f a b c d e f a b c X => => d (2nd bit) e f Problem: Redundancies (rows 1 & 3) and omissions (rows 5 & 6) in child Solution: Move 1’s from redundant rows to all-zero rows in a manner that preserves as many parent edges as possible. 100% edge preservation in example above.

33 Binary Matrix Crossover (2) Problem: Cycles of length < N Solution: Cut cycles and connect to one another *Whenever possible, the cycle-connecting edges should come from a parent Inversion: Choose a segment of the tour and reverse it. Hill Climbing: Only keep inversion products that yield higher fitness (shorter tours) Evolution (GA) + Learning (Hill Climbing) + Lamarckism (Reverse-encoding of learned improvement into the genome/tour)

34 TSP Benchmark Comparison Edge Inheritance beats position inheritance. Evolution + Learning beats evolution

35 Indirect Representations (Grefenstette, 1985) Pull 2nd element from the sorted list of unused cities and insert it into the next spot in the solution path Advantages Simple Representation Crossover & Mutation create legal tours => no (time consuming) special ops required Disadvantages Low Heritability (of positions and edges) Crossover can disrupt position sequences on right side of the crossover point

36 Inheritance Problems with Indirect Representations 6-city TSP P1: => P2: => Crossover after 2nd gene K1: => Inheritance: 66.6% position, 50% edge K2: => Inheritance: 66.6% position, 33.3% edge

37 Job Sequencing Problems Flow-Shop Scheduling Problem J items to be processed by a system = machine or sequence of machines. Determine proper order to introduce items into the system. Once in the system, its out of the scheduler’s control, so the assembly line is equivalent to a single machine from scheduler’s point of view. Different items may require different operations, with each op type demanding a setup time on a machine => often useful to group similar-op items in the scheduled sequence to reduce number of setups (i.e. Retooling time). Time constraints may make it important that X items are completely processed per day. Hence, som e retooling may be necessary. Each work area on the assembly line may be a set of machines, each capable of similar operations. + buffer for waiting items. Similar to TSP: –sequence of cities -vs- sequence of items –edges important: city distances -vs- retooling times

38 Computer Board Assembly Cleveland & Smith (1989) InsertWire WrapTest1SolderTest2 Example Problem: Contract 1: 2xA, 3xB, 4xC, 1xD (due date = 72 hours) Contract 2: 5xA, 1xC, 2xD (due date = 120 hours) Contract 3: 2xB, 1xC (due date = 24 hours) Solution Sequence: B3,B3,B1,C3,A1,A1,A2, A2,B1,B1,C1,C1,C1,C1, C2, D1, A2, A2, A2 15% fail

39 Cleveland & Smith (1989) Special Subtour operation for job-sequencing problems Same procedure as standard subtour chunking, but: Decision of where to place chunks relative to one another is based on average due dates of jobs in the chunk Assume (10 4) has later average due date than ( ) P1: (9 4 3) 3 2 ( ) 1 (5 10) 5 P2: ( ) 2 9 (2 1) 4 K1: (10 4) placed after ( ) Knowledge-Intensive genetic operators Semantics (meaning) of the chromosomal bits/integers influence result of crossover. PMX, simple subtour chunking, subtour replacement and most genetic ops on indirect representations are “blind”, purely syntactic. In nature, genetic operations are blind, but GA’s can exploit semantics during crossover & mutation to speed convergence to optimal solutions. Weighted Subtour Chunking

40 GA -vs- Heuristic Methods: Job Sequencing Cleveland & Smith (1989) Heuristics EDD: Earliest Due Date jobs released first SPT: Shortest Processing Time jobs released first LST: Least Slack Time jobs released first Slack Time = Due Date - Total Processing Time Table values = costs (earliness and lateness are penalized) Weighted Chunking always among the best performing crossover ops Subtour Replacement among the worst (since it’s often hard to find matching chunks in the two parents)

41 JSSP: Job-Shop Scheduling Problem J Jobs to be performed on M machines. Each job consists of M operations, one for each of the machines. The operations must be done in the proper sequence => at time t, no more than one machine can be working on an operation for job j. Operations may require different amounts of time. NP-Hard Problem => Exponential time required both to find optimal solutions and to verify them. Search Space Size = (J!) M Choose appropriate job sequence for each machine. Common Solution Methods Branch & Bound techniques = exhaustive optimizing search with deterministic node pruning. Too expensive for large J & M (> 20) Heuristic search = priority rules resolve choices (of next ops to schedule). “Satisficing” that often finds optimal solutions, but no guarantee. More feasible approach to large JSSP problems.

42 JSSP Matrices Machine-Sequence & Processing-Time Matrix Machine (Processing Time) Job13(1)1(3)2(6)4(7)6(3)5(6) Job22(8)3(5)5(10)6(10)1(10)4(4) Job33(5)4(4)6(8)1(9)2(1)5(7) Job42(5)1(5)3(5)4(3)5(8)6(9) Job53(9)2(3)5(5)6(4)1(3)4(1) Job62(3)4(3)6(9)1(10)5(4)3(1) * 6x6 Benchmark from Muth & Thompson, “Industrial Scheduling” (1963) Job-Sequence Matrix Job M M M M M M

43 JSSP Matrices (2) Machine Sequence Matrix (Mseq) = sequences of operations (denoted by the # of the machine on which they must be performed) for each job Processing Time Matrix (Tseq) = durations for each operation of each job Job Sequence Matrix (Jseq) = sequences of job operations to be performed on each machine. Schedule = assignment of starting times (on the required machines) to all operations. Often drawn as a Gantt chart. M1: M2: M3: M4: M5: M6: *Total Time = 55 = minimum makespan

44 Schedule Classifications Complete: All job operations scheduled exactly once. Feasible: Complete + Satisfies Mseq and Tseq + Some ops may be started earlier without changing the machine’s order of operations ABCABC Semi-Active: Feasible + Some ops may be started earlier, but they’ll necessarily alter the operation order. Active: Semi-Active + Some ops may be started earlier, but they’ll necessarily delay other operations. ABC Machine X: Moving C delays B “Backward Filling”

45 Generating Schedules: Simple Approaches MT: Directly from an Mseq & Tseq (“Left-to-Right packing”) 1. Randomly pick a job, j, and select its leftmost unschedule operation, op. 2. Schedule it on its machine,m, for the earliest time point, t, where: a. All previously-scheduled operations on m have finished by t b. All previously-scheduled operations for j have finished by t. 3. Repeat until all job operations have been scheduled. Guaranteed semi-active schedule, but rarely optimal. MTBF : MT with backward filling => active schedules. MJT: From Mseg, Jseq &Tseq 1. Randomly pick any leftmost unscheduled operation, op, on any machine, m, in Jseq which is also the leftmost unscheduled operation for its job in Mseq. 2. Schedule op on m at earliest time t, where: {same as step 2 above} 3. Repeat until all job operations have been scheduled. * No guarantees of feasibility, since deadlocks may occur.

46 Scheduling Deadlocks Conflicts between Jseq and Mseq Job Sequences Machine1: Job5 Job4 Machine2: Job4 Job5 … Machine Sequences Job4:M1 M2 Job5:M2 M1 Deadlock: M1 wants Job5, but can’t have it until M2 has taken Job5 (according to Mseq). But M2 won’t do Job5 until it does Job4, and Job4 can’t be performed on M2 until it’s performed on M1 (according to Mseq). But Job4 can’t be performed on M1 until Job5 is performed on M1!

47 Giffler & Thompson Algorithm (1960) GT: Mseq & Tseq => Active Schedules 1. C = set of next schedulable operations for each job early-start-time = 0 for all ops in C 2. o* = earliest completed task in C T(C) = completion time of o* 3. G = conflict set= all ops in C on machine(o*) that overlap o* (including o*) 4. Randomly choose o+ from G & schedule it. 5. Add successor(o+) to C 6.Update early-start-time for all ops in C 7. If not empty(C) then goto 2 *Choice points: step 2: Ties for earliest completed operation step 4: Multiple conflicts All combos of choices => all active schedules. *Also used to convert complete schedules to active schedules

48 Genetic Algorithm Fitness Functions for JSSP Lin, Goodman & Punch (1997) w j = Weight for job j d j = Due date for job j C j = Completion time for job j r j = Release time for job j L j = Lateness of job j = C j - d j T j = Tardiness of job j = max(L j, 0) U j = penalty for job j { 1 if late, 0 otherwise} E j = Earliness of job j = max (-L j, 0) Maximum Tardiness Weighted Flow Time Weighted Tardiness Weighted LatenessWeighted # Tardy Jobs Weighted Earliness + Weighted Tardiness Makespan *Fitness functions are usually simple inverses of the above metrics

49 Genetic Algorithm Encoding Problems Assume that we want to represent job sequences directly in the GA chromosome Task Machine Machine :: : MachineM We could easily convert Jseq into a chromosome: … => …. But then both randomly-generated chromosomes and the results of crossover may represent illegal schedules: [ …. ] X [ …] (cross point = after 3rd entry) => [ ….] And [ …] Both children are illegal, since they a) advise doing same jobs twice on the same machine, and b) leave out certain jobs.

50 Nakano & Yamada (1991) Pairwise job priorities for all machines Local Harmonization Global Harmonization MJT Jseq Mseq Tseq Feasible Schedule Jseq* Deadlock GA Chromosome: Local Harmonization: Removes single-machine priority conflicts Crossover & Mutation: Standard bitwise Lamarckism: Changes to Jseq in Global Harmonization are back-coded into chromosome

51 Priority-Based Schedule Representation (1) A job-priority schedule establishes pairwise priorities of jobA over JobB on each of the M machines Job1 -vs- Job2 : Job1 -vs- Job3: ::: N(N-1)/2 pairs Job1 has priority over Job3 on Machine M(1,2) = 1 Job2 has priority over Job1 on Machine M(1,5) = 6 Combine all rows to create a GA chromosome of MN(N-1)/2 bits …….

52 Priority-Based Schedule Representation (2) Now, neither random schedule generation nor crossover creates illegal pairs of priority. I.e. you never get situations in which Job1 is prioritized over Job2 on machine 4 and Job2 over Job1 on machine 4. But, triples, quadruples, etc. may be inconsistent : On Machine 4: job1 > job2 & job2 > job3 & job3 > job1 This set of priorities makes it impossible to establish a unique priority order for machine 4. Hence, we cannot generate a machine schedule (I.e. job sequence) for machine 4.

53 Process for converting illegal genotypes (schedules) into legal job sequences. 1. Convert sequence of pairwise priorities into priority tables for each machine. 2. Establish a strict priority order for each table based on the original priorities JobsSum Job1* Job21*00113 Job311*1104 Job4010*001 Job50001*12 Job610110*3 Job3 is most dominant, so make it dominant EVERY job. This entails changing entry (6,3) to 0 and (3,6) to 1. This reduces job6’s sum to 2. Hence, job2 is now the only one with sum = 3, so it’s the 2nd most dominant. Change the table so that job2 dominates every job but #3…and so on.until a strict priority order is achieved. Do the same for each machine’s priority table. Local Harmonization

54 Local harmonization creates a job sequence for each machine. Global harmonization is used to remove deadlocks. Job Sequences Machine1: Job2 Job6 Job1 Job4*...Blue => already scheduled Machine2: Job1 Job 3 Job6 Job5* … Machine Sequences Job4:M1M2 Job5:M2M1 Deadlock: Job4 wants to run on M1, but J1 is next on M1. Similarly, J5 wants to run on M2, but J3 and J6 are ahead of it. Assume all other jobs are either finished or deadlocked with even longer waits. Global Harmonization Swap Jseq jobs to accomodate J4, since it’s closest to being run. Machine1: Job2 Job6 Job4* Job1 Forcing (Lamarckism): Change gtype so that J4 has priority over J1 on M1 Global Harmonization

55 Shi (1997) List of MxJ Job choices for MTBF (Job1 Job3 Job5 Job1 Job3 Job2…) GA Chromosome: MTBF Mseq Tseq Active Schedule Lamarckism: When MTBF uses backward filling, it changes job order in the chromosome Job Partition Crossover - Unique subsets of the J jobs taken from each parent. Necessary since kids must have M copies of all J jobs. Mutation: Job swaps or moves within chromosome “Schedule next task of Job 3”

56 Job-Partitioned Crossover (Shi, 1997) Select non-overlapping subsets S1, S2 of {1,2…J} = S, such that S1 U S2 = S Choose all and only S1 (S2) genes from parent 1 (2) and place in child J4 J2 J1 J1 J3 J4... J3 J2 J2 J1 J4 J4... S1 = {1, 3}S2 = {2, 4} J2 J1 J2 J1 J3 J4 J4... Kid Parent 2 Parent 1 * Kid chromosome is guaranteed to have M copies of all J jobs, when parents do

57 Kobayashi, Ono & Yamamura (1995) Job Sequence Matrix (Jseq) GA Chromosome: Subsequence Exchange Crossover (SXX): Only Jseq segments with same jobs exchanged between parents => kid schedules are complete MJT Mseq Tseq Active Schedule No harmonization needed, since: a) init Jseq pop gen’d by GT b) All kids run through GT Parent Jseq SXX Kid Jseq GT Active Schedule

58 Subsequence Exchange Crossover (SXX) Swap similar (but permuted) subsets of parent job sequences GT applied to kid Jseqs may result in job swaps within rows J2 J3 J5 J1 J4 J6 J4 J1 J2 J3 J6 J5 J3 J2 J1 J6 J5 J4 : : J1 J4 J5 J6 J3 J2 J5 J6 J3 J4 J2 J1 J1 J3 J5 J2 J4 J6 : : SXX Parent Jseq 2 Parent Jseq 1 J2 J3 J1 J4 J5 J6 J4 J2 J1 J3 J5 J6 J3 J2 J1 J6 J5 J4 : : J5 J1 J4 J6 J3 J2 J6 J5 J3 J4 J1 J2 J1 J3 J5 J2 J4 J6 : : Kid Jseq 1 Kid Jseq 2 To GT

59 Lin, Goodman & Punch (1997) Time Horizon Exchange Crossover (THX): Prior to scheduling time T*, 1st parent’s scheduled ops are used to resolve conflicts. After T*, use 2nd parent. Active Schedule GA Chromosome: GT Step 4: Select o+ Parent Schedule 1 Parent Schedule 2 Active Kid Schedule T < T* ? Yes No O+ * Yamada & Nakano (1992) use similar method (GA + GT) but choose parent schedule randomly for each conflict resolution (i.e. O+ selection)

60 Fang, Ross & Corne (1993) List of MxJ Job choices for MTBF ( …) GA Chromosome: MTBF Mseq Tseq Active Schedule Gene Variance Based Operator Targeting (GVOT) - choose crossover and mutation points based on population variances of genes. GVOT biases: X-over pt (high variance genes); Mutation (low variance genes) Standard Bitwise Crossover - Possible due to indirect representation “Schedule next task of 5th unfinished job in the circular job list”

61 Indirect JSSP Representation (Fang, Ross & Corne, 1993) Genotype for an J (# jobs) x M (# machines) JSSP: JM chunks, where each chunk has log2(J) bits …. “Take the next operation for the 2nd uncompleted job (so this isn’t necessarily job 2) and put it into the earliest place that it will fit in the currently developing schedule.” Indirect representation since the genes don’t refer to absolute jobs 2232… -vs Assuming each job has more than 3 tasks, then these are interpreted as “Schedule 3rd task of job 2” -vs- “Schedule the 1st task of job 2” The same position (4) has the same value (2), but it has a different meaning in the two genomes. Context sensitivity, epistasis: genes interact in determining phenotypes

62 JSSP Benchmark Comparison *All results are makespans from the best runs (red values are optimal) GA with specialized crossover approaches Branch & Bound optimality (with much less searching) Indirect representations (Fang et. Al.) perform well, but slightly worse than most other direct representations

63 GA Search Efficiency Search Space Size = (J!) M = 3.96 x for the 10 x 10 JSSP Can be larger depending upon the GA representation Typical GA’s above evaluate around 150,000 individuals E.g. Population size = 1000; # Generations = x 10 5 / 3.96 x = 3.79 x = fraction of search space that we need to explore to find a good solution when using GA’s. Branch & Bound techniques explore a significantly larger portion of the search space.

64 Search Spaces Representation Space (Syntax)Solution Space (Semantics) Completeness: Every point in SS is covered by a point in RS Soundness: Every point in RS maps to a point in SS => Anything generated during RS search is a valid solution Uniqueness: No 2 points in RS map to the same point in SS. Translational Determinism: No point in RS maps to more than 1 point in SS => The translation of a representation gives the same solution every time Heritability: Children solutions resemble their parents

65 Reps wherein genes encode absolute values such that the same spot on the genome encodes the same information, regardless of the values of other genes. If Position P = A in both chromosomes C1 and C2, then, when converted into phenotypes, C1 and C2 will derive the same characteristic from position P. + Phenotypes can be independently read off the genome + Genes that converge to particular alleles can only be changed via mutation - When the genome encodes a sequence of unique values, then crossover can create genomes with illegal interpretations (as phenotypes). Hence, an extra, often time-consuming, step is required to convert the genotypes to legal varieties, e.g. harmonization. Direct Representations

66 Reps wherein genes encode relative values such that the absolute values of genes are dependent upon the values of other (e.g. Earlier) genes. + All genotypes represent legal phenotypes. + Easier to manipulate. Can perform syntactic operations (mutation,crossover, etc.) without paying attention to the semantics => crossover is cheap! - High epistatis (gene interactions) makes GA-based search more difficult. It works against the Building Block Hypothesis. - False Competition: Two different gtypes may rep the same (or similar) ptypes, which will compete with one another for repro success, thus reducing the gain of each. - Low Inheritance via Crossover Two different genotypes produce similar phenotypes, but crossover produces children with vastly different phenotypes from the parents x (cross after 3rd gene) “Do 4th task of 1, then 4th task of 2” x “Do 7th task of 1, then 1st task of 2” -vs- “Do 1st task of 1, then 7th task of 2” Indirect Representations

67 Summary When search spaces become too large for exhaustive (Branch & Bound) or too complex for heuristic techniques, GA’s can help. GA cannot guarantee optimality, but good solutions normally found, and search is very efficient. Choice of fitness function is straightforward for most GA scheduling applications Choice of representation is more difficult. –One of reps presented above might be useful, but –For special problems, a new rep may be needed –If it’s a direct representation, then special mutation & crossover ops also needed


Download ppt "Applications of Genetic Algorithms to Resource- Constrained Scheduling Tasks Keith Downing Dept. of Computer and Information Sciences The Norwegian University."

Similar presentations


Ads by Google