honors project: a comparison of elite vs. regular ants...

32
Honors Project: A Comparison of Elite vs. Regular Ants Using the JSP Joshua Luchies Student # 100287530 Supervising Professor: Tony White Date: March 28, 2004 Course: COMP 4905

Upload: others

Post on 19-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Honors Project:

A Comparison of Elite vs. Regular AntsUsing the JSP

Joshua Luchies Student # 100287530

Supervising Professor: Tony WhiteDate: March 28, 2004Course: COMP 4905

Page 2: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Table of Contents

Abstract page 3

Introduction page 4 - 5

Problem Description page 6 - 7

Solution and Methods page 8 – 14

Results page 15 – 23

Conclusions page 24

Discussion page 25 – 26

Appendices page 27 – 32

acknowledgments:Thanking Dr. Tony White for supervising me on this Honors Project. All of the

researchers which contributed indirectly to this research project through papers and texts.

Joshua Luchies 2 03/28/04

Page 3: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Abstract

This paper discusses the subject of Swarm Intelligence and its applications to the

Job Shop Scheduling Problem. Specifically it deals with the idea of a memory in trying

to determine the shortest schedule for a set of jobs. This is modeled using an Ant Colony

algorithm. Ant Colony algorithms are inspired by the ability of ants to follow a short path

to a food source without using anything but local information. The research conducted

here is involving an optimization method with elitist ants. Elitist ants are basically ants

which can remember the best solution they have thus far encountered in their exploration.

This research is very useful in many applications in which scheduling is important as well

as for managers. The scope of the research performed here is to determine whether

memory enhances the quality and speed of the solutions reached, or hinders these two

parameters. This will be accomplished by constructing a simulation of the Scheduling

Problem, and running a population of regular or no-memory ants, and a population of

elitist or memory ants through it.

From the results I have seen in my implementation of this problem and the

simulation, I have concluded that elitist ants do better overall in a shorter period of time.

This is in accordance with the literature I was directed to on the TSP implementation

using elitist ants by Tony White [1].

Joshua Luchies 3 03/28/04

Page 4: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Introduction

Swarm Intelligence is usually based upon something I call “natural algorithms”,

these are algorithms modeled after phenomena seen in nature. Swarm Intelligence, more

specifically deals with individuals which look as if they are acting in concert to

accomplish some semi-complicated task, using only local information, and having very

little communication with others in the community. Some examples are a flock of birds

in flight, a school of fish, army ants harvesting food, termites building their homes. In

each of these examples the organism uses simple rules, and only local information to get

a task accomplished, and all work independently of one another. Some examples of the

rules would be to follow the leader, or follow a chemical trail, etc. The effect of the

population following these simple rules results in emergent behavior when the population

is seen as a single entity accomplishing a task. Each individual, can not do much, but as a

whole the goal is accomplished to the benefit of all. This emergent behavior, when

applied to computer science problems results in the solutions constructed by a population

of agents working independently, with local information.

The Job Shop Scheduling Problem is usually modeled after a factory with many

optimized machines. These machines only perform one task, but do it very quickly and

efficiently. The manager is given a list of jobs, each with many operations to be

completed on certain machines. This implies that each job has a specific path around the

factory floor, visiting the machines in a specified order. The problem for the manager is

to devise a schedule so that all of the jobs are completed in the shortest amount of time.

The Ant Colony algorithm is modeled after an ant called Linepithema Humile,

Joshua Luchies 4 03/28/04

Page 5: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

found in Argentina, which exhibits the ability to find short paths to food using

pheromones to mark the way. This is accomplished when many ants are traversing the

path, a longer path receives less pheromones in the same amount of time that the shorter

path does, even if the same number of ants always traverses each path equally. So an

algorithm based on this behavior is applicable to finding short paths to solve problems

such as the Traveling Salesman Problem and the Job Shop Scheduling Problem. Some

ants also have the ability to remember the path they have taken before, and one example

is the Lasius Niger, which will turn around if it finds it is going for a long time in a non-

helpful direction. This is where the inspiration for elitist ants comes from. They are able

to remember the direction of the food, and tell if they are taking too long to get back to it.

The elitist ants that will be used in these experiments can remember the path they have

taken before. This amounts to a behavior such as the following; the ants leaving the ant

hill travel randomly in search of food, and each time they come back, they leave a

pheromone trail. If they take longer to get to the food than before, they will leave their

pheromone on the trail they took previously on the way back to the ant hill. If they

discovered a shorter path on the way out, they will follow the shorter path back, leaving

their pheromone on that one instead.

Joshua Luchies 5 03/28/04

Page 6: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Problem Description

Job Shop Problem

The general shop problem can be defined as follows. There are n jobs i=1,...,n

and k machines M1,...,Mk. Each job i consists of a set of operations Oij (j=1,...,ni) with

processing times pij. The processing times are deterministic and known in advance. Each

operation has to be processed on a dedicated machine mij ε {M1,...,Mk} for an

uninterrupted processing period. There may be precedence relations between the

operations of all jobs. Each job can only be processed only by one machine at a time and

