• No results found

Comparing MAX-MIN and Rank-based Ant Colony Optimization Algorithms for solving the University Course Timetabling Problem

N/A
N/A
Protected

Academic year: 2021

Share "Comparing MAX-MIN and Rank-based Ant Colony Optimization Algorithms for solving the University Course Timetabling Problem"

Copied!
30
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT COMPUTER ENGINEERING, FIRST CYCLE, 15 CREDITS

STOCKHOLM SWEDEN 2018,

Comparing MAX-MIN and Rank- based Ant Colony Optimization Algorithms for solving the

University Course Timetabling Problem

FELIX BROBERG EMELIE ERIKSSON

KTH ROYAL INSTITUTE OF TECHNOLOGY

(2)

Royal Institute of Technology DD142X

Comparing MAX-MIN and Rank-based Ant Colony Optimization Algorithms for solving the University Course

Timetabling Problem

Felix Broberg Emelie Eriksson

Supervisor: Jeanette H¨ allgren Kotaleski Examinor: ¨ Orjan Ekeberg

June 6, 2018

Abstract

The University Course Timetabling Problem (UCTP) is a scheduling prob- lem regarding courses, time slots and rooms, and is often accompanied by a set of feature requirements. As non-trivial instances of the UCTP are NP- hard, traditional computational methods are ineffective. A meta-heuristic alternative is the Ant Colony Optimization (ACO) algorithm, which has pre- viously been proven to successfully solve the UCTP. This paper investigates the relative effectiveness of the MAX-MIN ACO variation to the Rank-based ACO variation on UCTP problem sets of varying difficulty. They are also compared when using a local-search help function and a path attractiveness heuristic. This study shows that the ACO variations perform similarly well for all problem difficulties when utilizing the path attractiveness heuristic.

Utilizing both local search and the heuristic produces the best results across the difficulties and ACO variations. There is, however, a need for further in- vestigation into the parameters for both ACO variations to ensure the validity of the conclusion.

(3)

Kungliga Tekniska H¨ ogskolan DD142X

J¨ amf¨ orelse av MAX-MIN och Rank-baserat myrkolonisystem f¨ or att l¨ osa det universitetsbaserade

schemal¨ aggningsproblemet

Felix Broberg Emelie Eriksson

Handledare: Jeanette H¨ allgren Kotaleski Examinator: ¨ Orjan Ekeberg

6 juni 2018

Sammanfattning

Det universitetsbaserade schemal¨aggningsproblemet (UCTP) avser sche- mal¨aggning av kurser till rum och tider d¨ar h¨ansyn till en m¨angd funktionella krav ofta m˚aste tas. Traditionella ber¨akningsmetoder har visats vara ineffekti- va d˚a icke-triviala fall av problemet ¨ar NP-sv˚ara. Myrkolonisystemsalgoritmen (ACO) ¨ar ett meta-heuristiskt alternativ som framg˚angsrikt har anv¨ants f¨or att l¨osa UCTP. Denna rapport j¨amf¨or effektiviteten mellan MAX-MIN ACO- variationen och den Rank-baserade ACO-variationen i att hitta l¨osningar till UCTP. Variationerna j¨amf¨ors ocks˚a vid anv¨anding av “local search” och en v¨agvalsheuristik. Rapporten visar att ACO-variationerna presterar likv¨ardigt vid anv¨andande av v¨agvalsheuristiken. Anv¨andandet av b˚ade “local search”

och v¨agvalsheuristiken leder till b¨asta resultat f¨or samtliga sv˚arighetsgrader och ACO-variationer. Efterforskning kr¨avs ang˚aende parametrarna f¨or ACO- variationerna f¨or att s¨akerst¨alla giltigheten av slutsatserna.

(4)

Contents

1 Introduction 1

1.1 Purpose . . . 1

1.2 Problem statement . . . 1

1.3 Scope . . . 1

2 Background 2 2.1 University Course Timetabling Problem . . . 2

2.1.1 Hard constraints . . . 2

2.1.2 Soft constraints . . . 3

2.2 Ant Colony Optimization . . . 3

2.2.1 MAX-MIN Ant System . . . 4

2.2.2 Rank-based Ant System . . . 4

2.3 Construction Graph . . . 5

2.4 Previous studies . . . 5

3 Method 6 3.1 University Course Timetabling Problem . . . 6

3.2 Construction Graph . . . 7

3.3 Ant Colony Optimization variations . . . 8

3.3.1 Path attractiveness heuristic . . . 9

3.3.2 Local search . . . 10

3.3.3 ACO functions . . . 11

3.4 Environment . . . 11

4 Results 11 4.1 Easy difficulty problems . . . 12

4.2 Medium difficulty problems . . . 12

4.3 Hard difficulty problems . . . 13

4.4 Summary of results . . . 14

5 Discussion 15 5.1 Comparison between the ant systems . . . 15

5.2 Limitations . . . 16

5.2.1 Time limitations . . . 17

5.2.2 The parameter values . . . 17

5.3 Future research . . . 18

6 Conclusion 18

7 Bibliography 20

Appendices 22

(5)

A ACO related functions 22 A.1 Solution construction . . . 22 A.2 MAX-MIN ACO functions . . . 23 A.3 Rank-based ACO functions . . . 24

(6)

1 Introduction

Timetabling is a common problem in academia and industry. Finding feasible so- lutions in reasonable time using deterministic models have been proven difficult.

The University Course Timetabling Problem (UCTP) is an instance of the general timetabling problem which focuses on course scheduling constraints with respect to teachers, classrooms and students.