each machine can only process one job at a time. The objective is to find a feasible

schedule that minimizes some objective function of the finishing times Ci of the jobs

i=1,...,n. The objective functions are assumed to be regular.

The job shop problem is a special case of the general shop in which

each job i consists of m operations Oij with processing times pij (j=1,...,m) where

Oij has to be processed on machine Mij, and

the operations have to be scheduled in predetermined given order. Each job has its

own individual flow pattern through the machines which is independent of the

other jobs.

The problem is to find a feasible schedule, i.e. to determine starting times for each

operation, in order to minimize the objective function while satisfying all precedence and

capacity constraints[3].

Joshua Luchies 6 03/28/04

Page 7: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

The objective of this research is to determine whether the Ant Colony

Optimization algorithms can be improved for the purpose of solving this problem. It has

already been observed that the method of improvement explored in this research is

practical for the TSP problem. The question is whether this can be extended to other

problems of the same type, shortest path optimization. The area of exploration is whether

an ant that remembers the best schedule it has come across, will speed up and enhance the

new schedules, or whether remembering will deter it from exploring new areas and

possibly be able to come up with better schedules in the future.

For the purpose of this implementation, I am working strictly within the

guidelines of the Job Shop Problem, the list of jobs has a set of operations, each with a

processing time, and machine to be processed on. The Ant algorithm schedules each

operation in order, and takes into account the fact that different machines cannot work on

the same job at the same time, but may work on different jobs, provided all operations

before the one currently being processed are finished.

Joshua Luchies 7 03/28/04

Page 8: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Solutions and Methods

The solution presented here to the overall problem of the benefits of having an ant

with memory as over against an ant without, is to run two populations of ants through the

same problem instance, and compare them. The first population will be of regular ants

without memory, and the second will be solely of elitist ants with memory. In this

research the mixing of the populations is not explored, but that could be done fairly

easily, and is an option for further exploration.

The solution for the problem of representing the Job Shop instance is as follows.

A graph representation, as outlined in a text on swarm intelligence [3] was used. The

graph is an almost complete graph of the operations organized like so: each job is a row,

and connected by directed edges from operations (1 ... n). Each operation is then

connected to all operations of all other jobs. Finally, there is one extra node, at the start,

to signify the start position for the schedule (see Appendix B for a diagram). In my

implementation for the simulation, I represented the graph vertices as a list of operations,

and the edges were in an adjacency matrix format. The matrix stored the amount of

pheromone on the directed edge from operationi to operationj. Each of the vertices in the

graph contains a job operation, with the machine number and time needed to complete the

job. I used the matrix representation because it provides instant access to the pheromone

count on the edges needed for the selection of a new operation and updating of the

schedules is much faster. Also there is not much wasted memory usage because the graph

is nearly complete as well, so nearly all of the spaces are filled. This greatly increases the

speed of my program compared to using an adjacency list representation of the graph.

These two attributes, the pheromone on the edges, and the operation times are necessary

Joshua Luchies 8 03/28/04

Page 9: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

for determining the heuristic probability for the Ant Colony algorithm. Much of the

literature that I had access to did not mention the representation used in practice of the

graphs, and other data structures necessary to make the programmed simulations run

smoothly and efficiently. The simulation which I have constructed for this research can

solve a fairly decent complexity of problems in a good time, but I am sure there is much

room for improvement in both the speed and accuracy of its evaluation.

The algorithm used to solve the problem is the classical Ant Colony Optimization

algorithm, with a few modifications to make it applicable to the Job Shop Problem.

There is a selection equation which provides the probability that a certain operation will

be selected out of all available or legal operations, as outlined in the job shop problem

description.

This is the algorithm I used to select the next operation to schedule. It produces a

probability of choosing operationj when you are currently processing operationi:

Σ [pheromone(operationi, allowed operation1...n)alpha * time(allowed operation1...n)beta]] / (pheromone(operationi, operationj)alpha * time(operationj)beta)

This equation favors the shorter operations first, and then the longer ones. There are

benefits and detriments to using either a longest job first, or shortest job first algorithm, I

didn't see a great difference between the two different algorithms in this simulation for

the problems I encountered, but that may be just because the problems had a spread of

quick and long operations, or my fitness function. The fitness function would actually

have much to do with this as it relies on scheduling groups of jobs at once. This would

hide small jobs if one long one had to be scheduled at the same time. Conceptually with

the Job Shop Problem, I don't think it matters whether you use a shortest job first, or

Joshua Luchies 9 03/28/04

Page 10: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

longest job first algorithm, but I also learned in my Operating Systems design class that

shortest job first algorithms generally give better results. The probability is inverted to

give precedence to the better choices for operations to complete.

The other important equation for the Ant Colony Optimization algorithm is the

pheromone dropping equation which adds to the amount of pheromone on the edges.

Pheromone dropping equation: local best tour length / current ant tour length;

This algorithm is adapted from the usual algorithm found in much of the literature which

uses a constant instead of the local best tour length. The constant is supposed to be near

to the optimal solution to work well. Using the local best tour length provided a way to

keep in step with the spirit of the algorithm in that we only want to work with local

information, and this provides a workable way of doing so. This method also avoids the

tedious work of estimating schedule length for each problem. Although this can be done

using a greedy algorithm, then you may suffer from having the value too large to achieve

the optimal tour length.

Joshua Luchies 10 03/28/04

Page 11: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Here is the pseudocode for the algorithm which was implemented for the tests:

Initialize a graph of the jobs and operations;Initialize an ant population; (the ant populations were either regular ants, or elite)

for each tour of the graph do:for each ant in the population do:

place all ants on the start operation;while all operations are not in the schedule do:

rate all the available operations;randomly select an operation according to the rating given;add it to the schedule;update the available operations;

end while;end for;

for each ant do:calculate the length of their tour;if the ant is elite

update the length of the schedule if it is better than its previoussolution as well as its best schedule found;

elseupdate the length of the schedule;

end for;

for each edge in the graph do:for each ant in the population do:

for each edge in the schedule do:drop pheromones as per the pheromone dropping equation;

end for;end for;decay the pheromone as per the pheromone decay rate;

end for;

keep track of any statistics or information you need here;(some examples are local and global best tours, averages, standard deviations)

end for;

The elitist ants have the ability to store the best tour they have formulated so far. This

gives them the ability to change its tour only if it is better than the best one they have

made. So after the length of the schedule is calculated, the best schedule that the ant has

Joshua Luchies 11 03/28/04

Page 12: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

made is then set as the schedule to update the edges in the graph with pheromone. This is

how the effect of the memory is being modeled. It is an accurate model in that it depicts

the aspect that if the ant would have known the inferior schedule to be that way, then it

would have chosen the other. It is like the path to the food, if it took the ant longer to get

to the food, than it took to get back to the nest the previous time, then the ant will take the

previous path to get back, knowing it to be quicker than the path it took to get from the

nest to the food (in this analogy, the ants only release pheromone on the way back to the

nest). The way I implemented this in code is by providing a subclass which had the

added ability to store an extra tour representing the best one seen.

Another important part of the algorithm is the fitness evaluation used to rate the

schedules. I used my own version of a worst time to completion algorithm. This seemed

appropriate and sufficient for my purposes. The algorithm specifics are shown here in

pseudocode:

while there are operations left in the schedule doget the next operation;if the operation time is greater than the max time for this set of operations,

set the max as this operation's time;if the machine is unused and the job is not being processed on another

machine, store the machine and job number,

if either the machine is being used, or the job is currently being processed, add the maximum operation time to the fitness;reset the stored machine and job numbers;

end while;

This results in a worst completion time algorithm for the jobs because it relies on

scheduling sets of jobs, and using the maximum time to completion for each set

scheduled. This is good enough for my research as I was not looking to have exact

Joshua Luchies 12 03/28/04

Page 13: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

schedules, just to compare two different types of populations, and working with the same

fitness function is all that is really necessary for this purpose.

The constants and optimal parameters used in the experiments conducted with this

algorithm are the results of previous research done by Tony White [1]. The constants

alpha, set at 1, and beta set at 2 were observed to lead to the finding of good solutions

consistently to the Traveling Salesman Problem, and were also able to be generalized to

other shortest path problems such as JSP and QAP by research done by Dorigo [4]. He

has a set of “optimal” values for these constants. I found that the values I used provided

good enough solutions, and refining those constants aren't at the core of this investigation.

That is the reason for those constants being set at those values. I did attempt a range of

values to try and improve my results, but they all were approximately the same. That

could be an area for further exploration to improve this simulation.

The reasoning behind the size of the population of ants being set at 15 was to

accommodate for the random job selection, I wanted to have a good probability of

exploring all combinations of the solution. Having more ants than jobs almost guarantees

that each job will have an ant which starts on it. In this way, the algorithm is capable of

exploring all possibilities, as it depends on the operations which have been completed as

well as the available ones in the selection algorithm. Also it was not observed to be

helpful to have more ants because they just reinforce redundantly and will saturate the

paths through the graph with extra pheromone.

The number of iterations was initially taken from some previous research of the

professor in charge, but changed when it was observed that after several iterations the

values of the schedule lengths varied very little, and didn't seem to change. After about

Joshua Luchies 13 03/28/04

Page 14: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

200 iterations of the algorithm, the solutions arrived at were close to the optimal and

stagnation started to occur.

The pheromone decay rate was set at 0.85 so that there was some buildup, but not

enough to overwhelm the other parameters. This value signifies that at each iteration,

85% of the pheromone was left on the path, and 15% was evaporated off. This aspect of

the research also was not fully explored, but only lightly experimented with until I could

achieve acceptable results.

There were three sets of experiments conducted. One was with the abz5 problem

(see appendix C). This is a 10x10 Job Shop Problem, one with 10 jobs and 10 machines.

Both populations of ants, the regular and the elite, were sent through the Job Shop 2000

times to create schedules. This was done a total of 30 times, and the results were

collected and put into charts. The purpose of this experiment was to determine whether

the number of iterations greatly increased the quality of the solutions of the problems.