There are two different types of constraints for the UCTP: soft and hard. Soft constraints are desirable to fulfill but are not required. An example is the constraint that all students can attend all their classes. Hard constraints are required to be fulfilled for the schedule to be feasible. An example is that no two lectures should be scheduled in the same room at the same time.

Due to non-trivial instances of UCTP being NP-hard [11, p. 25–50], heuris- tic and meta-heuristic algorithms are reasonable strategies for producing working timetables. The resulting solutions are however not guaranteed to be optimal.

Ant colony optimization (ACO) is a meta-heuristic swarm-intelligence algorithm that is used to find solutions to discrete optimization problems, most often modeled as graph problems. While solutions are not guaranteed to be optimal, ACO algo- rithms have successfully been used to solve NP-hard problems, including the UCTP [5][6][7][9].

1.1 Purpose

The purpose of this paper is to compare the effectiveness of two common variations of the ant colony optimization algorithm in terms of finding solutions to the UCTP. As ACO algorithms have been used before to solve the UCTP, the focus of this paper is the comparison itself and the relative effectiveness of the different variations. Their effectiveness, when compared to other families of algorithms, will not be investigated.

The intention is to provide a study of the advantages and disadvantages of different approaches to ACO algorithms with the UCTP as the specific problem example.

This paper aims to provide some clarity regarding both the specifics of the different implementations as well as showcase their use cases.

1.2 Problem statement

Which variation of the ant colony optimization algorithm produces the best results for the university course timetabling problem in regards to minimizing the number of hard and soft constraint violations?

1.3 Scope

This paper will not investigate if ACO algorithms are able to solve UCTP since this has been done previously [6]. Instead, we are interested in how different variations

(7)

of ACO compare to each other in solving the UCTP. We intend to limit our com- parison to two different variations of ACO algorithms. We will also compare the effectiveness of the algorithms when using a local search help algorithm and/or a path attractiveness heuristic. This is done to see how well the variations are able to escape local minima and other sources of failure.

A solution is only considered feasible if all hard constraints are fulfilled. Solutions containing hard constraint violations will still be used in order to be able to compare the variations when applied to more difficult problem instances. The solutions will be compared based on the number of hard and soft constraint violations. The variations will run for the same amount of time for the same sets of problems. The algorithm-specific parameters will not be tuned for each variation because of time constraints.

The ACO variations to be compared are:

• MAX-MIN ant system

• Rank-based ant system

The MAX-MIN variation is chosen due to its previous success in solving the UCTP [6][7][9]. The Rank-based variation is chosen due to its success in solving other NP-hard problems and that it differs from the MAX-MIN variation in its pheromone placement [5].

2 Background

This section describes what the University Course Timetabling problem (UCTP) is, what ant colony optimization (ACO) algorithms are and how construction graphs are used to model problems. Results from previous studies are presented in the end.

2.1 University Course Timetabling Problem

The University Course Timetabling Problem is a scheduling problem involving teach- ers, students, classrooms and courses. It differs from other lecture scheduling prob- lems in that the students can choose what courses they want to attend. This option increases the complexity such that a feasible solution might not exist. The main ob- jective is to find a timetable where no hard constraints are violated. An additional attribute is to have soft constraints. Fulfillment of soft constraints results in a more optimal solution and is therefore promoted.

2.1.1 Hard constraints

Hard constraints are constraints that need to be fulfilled for a solution to be feasible.

An example would be that two lectures cannot be scheduled for the same classroom at the same time, or that a teacher is scheduled to two lectures at the same time [6][10][11, p.58].

(8)

2.1.2 Soft constraints

Soft constraints are constraints that do not need to be fulfilled for a solution to be feasible, but it is desired that they are. An example would be that all students can attend all of their classes. The goal is to minimize the total number, or weighted sum, of soft constraint violations [9][11, p.58].

2.2 Ant Colony Optimization

The Ant Colony Optimization algorithm is a probabilistic algorithm for solving dis- crete optimization problems. It utilizes indirect information relaying from previous iterations, in combination with heuristic rules, to construct solutions in a graph [6].

These solutions involve finding paths through graphs and are inspired by ants in the natural world, where ants randomly wander around until they find a source of food.

They leave a trail of pheromones while walking. The purpose of this trail is to find the way back home and to find the way back to the food. Other ants happening upon the trail will have an incentive to follow the pheromone path and will favor it over paths without or with weaker pheromone levels. Over time, less trodden trails or ones that take a longer time to traverse will have their pheromones evaporate.

Thus, shorter and more optimal routes are promoted. ACO algorithms work in a similar manner, where agents traverse a graph and apply pheromones. How the pheromones are applied in the graph is what distinguishes the different variations of the ACO algorithms. Ant systems differ from other evolutionary methods in that they take into account previous iterations effect on the pheromone trail.

As ACO algorithms are used for finding paths in graphs, problems that can be reduced to graphs are of interest. Due to the self-adjusting nature of the ACO algo- rithms, they have an advantage over other approaches when it comes to dynamically changing graphs as they can adapt continuously. The algorithms have previously been shown to produce good approximations to hard problems, such as the Trav- eling Salesman Problem [12], but the different variations of ACO algorithms have had different levels of success depending on the application. Some versions of ACO have been shown to be convergent, including the MAX-MIN ant system.

When traversing the graph, each ant independently builds up a problem solution based on a stochastic decision. The probability of traversing a specific edge depends on both the pheromone level τ and on an attractiveness η based on a problem specific heuristic. Parameters α and β influence their relative importance on the decision [5]. The probability of the i:th ant to traverse the edge from node x to node y ∈ N , where N is the nodes that is possible to travel to from x, is described by:

pix,y = τx,yα · ηx,yβ Σν∈N τx,να · ηx,νβ

(1)

The application of pheromone trails and their meaning differs somewhat depend- ing on the ACO variation. The pheromones can either be applied online, where

(9)

pheromones are applied as the path is traversed, or offline, where pheromones are applied by a daemon action. The applied amount can be constant or weighted based on the quality of the solution. Variations using a hybrid version of both online and offline updates can be used [2][8], or they can be used exclusively [9].

To prevent stagnation and convergence to a non-global minimum, a pheromone evaporation coefficient ρ exists to promote the traversal of new paths. To further improve the results, optimization methods, such as local search or tabu search, can be used by the daemon action to find local minima [2][3].

Pheromone level updates are performed using the function:

τx,y ← (1 − ρ)τx,y+ ∆τx,y (2)

where τx,y represents the pheromone level on the path between nodes x and y.

The ∆τx,y is the pheromone to be deposited and is specific to the ACO variation.

Sections 2.2.1 and 2.2.2 specifies the details of the MAX-MIN and Rank-based update functions.

2.2.1 MAX-MIN Ant System

The MAX-MIN ant system [9] is an elitist ACO variation, meaning only the best solution is taken into consideration when applying pheromones. In the MAX-MIN ant system, the pheromone application is done offline by a daemon action. For every iteration, each ant individually constructs a solution, compares it to the current best and replaces it if appropriate. After all ants have finished, the update daemon places pheromones on the global best path. Updating the pheromone levels is done with the ∆τx,y values:

∆τx,y