This is to determine the long-term behavior of the ant algorithm being tested. This was

the first part of the problem area explored. The second set of experiments again used the

abz5 problem. It, however explored the problem of whether the elite ants produced better

solutions more quickly than the regular ants. The populations of ants, one regular and

one elite were sent through the Job Shop 500 times. This was repeated 30 times to

produce an accurate picture of how well each population performed. The third set, used a

different problem, the orb07 problem (see appendix D). This problem has the same

format and setup as the abz5 problem and the purpose of this is to see whether the values

in the problem affected the speed and quality of the solutions. This experiment was

conducted with the same parameters and algorithms as the second experiment.

Joshua Luchies 14 03/28/04

Page 15: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Results

Experiment One Results

Experiment one was to determine the length of time needed for the ants to

generate the best schedules they were able. In some of the literature, for these small type

of problems, many of the researchers felt that 2000 iterations was generally sufficient for

many algorithms to converge to the optimal solutions. If the algorithm in question was

not even near to the found optimal, within 2000 iterations, then it wasn't a very good

algorithm in the first place. That is the reason I decided to force the 2000 iterations. One

other reason was that I was curious about whether my algorithm would converge on a

single solution, or tend to maintain diversity over a long period of time. The results were

that the elite ants performed much better over all. The graphs presented here clearly show

this emergent behavior. Looking at the global bests of each population over the 30 trials

shows that the elite ants produced much better solutions overall. The quality of the

solutions is the only practical conclusion you can make from looking at this graph, the

significance here is not really debatable, the optimal solution, when run through my

fitness function of the schedules, comes to 1603. All of the elite ants trials did better than

this, but the regular ants didn't get within 200 of this solution. The elite ants hovered

around the 1400 mark, and the regular ants jumped around the 1800 - 2000 level. I felt

that these results were acceptable in comparison to the optimal solution to proceed with

the other experiments.

Joshua Luchies 15 03/28/04

Page 16: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

I performed a t test on the global sets, and came up with a score of 68.95. This I believe

is high enough to show that the two sets of data are significantly different (the degrees of

freedom are 58).

By examining the local best schedules, I can draw some conclusions about the

behavior of how the ants formulate their solutions, and the time needed for them to

achieve acceptable schedules.

Joshua Luchies 16 03/28/04

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

0

200

400

600

800

1000

1200

1400

1600

1800

2000

Global Bests for 2000 iterations

Regular AntsElite Ants

126

5278

104

130

156

182

208

234

260

286

312

338

364

390

416

442

468

494

520

546

572

598

624

650

676

702

728

754

780

806

832

858

884

910

936

962

988

101

104

106

109

111

114

117

119

122

124

127

130

132

135

137

140

143

145

148

150

153

156

158

161

163

166

169

171

174

176

179

182

184

187

189

192

195

197

0

250

500

750

1000

1250

1500

1750

2000

2250

2500

2750

regular ants local bests12345678910111213141516171819

2021222324252627282930

Page 17: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

These two graphs show that the regular ants have a hard time improving their schedules,

and after many iterations the elite ants start to stagnate.

This is shown better however in the standard deviations. The deviation of the regular ants

stays very high, around 100 to 150, while the elite ants drop their deviation to about 50 by

500 iterations.

Joshua Luchies 17 03/28/04

126

5278

104

130

156

182

208

234

260

286

312

338

364

390

416

442

468

494

520

546

572

598

624

650

676

702

728

754

780

806

832

858

884

910

936

962

988

101

104

106

109

111

114

117

119

122

124

127

130

132

135

137

140

143

145

148

150

153

156

158

161

163

166

169

171

174

176

179

182

184

187

189

192

195

197

0

200

400

600

800

1000

1200

1400

1600

1800

2000

elite ants local bests12345678910111213141516171819

2021222324252627282930

128

56

84

112

140

168

196

224

252

280

308

336

364

392

420

448

476

504

532

560

588

616

644

672

700

728

756

784

812

840

868

896

924

952

980

100

103

106

109

112

114

117

120

123

126

128

131

134

137

140

142

145

148

151

154

156

159

162

165

168

170

173

176

179

182

184

187

190

193

196

198

0

25

50

75

100

125

150

175

200

225

Elite Ants Standard Deviation12345678910111213141516171819

2021222324252627282930

iteration

devi

atio

n

128

56

84

112

140

168

196

224

252

280

308

336

364

392

420

448

476

504

532

560

588

616

644

672

700

728

756

784

812

840

868

896

924

952

980

1008

1036

1064

1092

1120

1148

1176

1204

1232

1260

1288

1316

1344

1372

1400

1428

1456

1484

1512

1540

1568

1596

1624

1652

1680

1708

1736

1764

1792

1820

1848

1876

1904

1932

1960

1988

0255075

100125150175200225250275300

Regular Ants Standard Deviations12345678910111213141516171819

2021222324252627282930

Iteration

devi

atio

n

Page 18: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

This behavior makes sense when you think about how each of the populations is

progressing through the shop. The elite ants always keep in mind their best schedule,