(1 if edge(x, y) ∈ best solution

0 otherwise (3)

The pheromone levels are then adjusted to lie within the manually set boundaries [τmin, τmax]. This is done to promote the traversal of paths less traveled and to avoid quick convergence to non-optimal local minima. This step is not performed in the classic elitist ACO variation and is the main difference between them.

2.2.2 Rank-based Ant System

In the Rank-based Ant System [4], all solutions are ranked according to a chosen criterion. The amount of pheromone that is applied on a path is based on its ranking. Usually, the ranking is based on the length of the solution. However, all solution paths produced in our chosen graph will have the same length. Therefore, the solutions will instead be weighed based on the number of constraints that are violated. The pheromone trails in the Rank-based Ant System can be placed either

(10)

offline or online. The amount of pheromones distributed along the path is defined by a chosen constant q and the weight of the solution. Updating the pheromone levels is done with the ∆τx,y values:

∆τx,y

( q

|constraint violations| if edge(x, y) ∈ Solution set

0 otherwise (4)

2.3 Construction Graph

To apply the ACO algorithms to a problem, the problem needs to be represented as a graph. The graph created to represent the problem is called a construction graph.

In order to be able to represent large problem instances, memory-efficient graphs are preferred [6]. Various construction graphs have been suggested for the UCTP, including reducing it to the graph coloring problem (GCP) [2][10], or more problem- specific constructions as performed by Dino Matijaˇs et al. [6] and Krzysztof Socha and Sampels [9]. An ACO solution to the problem can be a colored construction graph, as in the case with the GCP, or a subset of vertices connected by a subset of edges as in the graph used by Krzysztof Socha and Sampels [9].

The construction graph used in this study is described and explained in detail in section 3.2.

2.4 Previous studies

Previous studies have shown that ACO algorithms have been successful in solving the UCTP [6][9] and other NP-hard problems [2][12]. However, it has been difficult to find how different variations of the ACO algorithm compare to each other.

Krzysztof Socha and Sampels [9] were successful in solving the UCTP using the MAX-MIN ACO variation. The study compares the variation to other families of algorithms and concludes that it is as effective as the best performing algorithms for solving the UCTP. The study does not investigate the Rank-based variation in depth.

A study by Dino Matijaˇs et al. [6] shows a successful application of the MAX- MIN ACO variation for solving real life UCTP instances. A more advanced and memory efficient construction graph than Krzysztof Socha and Sampels [9] was used in order to produce good results for harder problem instances. The study can be seen to bridge the gap between research and real life and serve as proof of the ability of ACOs to solve complex problems.

Colorni et al. [5] introduces the concept of ACOs and outlines three variations:

ANT-density, ANT-quantity and ANT-cycle. The study shows successful applica- tions of the variations for solving the Travelling Salesman Problem. The ANT-cycle variation serves as a base for the Rank-based variation used in this study.

(11)

3 Method

This section describes the methods used to conduct the study. The specific con- straints for the UCTP problem are explained and defined, as well as the specific problem instances. The specific ACO variations and the pheromone placements used for each variation are also described. The construction graph used in this paper is also described in detail.

3.1 University Course Timetabling Problem

There are many different problem instances for the UCTP. In this study, the problem instances were limited to one work week (five days) with nine time-slots per day, for a total of 45 slots over the course of the work week. Each class or lecture was said to be an event. Each event had a set of required features and each room had a set of features it fulfilled. The features were represented as boolean values. If an event-room pairing fulfilled all the required features, then no constraints were violated. Otherwise, each missing feature resulted in one hard constraint violation.

The ACO variations were tried on problem sets from the University of Twente’s benchmarking project for school timetabling [1]. A benefit of using the problem sets from the University of Twente is that they are guaranteed to have a solution that doesn’t violate any hard constraints. These sets also enable us to compare our solutions to other implementations. Additionally, we chose to use these already existing problem instances because of time constraints. The problem sets come in three different difficulties: easy, medium and hard. The following table shows the parameters for the different problem difficulties:

Parameter (Nr of ) Easy Medium Hard

events 100 400 400

rooms 5 10 10

features 5 5 10

students 80 200 400

Table 1: Parameters for the UCTP problem sets used in this study

Five easy, five medium and two hard problem instances were used in this study.

We ran our algorithms on all problem instances of all difficulties and compared how well they fared for each difficulty.

The constraints used in this study were based on the problem sets described above. Solutions to the UCTP were ranked according to the number of hard con- straint violations firstly, and the number of soft constraint violations secondly. The

(12)

choice of preferred solution can be shown as:

pref erred(σi, σj) =





σi if [hard(σi) < hard(σj)] ∨

[hard(σi) = hard(σj) ∧ sof t(σi) < sof t(σj)], σj otherwise

(5)

Here, σk represents a solution. hard(σk) and sof t(σk) are mappings from solution k to the number of hard and soft constraint violations.

The constraints used in this study were as follows:

Hard constraints Soft constraints

A room can only be assigned to No student attends more than one one event for a given time slot class for a given time slot

A feature required by an event must be fulfilled by its assigned room

Table 2: UCTP Constraints used in this study

3.2 Construction Graph

Figure 1: Simplified instance of the construction graph used in this study. Node Evi rj tk represents event i, room j at time slot k.

For both its relative simplicity and memory-efficiency and in order to have a graph representation that worked for several variations of ACO algorithms, a con- struction graph similar to Krzysztof Socha and Sampels [9], shown in Figure 1, was used. The graph has a start node and an end node. Each node in the graph except for the start and end represent an event, a room and a time slot. The edges repre- sents the room and time assigned to the event. The graph is directed and since we

(13)

always start from the start node and end at the end node, and because all events are assigned exactly once, all paths produced were of the same length. The ants moved from event to event in a fixed order, thus limiting the search space, with the the final path through the graph resulting in a solution. Figure 1 is a simplified example of the graph used. In our case, as mentioned under section 3.1, we had 45 time slots. The number of rooms and events varied between the problem instances and is specified in table 1.

3.3 Ant Colony Optimization variations

This paper compares the two different variations of ACO algorithms described in subsection 2.2: MAX-MIN ant system (see 2.2.1) and rank-based ant system (see 2.2.2). Both of the variations were compared using the same sets of data and the same construction graph for the same amount of time with the objective of mini- mizing the number of constraint violations.

As described in section 3.1, the problem sets consisted of three difficulties: easy, medium and hard. The amount of time we allowed each algorithm to run for each problem set was:

Problem difficulty Time(In seconds)

easy 30

medium 120

hard 360

Table 3: The time used for the different problem difficulties.

If a solution was found that didn’t violate any constraints, the algorithm was interrupted prematurely. This only mattered for the easy problem sets. The time we allowed for each problem set was low compared to other studies [9]. This limited the investigated search space and could have produced skewed results. This is discussed in section 5.

Parameter Value

α 2

β 3

q 2

τmax 4

τmin 0.025

Table 4: The values for the parameters

The above table specifies the values for all algorithm parameters. The parameters α and β and their use is described in section 2.2. The parameter q is used in the rank-based algorithm and specifies the amount of pheromone that is distributed

(14)

along the path. The value for this parameter was chosen based on some small tests.

This value could have been optimized more than it was, and the effects of this are discussed in section 5.

Parameters τmax and τmin are used in the MAX-MIN algorithm and specify the maximum and minimum pheromone values for each step in the path. The τmax and τmin values given in the table were chosen before we decided on our current construction graph. Previously, the number of choices in each step were based only on the number of time slots. In the final construction graph, the number of choices are based on both time slots and rooms. Therefore, the probability of choosing a less preferred path was larger than originally planned. The effects of this are discussed in section 5.

Several options were made available for each version of the algorithm. A local search algorithm was available for use by the daemon action to improve a generated path. This algorithm was the same across the ACO variations. The use of the a priori path attractiveness η in the path probability equation 1 is optional and could be turned off to reduce the iteration time. Each variation of ACO was executed using the options:

• Local search and path attractiveness

• Local search

• Path attractiveness

• Neither

The ACO variations and their options were then compared to each other.

3.3.1 Path attractiveness heuristic

The path attractiveness η affects the probability of path traversal, as can be seen in equation 1. The heuristic shown below produces η ∈ (0, 1], where a choice of path resulting in no new violations to be introduced returns η = 1.

η = 1

1 + v.hard + v.sof t (6)

Here, the v represents the newly introduced violations. Pseudo code of the heuristic is shown below:

(15)

Algorithm 1 Heuristic (Path attractiveness)

1: function path attractiveness(use heuristic, new event)

2: attractiveness ← 1

3: if use heuristic then

4: v ← new violations(new event)

5: attractiveness ← 1/(1 + v.hard + v.sof t)

6: end if

7: return attractiveness

8: end function

The function represents the η in equation 6. The parameter use heuristic is a boolean value representing a switch for the option to use the a priori path attrac- tiveness. The parameter new event represents the current event being considered.

3.3.2 Local search

The local search algorithm moves between solutions by swapping values of adjacent events. The local search moves between solutions for as long as swapping id, room and/or timeslot between two events improve the current solution. The algorithm is interrupted when no further improvement is made. The pseudo code of the described algorithm follows:

Algorithm 2 Local search

1: function local search(solution)

2: repeat

3: i ← f alse

4: for all e in solution do

5: i ← i ∨ local search swap(e.id, (e + 1).id)

6: i ← i ∨ local search swap(e.room, (e + 1).room)

7: i ← i ∨ local search swap(e.timeslot, (e + 1).timeslot)

8: end for

9: until ¬i

10: return solution

11: end function

12: function local search swap(v1, v2)

13: improved ← f alse

14: if violations(e) < violations(swap(v1, v2)) then

15: swap(v1, v2)

16: improved ← true

17: end if

18: return improved

19: end function

(16)

The LOCAL SEARCH function takes a solution as an argument and swaps field values of adjacent events until no further improvement is made. The produced solution is then returned.

3.3.3 ACO functions

An algorithm for constructing a solution was implemented, with pseudo code avail- able in appendix A.1. An event path is constructed through the path probabilities given by equation 1. The path attractiveness function, seen in section 3.3.1, is utilized given that the heuristic is to be used.

An ACO solver for MAX-MIN constructs solutions and stores the global best as a result. The best solution is improved using local search if requested. A pheromone update function is given the global best solution and updates the pheromones ac- cording to equations 2 and 3. Pseudo code for the described solver is found in appendix A.2.

An ACO solver for the Rank-based variation constructs solutions and stores all paths as results. The best result is improved using local search if requested and stored in as a global best solution. All solutions are passed to a pheromone update function and updated according to equations 2 and 4. Pseudo code for the solver is found in appendix A.3.

3.4 Environment

The algorithms were implemented using C++ with g++ used to compile the source code. The following were the flags used when running the tests:

−s t d=c++14 −O3 −march=n a t i v e

All tests were performed on a laptop with the following specifications:

Model : ASUS UX305FA

OS : Ubuntu 1 7 . 1 0 x 8 6 6 4 K e r n e l : 4 . 1 3 . 0

CPU: I n t e l 5Y10 ( 4 ) @ 2 . 0 0 0GHz Memory : 7880 MiB

4 Results

This section presents the results from running the ACO variations on the problem sets. The results are shown as bar plots representing the average number of con- straint violations. The black line represents the standard deviation of all solutions.

As explained in section 3.1, the problem sets are split into three difficulties: easy, medium and hard. The results of each difficulty are shown individually. The algo- rithms were executed on each problem instance with and without the local search

(17)

and heuristic described in section 3.3. Each option is shown as an individual bar tuple.

4.1 Easy difficulty problems

There were five easy difficulty problem instances. Each ACO variation was executed 50 times per problem instance and option. The runtime was a maximum of 30 seconds for each problem instance.

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics

turned off

0 25 50 75 100 125 150 175 200

Constraint violations

3.6

13.3

3.6

16.1

0.1

12.4

0.1

23.5

Max-min

Hard constraint violations Soft constraint violations

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics

turned off

0 25 50 75 100 125 150 175 200

3.6

42.3

4.3

80.1

1.1

26.1

0.7

101.0

Rank-based

Hard constraint violations Soft constraint violations

Easy difficulty problems

Figure 2: Results of running the MAX-MIN and Rank-based ACO variations on the easy problem instances.

The MAX-MIN variation had fewer constraint violations than the Rank-based variation across all options. The smallest difference between the variations can be seen for the options “Using local-search and heuristics” and “Using only heuristics”.

The number of constraint violations is however slightly higher for the Rank-based variation. Both algorithms performed worse without the local-search and/or heuris- tic, but the Rank-based variation performed significantly worse.

4.2 Medium difficulty problems

There were five medium difficulty problem instances. Each ACO variation was executed 50 times per problem instance and option. The runtime was 120 seconds for each problem instance.

(18)

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics

turned off

0 200 400 600 800 1000

Constraint violations

107.2

279.6

115.5

407.3

133.0

447.4

107.4

691.1

Max-min

Hard constraint violations Soft constraint violations

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics turned off

0 200 400 600 800 1000

81.6

327.3

101.0

574.0

160.7

411.7

104.1

796.1

Rank-based

Hard constraint violations Soft constraint violations

Medium difficulty problems

Figure 3: Results of running the MAX-MIN and Rank-based ACO variations on the medium problem instances.

When using both the local-search and the heuristic, the Rank-based variation violated fewer hard constraints but more soft constraints than the MAX-MIN vari- ation. The Rank-based variation did however violate more hard constraints but fewer soft constraints than MAX-MIN when using only the local-search option.

The Rank-based variation performed better than the MAX-MIN variation with both fewer hard constraint violations and soft constraint violations when only the heuristic was used.

Particularly bad results were obtained with the option “Local-search and heuris- tics turned off” for both ACO versions, but the Rank-based system performed sig- nificantly worse.

The standard deviation of hard constraint violations was low for most options.

The standard deviation of soft constraint violations was however high for the options where the heuristics were not used.

4.3 Hard difficulty problems

There were two hard difficulty problem instances. Each ACO variation was executed 50 times per problem instance and option. The runtime was 360 seconds for each problem instance.

(19)

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics

turned off

0 500 1000 1500 2000 2500

Constraint violations

66.2

458.3

72.7

523.4

214.2

1128.2

161.0

1551.3

Max-min

Hard constraint violations Soft constraint violations

Using local-search

and heuristics Using only

local-search Using only

heuristics Local-search and heuristics turned off

0 500 1000 1500 2000 2500

64.6

589.3

89.1

946.8

355.4

931.5

187.9

1788.0

Rank-based

Hard constraint violations Soft constraint violations

Hard difficulty problems

Figure 4: Results of running the MAX-MIN and Rank-based ACO variations on the hard problems.

Both algorithms performed similarly well regarding hard constraint violations for the options where the heuristic is used. For both options where the heuristic is used, the number of soft constraint violations was greater for the Rank-based variation.

Both algorithms produced results with a greater number of constraint violations when the heuristic was not used, but the Rank-based variation performed worse than the MAX-MIN variation. The Rank-based variation performed significantly worse when not using either the local-search or the heuristic.

The spread of the hard constraint violations can be seen to be small for all options. This holds true for the soft constraint violations when observing the options where the heuristic is used. For the options not utilizing the heuristic, the spread of the soft constraint violations is notably large.

4.4 Summary of results

The options utilizing the heuristic produced results with a significantly lower number of constraint violations across all difficulty subsets and ACO variations. The option

“Using local-search and heuristics” can also be seen to produce the best results.

The options not utilizing the heuristic can be seen to produce worse results in all comparisons. The option “Local-search and heuristics turned off” consistently produced the results with the highest number of constraint violations.

The difference between the algorithms can be seen to be small for the options utilizing the heuristic. For the easy problems, the number of constraint violations was slightly lower for the MAX-MIN variation. The Rank-based variation performed better for the medium difficulty problems while the ACO variations produced similar results for the hard difficulty problems. The Rank-based variation produced results

(20)

with a larger number of constraint violations across all difficulty subsets for the options where the heuristic is not used.

The standard deviation of the number of hard constraint violations is consistently small for the medium and hard difficulty problems. This is not the case for the easy problems where the standard deviation is large for all options and constraint violation types. The standard deviation of the soft constraint violations can is small for the options where the heuristic is used. The standard deviation of soft constraint violations is large for the options not using the heuristic.

5 Discussion

The purpose of this study was to compare the MAX-MIN and Rank-based ACO variations when solving the UCTP. As expected based on previous studies, both ACO variations were capable of finding reasonable solutions for the UCTP. Similar- ities and differences that were observed in the results are discussed in the following section. The limitations of the study as well as how future research can be conducted are discussed in the end.

5.1 Comparison between the ant systems

We expected both the number of hard and soft constraint violations to increase with problem difficulty, because the number of features and students increased for each difficulty. However, both ACO variations produced results with fewer hard constraint violations for the hard difficulty problems than for the medium difficulty problems when the heuristic was used. This was unexpected since the hard difficulty problems had twice as many features than the medium difficulty problems.

This difference can likely be attributed to the running time, where the hard difficulty problems were given three times as much time, even though both the medium and hard problem difficulties had the same amount of events and rooms.

Since the number of choices in each step is based on the number of events, rooms and time slots, it is possible that it took just as long to traverse the graph for the medium problems as it did with the hard problems. We should thus have allowed the algorithms a longer running time for the medium problems than we did, in relation to the time we allowed for the hard problems.

It is interesting to note that the Rank-based variation performed slightly better overall on the medium problems than the MAX-MIN variation. This difference be- tween the variations was significantly smaller for the hard problems. The MAX-MIN ACO variation even produced better results for the option “Using only heuristics”.

A possible explanation for this is that the Rank-based ACO variation might converge to a local minimum faster than the MAX-MIN ACO variation does. A variation with faster convergence might more easily stagnate on a less optimal solution than a variation that takes longer to converge. This suggests a greater positive impact of

(21)

extending the run time for the MAX-MIN ACO variation compared to the Rank- based variation. Further extending the runtime could thus prove beneficial to the MAX-MIN ACO variation.

The number of hard constraint violations increased with difficulty for the options where the heuristic was not used. This speaks of the importance of utilizing the heuristic in both versions of the algorithm. It also suggests potential success in solving increasingly complex problem instances.

Close to optimal solutions for the easy problems were found with both ACO variations when the heuristic was used. The best results for the medium and hard difficulty problems follow the same pattern and places significance on the heuristic used. Although worse solutions were produced for the option “Using only local- search” than for the option “Using only heuristics”, the results were better than for the option “Local-search and heuristics turned off”. As the best option across all difficulties and ACO variations was “Using local-search and heuristics”, it is clear that the use of local search is beneficial to the ACO algorithm. It is also evident that our implementation of local search is insufficient as a replacement of the heuristic.

This differs from a study by Krzysztof Socha and Sampels [9] where the best results for the MAX-MIN variation on the UCTP were produced when only utilizing local search. This was attributed to an increased number of iterations that could be made by no longer calculating the heuristic. Our differences could result from a more efficient implementation of the heuristic calculation on our part, or a better implementation of the local search algorithm on their part.

The MAX-MIN ACO variation produced significantly better results across all problem difficulties for the options not utilizing the heuristic. As these options promote the importance of pheromone they highlight the difference in pheromone placement between the ACO variations. It can thus be argued that our results show that the MAX-MIN algorithm is better suited than the Rank-based variation for situations where utilizing a heuristic is impractical.

The standard deviation of the soft constraints for the options not utilizing the heuristic can be seen to be quite large for the medium and hard difficulties. This could be the result of our solution preference, as explained by function 5, which prioritizes solutions with fewer hard constraint violations over solutions with fewer soft constraint violations. This is supported by the small standard deviations of the hard constraint violations for both medium and hard difficulty problems. The prioritization of hard constraints over soft constraints as well as an increased number of students are likely to be the reasons for an increase in soft constraint violations between medium and hard difficulty problems. This is also likely to be the reason for the increased spread of soft constraint violations.

5.2 Limitations

Due to limited time and resources, we were unable to test everything to the extent we wanted. We discuss the effects these limitations might have had on this study in

(22)

this section.

5.2.1 Time limitations

A previous study done by Krzysztof Socha and Sampels [9] investigated the potential effectiveness of the MAX-MIN variation in solving the UCTP. The construction graph used in our study was based on the construction graph used in their study.

They also used problem instances from University of Twente [1]. Their runtime for the problem instances were 90 seconds for the easy difficulty problems, 900 seconds for the medium difficulty problems and 9000 seconds for the hard difficulty problems.

In our study, we limited the allowed run time for each problem instance to 30, 120 and 360 seconds respectively due to time limitations. It is difficult to say how much better the solutions would have been given longer run times, but it is probable that they would have found better solutions for all difficulty subsets. We can see from the results in figure 3 and figure 4 that the algorithms were able to find solutions violating fewer hard constraints for the hard problems than for the medium problems when using the heuristic. As discussed in the previous section, this is likely due to the running time allowed for the medium problems was short in comparison to the running time allowed for the hard problems.

5.2.2 The parameter values

The probability for each ant to traverse a certain edge in the graph is described by equation 1 in section 2.2. The equation has parameters α and β that specifies the relative importance of the pheromone level and path attractiveness heuristic respectively. These parameters can be tweaked to improve the effectiveness of the algorithms. Initial tests were made to find relatively good values. We found that the optimal values for these parameters vary for the different difficulties. However, due to time and resource limitations, we could not test this to a larger extent and the values were thus not optimized for the different difficulties.

Since the purpose of this study was to compare two ACO variations with each other and not to find an optimal solution to the UCTP problem, we argue that this is less important for this study. Although the implementations might not be optimal, their flaws will be the same.

The MAX-MIN ACO variation have the maximum and minimum pheromone level parameters τmax and τmin. The performance and behavior of the algorithm is influenced by the values of these parameters. The probability when choosing a path is dependent on the values. It can therefore be interesting to change these values for the different difficulties as the amount of choices varies. If the ants are less likely to choose a pheromone heavy path, it will take longer to converge to a solution. But if the ants are too likely to choose the pheromone heavy paths, they will more rarely try new paths and we might converge to a less optimal solution.

Initial testing indicated that an increase in the lower bound would result in an increased performance across all problem difficulties. However, we are not certain

(23)

of what the optimal values for the different difficulties are.

The Rank-based ACO variation has a parameter q representing the amount of pheromone that is distributed along the path. As with the other parameters, this value influences the performance of the algorithm. If the value is too small, the algorithm will take longer to converge to a solution. If the value is too large, the algorithm might get stuck in a sub-optimal local minimum. Initial tests were made to find a relatively good value, but we do not know if different values should have been chosen for the different difficulties.

5.3 Future research

Since this study was limited in time and resources, it was not possible to try the different variations on different types of problems. It would have been interesting for the discussion to compare the variations on different problems and on different construction graphs. The variations might work differently on different graphs.

We also planned on running the algorithms just once for the same amount of time as used in the study done by Krzysztof Socha and Sampels [9] as explained in section 5.2.1. We intended to do this to see how much of an impact a longer running time would have on the solutions. This was not done due to time and resource constraints. As this limits our insights to the impact of running times, futures studies should make efforts to investigate this. This would also test the indicated positive impact of increasing the run time for the MAX-MIN algorithm.

As mentioned in section 5.2.2, further optimizing the parameters α, β, τmaxmin and q would provide a more fair representation of the capabilities of the ACO vari- ations. However, it is unclear how much the α and β parameters affect the per- formance of the algorithms as these are the same for both variations. The values of τmax, τmin and q directly affect the performance of the algorithms. Investigating how these values might impact the algorithms could improve the credibility of the results.

6 Conclusion

Our results show that both ACO variations performed similarly on all problem difficulties when utilizing the path attractiveness heuristic. This conclusion can only be drawn when solving the UCTP given the parameters used in this study.

The Rank-based variation can be seen to converge to local minima at a faster rate than the MAX-MIN variation. The difference between the variations disappears with an increased runtime and there is an indication that further extending the allowed time would have a greater positive impact on solutions produced by the MAX-MIN variation. For situations where utilizing a heuristic is impractical, the MAX-MIN ACO variation utilizing local search performs better than the Rank based variation.

(24)

Future studies should investigate the effect the parameters have on the algorithms to improve the reliability of the results.

(25)

7 Bibliography

[1] Benchmarking project for (High) School Timetabling [n.d.], https://www.utwente.nl/en/eemcs/dmmp/hstt/. Accessed: 2018-04-21.

[2] Bessedik, M., Laib, R., Boulmerka, A. and Drias, H. [2005], Ant colony sys- tem for graph coloring problem, in ‘International Conference on Computa- tional Intelligence for Modelling, Control and Automation and International Conference on Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC’06)’, Vol. 1, pp. 786–791.

[3] Bui, T. N., Nguyen, T. H., Patel, C. M. and Phan, K.-A. T. [2008], ‘An ant- based algorithm for coloring graphs’, Discrete Applied Mathematics 156(2), 190 – 200. Computational Methods for Graph Coloring and it’s Generalizations.

[4] Bullnheimer, B., Hartl, R. and Strauß, C. [1997], A new rank based version of the ant system - a computational study, Technical report, University of Vienna.

[5] Colorni, A., Dorigo, M. and Maniezzo, V. [1991], Distributed optimization by ant colonies, in ‘proceedings of ecal91 - european conference on artificial life, Paris, France’, Elsevier, Amsterdam, Netherlands, pp. 134–142.

[6] Dino Matijaˇs, V., Molnar, G., ˇCupi´c, M., Jakobovi´c, D. and Dalbelo Baˇsi´c, B.

[2010], University course timetabling using aco: A case study on laboratory ex- ercises, in R. Setchi, I. Jordanov, R. J. Howlett and L. C. Jain, eds, ‘Knowledge- Based and Intelligent Information and Engineering Systems’, Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 100–110.

[7] Gore, P., Sonawane, P. and Potdar, S. [2017], ‘Timetable generation using ant colony optimization algorithm’, International Journal of Innovative Research in Computer and Communication Engineering 5(3).

[8] K, D. C. N. [2011], ‘Timetable scheduling using graph coloring’, International Journal of P2P Network Trends and Technology 1(2).

[9] Krzysztof Socha, J. K. and Sampels, M. [2002], A max-min ant system for the university course timetabling problem, in ‘Proceedings of the Third Inter- national Workshop on Ant Algorithms’, ANTS ’02, Springer-Verlag, London, UK, UK, pp. 1–13.

[10] Redl, T. A. [2016], ‘On using graph coloring to create university timetables with essential and preferential conditions’, Advances in marketing, management and finances pp. 163–167.

[11] Willemen, R. J. [2002], School timetable construction : algorithms and com- plexity, PhD thesis, Technische Universiteit Eindhoven.

(26)

[12] Yang, J., Shi, X., Marchese, M. and Liang, Y. [2008], ‘An ant colony op- timization method for generalized tsp problem’, Progress in Natural Science 18(11), 1417–1422.

(27)

Appendices

A ACO related functions

A.1 Solution construction

Algorithm 3 Choice of event, room and time slot combination

1: function construct solution(pheromone matrix)

2: Solution : Empty

3: for all events e do

4: possible combos ← all id, timeslot and room combinations with id = e.id

5: new event ← choose time(possible combos, pheromone matrix)

6: Solution.violations ← Solution.violations + new violations(new event)

7: Solution.path.append(new event)

8: end for

9: return Solution

10: end function

11: function choose time(events, pheromone matrix)

12: div ← Σe∈events pheromone matrix(e)α·

13: path attractiveness(use heuristic, e)β

14: event prob : Empty list

15: for all events e do

16: event prob.append(pheromone matrix(e)α·

17: path attractiveness(use heuristic, e)β/div)

18: end for

19: stoch event ← rand(0, 1)

20: cumulative prob ← 0

21: for event, prob in event prob do

22: cumulative prob ← cumulative prob + prob

23: if stoch event <= cumulative prob then

24: return event

25: end if

26: end for

27: end function

(28)

A.2 MAX-MIN ACO functions

Algorithm 4 ACO solver for MAX-MIN

1: function aco max min(running time, use local search, pheromone matrix)

2: while current time < running time do

3: for each ant a do

4: current solution ← construct solution(pheromone matrix)

5: if best solution worse than current solution then

6: best solution ← current solution

7: end if

8: end for

9: if use local search then

10: best solution ← local search(best solution)

11: end if

12: if global best solution worse than best solution then

13: global best solution ← best solution

14: end if

15: update pheromone max min(global best solution, pheromone matrix)

16: end while

17: return global best solution

18: end function

19: function update pheromone max min(solution, pheromone matrix)

20: for all event combo in pheromone matrix do

21: event combo.pheromone ← event combo.pheromone · (1 − ρ)

22: if event combo in solution then

23: event combo.pheromone ← event combo.pheromone + 1

24: end if

25: event combo.pheromone ← min(event combo.pheromone, τmax)

26: event combo.pheromone ← max(event combo.pheromone, τmin)

27: end for

28: end function

(29)

A.3 Rank-based ACO functions

Algorithm 5 ACO solver for rank-based

1: function aco rank(running time, use local search, pheromone matrix)

2: while current time < running time do

3: current solutions : Empty solution list

4: for each ant a do

5: current solutions.append(construct solution(pheromone matrix))

6: if best solution worse than current solutions.last then

7: best solution ← current solutions.last

8: end if

9: end for

10: if use local search then

11: best solution ← local search(best solution)

12: end if

13: if global best solution worse than best solution then

14: global best solution ← best solution

15: end if

16: update pheromone rank(current solutions, pheromone matrix)

17: end while

18: return global best solution

19: end function

20: function update pheromone rank(solutions, pheromone matrix)

21: for all event combo in pheromone matrix do

22: event combo.pheromone ← event combo.pheromone · (1 − ρ)

23: if event combo = s in solutions then

24: event combo.pheromone ← event combo.pheromone+

25: q/(1 + s.violations.hard + s.violations.sof t)

26: end if

27: end for

28: end function

(30)

References

Related documents

In the evolving institution condition, high groups achieved higher levels of cooperation than low groups, with a 2.3 units difference in contributions, t(9)~3:2, p~:005, and a 2.8

So, smaller ρ value can improve the random performance and global search capability of algorithm, but it reduces the solution quality, that pheromone volatilize

It will turn out that the case of letters that occur in two different dictionary words after swapping can be handled with asymptotically the same preprocessing time as in the

An Evaluation of the TensorFlow Programming Model for Solving Traditional HPC Problems.. In: Proceedings of the 5th International Conference on Exascale Applications and

This includes an introduction to the power flow problem, how the Newton-Raphson method is applied to the power flow problem, and different approaches on how to solve the

Moreover, it has been proven that the best performance is achieved using a hybrid method where the Jacobian matrix is assembled on GPU, the preprocessing with a sparse high

A rotation angle ^ = 90° gives in this test the best results for average sheet length and average cost function value.. But again, for the rotation angle ^ = 90°, the best

Hence, the predicate moved to the beginning of the sentence making it easier to read, since Swedish, unlike English, is based on the V2-rule stating that the finite verb should