while the regular ants only follow the pheromones. The populations of regular ants are

always updating their own scheduled path, while the elite ants update the best scheduled

path they have seen so far. The elite ants therefore, are piling pheromones on the best

schedules, whereas the regular ants put down pheromones more equally on all the paths

explored. This more equal pheromone deposition seems to keep the paths equally good,

so diversity is maintained equally throughout the iterations. I don't see this as a good

sign, the algorithm should converge on a single solution, not keep roughly the same

number of solutions around. The elite ants are better at converging on the good solutions

but suffer from stagnation when certain paths become established, so they are unable to

follow new paths after a while.

The behavior exhibited as the results of this experiment are validated in the results

shown in the following experiments. I used only 500 iterations because after that the

gains from either population were very minimal, they either did not improve, or improved

very little. This is, I hypothesize because the ants begin to follow the same paths all the

time. The pheromone and time considerations re enforcing each other along good paths,

and the ants choose these paths consistently. I conducted t tests on the data of experiment

one, with the 2000 iterations and the data of experiment 2 with the 500 iterations. The

sets I used were the same type of ants, so the t tests were to show that the values belong to

the same set. The scores received were 4.98 for the regular ants, and 4.69 for the elite

ants. Each test had 58 degrees of freedom. These scores show that the data could have

come from the same samples, and so I could get away with only doing 500 generations,

Joshua Luchies 18 03/28/04

Page 19: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

instead of a whopping 2000.

Experiment two was executed to verify my results from observations on the

behavior of experiment one. The objective was to determine if the elite ants performed

better than the regular ants, and they do. This graph shows that over the 30 runs, the ants,

for the main part performed fairly constantly, there is only one major dip, where the

regular ants got lucky and stumbled on a good solution, but still not comparable to the

solutions found be the elitist ants. The smoothness of this graph indicates to me that the

algorithm is driven with some purpose in mind as well, and isn't just evaluating random

solutions.

If we consider the local behavior of the ants over these 30 trials, we can more clearly see

that the elite ants are searching through a smaller space and are therefore able to come to

better solutions more often and after a shorter time.

Joshua Luchies 19 03/28/04

1 2 3 4 5 6 7 8 9 10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

0

250

500

750

1000

1250

1500

1750

2000

2250

Abz5 Global Bests

Regular AntsElite Ants

Trial

Sche

dule

Len

gth

Page 20: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

In comparing these two graphs, it is evident that the elite ants have a more focused

search, resulting in their ability to find better paths more often. The regular ants have a

harder time because they update all the paths they take, not just the best one they have

ever taken. My results for the best solution have apparently improved on the optimal

found for this problem, when I ran their solution through my algorithm, it came up with a

value of 1603, and my best solution for this problem came to 1413. The regular ants had

a best solution of 1788, which is within about 15% of the optimal. This is a good

indication that using the elite ants does improve the quality, speed and directness of the

Ant Colony algorithm.

Experiment three was performed with another instance of the problem. This was

done to determine if the values for the operations had any bearing on the performance of

the algorithm, and either population of ants. This proved to be untrue, the populations

exhibited the same trends as in the previous experiments, and the graphs look very

similar. This graph of the global best solutions is fairly smooth and indicates constant

Joshua Luchies 20 03/28/04

1815

22

29

36

43

50

57

64

71

78

85

92

99

106

113

120

127

134

141

148

155

162

169

176

183

190

197

204

211

218

225

232

239

246

253

260

267

274

281

288

295

302

309

316

323

330

337

344

351

358

365

372

379

386

393

400

407

414

421

428

435

442

449

456

463

470

477

484

491

498

0250500750

10001250150017502000225025002750

Regular Ants Local Bests for abz5 12345678910111213141516171819

2021222324252627282930

Iteration

Sche

dule

Len

gth

1815

22

29

36

43

50

57

64

71

7885

92

99

106

113

120

127

134

141

148

155

162

169

176

183

190

197

204

211

218

225

232

239

246

253

260

267

274

281

288

295

302

309

316

323

330

337

344

351

358

365

372

379

386

393

400

407

414

421

428

435

442

449

456

463

470

477

484

491

498

0

200

400

600

800

1000

1200

1400

1600

1800

2000

Elite Ants Local Bests for abz512345678910111213141516171819

2021222324252627282930

Iteration

Sche

dule

Len

gth

Page 21: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

behavior throughout the trials of the simulation.

The fact that it has the same shape as the others of the global bests substantiates the claim

that the actual values of the operation times does not matter in the solving of this

algorithm.

Joshua Luchies 21 03/28/04

1815

22

29

36

43

50

57

64

71

78

85

92

99

106

113

120

127

134

141

148

155

162

169

176

183

190

197

204

211

218

225

232

239

246

253

260

267

274

281

288

295

302

309

316

323

330

337

344

351

358

365

372

379

386

393

400

407

414

421

428

435

442

449

456

463

470

477

484

491

498

0100200300400500600700800900

10001100

Regular Ants Local Bests for orb0712345678910111213141516171819

2021222324252627282930

Iteration

Sche

dule

Len

gth

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 300

100

200

300

400

500

600

700

800

900

Orb07 Global Bests

Regular AntsElite Ants

Page 22: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Once again, even though the values are different, the important thing to notice is that the

shape of the charts is not radically different. This is to be anticipated as the same

algorithm should not behave differently on two different sets of information representing

the same type of problem. I have compared my solutions to those provided, and it seems

as if I have improved on the best ones they have given. The method I used for

comparison was to run their solutions through my fitness algorithm to determine the

length of the schedule, and could then take the best solution from my data and just use the

fitness of that solution to determine that mine was better. The solution given for the

orb07 problem came to 749 when put through my evaluation algorithm. My ants came up

with a best solution of 588. The average global best solution for the regular ants was

825.7, which is within 15% of the optimal solution that was previously found for this

problem. These solutions were generated within 500 iterations of the algorithm, so there

is probably most definitely room for improvement on these. As a disclaimer, I did not

check the solutions carefully, or sufficiently to prove that they are a better optimal than

the ones given as it was not my intent to try and best the people posting these problems,

Joshua Luchies 22 03/28/04

1815

22

29

36

43

50

57

64

71

78

85

92

99

106

113

120

127

134

141

148

155

162

169

176

183

190

197

204

211

218

225

232

239

246

253

260

267

274

281

288

295

302

309

316

323

330

337

344

351

358

365

372

379

386

393

400

407

414

421

428

435

442

449

456

463

470

477

484

491

498

050

100150200250300350400450500550600650700750

Elite Ants Local Bests for orb0712345678910111213141516171819

2021222324252627282930

Iteration

Sche

dule

Len

gth

Page 23: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

merely to evaluate my algorithm and attempt to achieve reasonable results for the purpose

of comparing the two types of ants. I did not bother to conduct t tests on this data as it

looks the same as that found in experiment two and I felt it unnecessary to do this step of

the analysis.

Joshua Luchies 23 03/28/04

Page 24: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Conclusions

The conclusions that I was able to arrive at concerning the use of elite ants to

solve the Job Shop Problem coincide with some research done previously with the TSP.

The ants are better when they remember the best path they have explored, and have

outperformed the regular ants with only very little effort for modification of the

algorithm. The time taken for the algorithm to run is also indistinguishable from when

you are using elite ants, or regular ants. Therefore I propose that the gains made in the

quality of the solutions far outweighs the efforts needed to implement this optimization of

the algorithm. The solutions found with these algorithms are also consistently better than

the solutions previously found, so this just reinforces the idea that Ant Colony algorithms

are very applicable for solving more and more shortest path problems. Furthermore, the

elite ants optimization is easy to implement and gives great gains to the direction of the

algorithm's search. I anticipate that if you used a mixed population of both elitist and

regular ants, there would be greater gains in that the elite ants update the better paths

more often, but the regular ants are able to deviate and enforce finding new solutions later

on in the problem. This would avoid the stagnation behavior of updating the same paths

all the time.

Joshua Luchies 24 03/28/04

Page 25: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Discussion

What can I say here that hasn't already been said. I have spewed out the details of

my implementation of the Problem instances. I used a matrix and list representation of

the graph, which is conceptually equivalent to the description of the graph in both

Dorigo's paper [4] and the book by Theraulaz et al [3]. I also used a very adapted version

of the classical Ant colony algorithm. In my selection algorithm, the summation is on

top, and the values for the next operation are on the bottom. This was necessary because

otherwise the probabilities were wrong, and favored the longer schedules when I used a

roulette wheel type random selection algorithm. I did try the algorithm at first with the

summation on the bottom, but that lead the regular ants to come up with a graph that

favored longer solutions to the problem. From this observed behavior I concluded that

my ants were confused about which operations to choose, and the behavior also

disappeared when I inverted the probability.

Stagnation behavior was much talked about in the texts and journals I read, and

also seemed to dominate the research I looked into. Many of the researchers seemed to

want the algorithms to keep going, and not converge upon one definite solution. I see this

as a problem because then you are trying to cause the algorithm to search in less

profitable areas by trying to extend the search in hopes of finding more optimal solutions.

This extends the time needed to get to the optimal, and potentially the program could run

forever without coming to any definite solution. The flip side to this problem is that if

the algorithm is too deterministic, the solutions generated are much worse because they

are arrived at too early in the run. A trade-off is needed and some small number of elite

Joshua Luchies 25 03/28/04

Page 26: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

ants in a population of regular ants is what I believe to be a good compromise in the

context of Ant Colony algorithms.

My fitness function was very innovative on my part, it is a worst time estimate

that I think is specific enough to differentiate between the viable schedules. It takes into

account the ability to schedule two different jobs on different machines simultaneously.

The main downfall is that it doesn't provide a very accurate estimation of the actual

length of the schedule. It has to wait for all currently scheduled jobs to finish before

scheduling the next set. This means that if there is only one long operation scheduled, the

machines are effectively idle until that operation is finished. Even so, my algorithms

came up with some very good solutions to the problems encountered. The regular ants

were fairly close to the optimal given, and the elite ants were way below.

On another note, I am not very satisfied with my simulation as a whole, the code

is very messy, and hard to understand. The algorithms taken from the texts that I read

aren't very clear and straightforward to put into code. The algorithm itself is confusing

and the matrix implementation, while being much faster than much else takes up lots of

memory and is very rigid in the type and amount of data it can hold. This is the first time

I have coded a simulation such as this, so I anticipate being able to improve greatly on

this implementation so it may be able to solve the larger job shop problems easily (the

order of 100x50 or something like that). Currently I have tried solving a 50x10 problem

and the computer could do it, but it took some time (half hour) for 1000 iterations. I may

even have some fun and code up a gui to show the ants making their rounds and

displaying the solutions as they generate them. However that is all in the future.

Joshua Luchies 26 03/28/04

Page 27: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Appendix A: References1. Tony White, Simon Kaegi, Terri Oda Revisiting Elitism in Ant Colony Search. In

proceedings of Genetic and Evolutionary Computation Conference (GECCO) 2003.

2. webpage: [ http://xyz.scc.uni-weimar.de/~henning3/overview.html ]

3. Eric Bonabeau, Marc Dorigo, Guy Theraulaz. (1999) Swarm Intelligence: from

Natural to Artificial Systems. Oxford University Press.

4. Marco Dorigo, Vittorio Maniezzo, Alberto Colorni. (1996) “The Ant System:

Optimization by a colony of cooperating agents”. Published in IEEE Transactions on

Systems, Man, and Cybernetics, Part–B, Vol.26, No.1, pp.1–13.

Joshua Luchies 27 03/28/04

Page 28: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Appendix B: Job Shop GraphFigure 1.

AS graph for a 3 jobs and 2 machines JSP. Connections with no arrows (in bold) are

intended to represent a pair of directed arcs.

Joshua Luchies 28 03/28/04

Page 29: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Appendix C: abz5 ProblemProblem Representation: 10 10 4 88 8 68 6 94 5 99 1 67 2 89 9 77 7 99 0 86 3 92 5 72 3 50 6 69 4 75 2 94 8 66 0 92 1 82 7 94 9 63 9 83 8 61 0 83 1 65 6 64 5 85 7 78 4 85 2 55 3 77 7 94 2 68 1 61 4 99 3 54 6 75 5 66 0 76 9 63 8 67 3 69 4 88 9 82 8 95 0 99 2 67 6 95 5 68 7 67 1 86 1 99 4 81 5 64 6 66 8 80 2 80 7 69 9 62 3 79 0 88 7 50 1 86 4 97 3 96 0 95 8 97 2 66 5 99 6 52 9 71 4 98 6 73 3 82 2 51 1 71 5 94 7 85 0 62 8 95 9 79 0 94 6 71 3 81 7 85 1 66 2 90 4 76 5 58 8 93 9 97 3 50 0 59 1 82 8 67 7 56 9 96 6 58 4 81 5 59 2 96

The format for the problem is the first line is the problem size, number of jobs andnumber of machines. The second and consecutive lines are one for each job, and consistof machines and times for each operation of that job. The machine number comes first,then the time needed for that operation.

Optimal Solution Given: 8 2 9 4 7 6 3 1 0 5 5 6 2 7 9 3 8 0 1 4 3 7 1 4 5 8 0 6 2 9 4 9 1 7 8 6 3 5 2 0 7 4 5 0 1 6 3 8 2 9 1 5 7 2 0 4 3 8 6 9 7 1 8 5 2 0 4 3 9 6 6 3 8 7 9 2 5 4 0 1 2 4 0 9 5 7 1 6 8 3 2 4 9 7 5 0 3 8 6 1

There is one line per machine, and the numbers are the jobs scheduled for that machine.The times and operations can be found by referencing the problem description.

Joshua Luchies 29 03/28/04

Page 30: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

My Best solution: J3 O0 J2 O0 J1 O0 J2 O1 J5 O0 J1 O1 J0 O0 J8 O0 J7 O0 J2 O2J3 O1 J1 O2 J6 O0 J3 O2 J3 O3 J7 O1 J3 O4 J1 O3 J2 O3 J9 O0J2 O4 J7 O2 J6 O1 J7 O3 J9 O1 J2 O5 J7 O4 J2 O6 J4 O0 J2 O7J0 O1 J2 O8 J1 O4 J9 O2 J6 O2 J8 O1 J2 O9 J4 O1 J5 O1 J8 O2J3 O5 J5 O2 J1 O5 J8 O3 J3 O6 J4 O2 J7 O5 J8 O4 J3 O7 J7 O6J0 O2 J9 O3 J1 O6 J7 O7 J3 O8 J6 O3 J1 O7 J5 O3 J9 O4 J3 O9J8 O5 J7 O8 J9 O5 J6 O4 J1 O8 J0 O3 J8 O6 J4 O3 J9 O6 J5 O4J0 O4 J1 O9 J5 O5 J7 O9 J4 O4 J0 O5 J5 O6 J6 O5 J8 O7 J5 O7J4 O5 J6 O6 J8 O8 J5 O8 J0 O6 J9 O7 J4 O6 J5 O9 J4 O7 J9 O8J6 O7 J4 O8 J8 O9 J6 O8 J0 O7 J6 O9 J0 O8 J0 O9 J4 O9 J9 O9

The format here is just a list of the jobs and operations in their scheduled order. To checkthe total completion times, reference them to the representation.

Joshua Luchies 30 03/28/04

Page 31: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Appendix D: orb07 Problem

Problem Representation: This is the same format as the abz5 problem. 10 10 0 32 1 14 2 15 3 37 4 18 5 43 6 19 7 27 8 28 9 31 0 8 3 12 4 49 8 24 9 52 6 19 7 23 5 19 2 17 1 32 0 25 7 19 3 27 2 45 6 21 4 15 1 13 5 16 8 43 9 19 0 24 1 18 3 41 8 29 5 14 2 17 4 23 7 15 6 18 9 23 0 27 6 29 1 39 3 21 5 15 2 15 9 25 7 26 8 44 4 20 4 17 0 15 6 51 8 17 2 46 3 16 9 33 7 25 5 30 1 25 4 15 3 31 0 25 9 12 2 13 1 51 8 19 7 21 6 12 5 26 4 8 6 29 9 25 3 15 8 17 2 22 7 32 5 20 0 11 1 28 2 41 6 10 8 32 7 5 4 21 9 59 3 26 1 10 5 16 0 29 2 20 9 7 5 44 8 22 6 33 3 25 7 29 4 12 1 14 0 0

Optimal Solution Given: This also is in the same format as the abz5 problem. 1 0 4 2 6 5 3 7 8 9 0 4 6 3 2 9 7 8 1 5 9 8 0 7 6 2 4 5 3 1 1 6 7 0 2 9 4 3 5 8 7 6 1 5 0 8 2 9 3 4 9 0 4 7 2 3 1 8 5 6 7 8 4 9 5 0 2 1 6 3 2 7 8 9 0 6 1 4 5 3 9 7 1 8 5 6 0 3 2 4 9 7 6 1 8 4 5 0 2 3

My Best Solution: J1 O0 J7 O0 J1 O1 J3 O0 J5 O0 J7 O1 J6 O0J3 O1 J9 O0 J2 O0 J9 O1 J8 O0 J4 O0 J9 O2J8 O1 J9 O3 J2 O1 J9 O4 J5 O1 J9 O5 J7 O2J9 O6 J7 O3 J4 O1 J7 O4 J0 O0 J9 O7 J0 O1J7 O5 J9 O8 J9 O9 J2 O2 J0 O2 J3 O2 J1 O2J1 O3 J1 O4 J6 O1 J4 O2 J7 O6 J2 O3 J7 O7J1 O5 J6 O2 J7 O8 J3 O3 J1 O6 J2 O4 J3 O4J7 O9 J8 O2 J3 O5 J8 O3 J6 O3 J1 O7 J6 O4J2 O5 J4 O3 J1 O8 J8 O4 J4 O4 J2 O6 J4 O5J3 O6 J2 O7 J1 O9 J2 O8 J0 O3 J2 O9 J0 O4J3 O7 J8 O5 J4 O6 J8 O6 J3 O8 J8 O7 J4 O7J6 O5 J8 O8 J3 O9 J6 O6 J5 O2 J6 O7 J5 O3J8 O9 J6 O8 J5 O4 J4 O8 J5 O5 J6 O9 J5 O6J4 O9 J5 O7 J0 O5 J5 O8 J0 O6 J0 O7 J0 O8J5 O9 J0 O9

The format here is just a consecutive list of the jobs and operations scheduled. To checkthe time for completion, reference them with the problem representation.

Joshua Luchies 31 03/28/04

Page 32: Honors Project: A Comparison of Elite vs. Regular Ants ...people.scs.carleton.ca/~arpwhite/documents/honours... · Honors Project: A Comparison of Elite vs. Regular Ants Using the

Appendix E: The Simulation

The simulation was written in Java, and can only be run from the console as of

yet. The command line is: java JobShop The problem files must be in the same format

as the ones in Appendices C and D. There are options for different population sizes and

configurations, you do not need to include both elite and regular ants. The “generations”

referred to is the number of times you wish the population to traverse the graph. There is

no criteria for prematurely halting the number of generations to complete, so each trial

will necessarily do all of the generations. You may specify the number of trials to

complete, this means that after each trial the populations as well as the problem instance

are reset to the original default values. There is no option for changing the alpha, beta,

pheromone decay rate as of yet. You may, if you wish, go into the code to change these.

There are variables called alpha and beta for those parameters, one instance each in the

code just under a comment for the selection algorithm. The pheromone decay rate is

specified in a function parameter, the function is called decayPheromone(double); You

must also provide an output file name when asked, or the program will come back with

an error message. The output file contains the trial number, generation numbers, and

local best fitness, standard deviation, and average schedule length for each generation,

also for each trial it outputs the best global solution in the format for my best solutions in

the appendices as well as its fitness.

Joshua Luchies 32 03/28/04