Project Report Football League Fixture Optimisation – Generating

ProjectReport
FootballLeagueFixtureOptimisation–
Generatingthefixturelistforthe2015/16
seasonwhilecomplyingwithallconstraints
TwoSemesterFinalYearIndividualProject
(30CREDITS)
CM3303
Author:AlySherifAbdelfattah-Elmakhzangui
Supervisor:Dr.FrankCLangbein
Moderator:Prof.DaveMarshall
TableofContents
1–INTRODUCTION...................................................................................................................................................4
1.1–AIMS/GOALS.........................................................................................................................................................................4
1.2–INTENDEDAUDIENCE/BENEFICIARIESOFWORK..........................................................................................................4
1.3–SCOPE......................................................................................................................................................................................5
1.4–ASSUMPTIONS.......................................................................................................................................................................5
2–BACKGROUND......................................................................................................................................................6
2.1–OFFICIALRULESANDREGULATIONS................................................................................................................................6
2.2–PROBLEMSWITHCURRENTSOLUTION............................................................................................................................7
2.3–CONSTRAINTSATISFACTIONPROBLEMS..........................................................................................................................7
2.3.1–BacktrackingAlgorithm............................................................................................................................................8
2.3.2–TabuAlgorithm.............................................................................................................................................................8
2.3.3–SimulatedAnnealing...................................................................................................................................................9
2.3.4–GeneticAlgorithms...................................................................................................................................................10
2.3–GOOGLEMAPSDISTANCEMATRIXAPI........................................................................................................................11
2.4–SIMILARPROJECTS............................................................................................................................................................12
2.4.1–HolidayPeriodFixtures..........................................................................................................................................12
2.4.2–TravelingTournamentProblem.........................................................................................................................12
2.4.3–AndrewGoldberg2003...........................................................................................................................................13
3–INITIALTRIALS................................................................................................................................................14
3.1–TABUALGORITHM.............................................................................................................................................................14
3.2–BACKTRACKINGALGORITHM...........................................................................................................................................16
3.3–RESULTSANDDECISION...................................................................................................................................................17
4–DEVELOPINGMAINALGORITHM................................................................................................................19
4.1–GENERALIMPROVEMENTS...............................................................................................................................................19
4.1.1–ReducingRecursionCalls.......................................................................................................................................19
4.1.2–Reformatting...............................................................................................................................................................19
4.1.3–PermutationSelection.............................................................................................................................................20
4.1.4–TrackChanges............................................................................................................................................................20
4.1.5–PseudoCode.................................................................................................................................................................21
4.1.6–Results............................................................................................................................................................................21
4.2–FORWARDCHECKING........................................................................................................................................................22
4.2.1–PseudoCode.................................................................................................................................................................24
4.2.2–Results............................................................................................................................................................................26
4.3–MINIMUMREMAININGVALUEHEURISTIC....................................................................................................................26
4.3.1–PseudoCode.................................................................................................................................................................29
4.3.2–Results............................................................................................................................................................................31
4.4–DEGREEHEURISTIC...........................................................................................................................................................31
4.4.1–BacktrackingIssue....................................................................................................................................................32
4.4.2–PseudoCode.................................................................................................................................................................33
4.4.3–Results............................................................................................................................................................................35
4.5–LEASTCONSTRAININGVALUEHEURISTIC....................................................................................................................35
4.5.1–PseudoCode.................................................................................................................................................................36
4.5.2–Results............................................................................................................................................................................36
5–RESULTSANDEVALUATION........................................................................................................................37
5.1–RESULTS..............................................................................................................................................................................37
5.2–EVALUATION.......................................................................................................................................................................38
5.3–DISCUSSIONOFRESULTSISSUE......................................................................................................................................40
5.3.1–TooConstrained.........................................................................................................................................................40
5.3.2–BuginCode..................................................................................................................................................................41
5.4–ACHIEVEMENTOFGOALS.................................................................................................................................................41
6–FUTUREWORK.................................................................................................................................................43
6.1–FAILURETOPRODUCERESULTS......................................................................................................................................43
6.2–MIDWEEKMATCHES..........................................................................................................................................................43
6.3–MULTIPLELEAGUES..........................................................................................................................................................43
6.4–EXTERNALMATCHESANDEVENTS.................................................................................................................................44
7–CONCLUSIONS...................................................................................................................................................45
8–REFLECTION......................................................................................................................................................46
9–REFERENCES......................................................................................................................................................47
10–APPENDIX........................................................................................................................................................48
1–Introduction
1.1–Aims/Goals
Footballisoneoftheworld’smostpopularsports,originatinginEnglandin1863(FIFA,unk).
Thesport’sfirstgoverningbody,theFootballAssociation(FA),formedwhenrugbyfootball
andassociationfootballbranchedoffontodifferentpaths.Sincethen,footballhasonlygrown
insize,evolvingintoseveraldifferentleaguesnotonlyinEngland,butquicklyincluding
nearbycountriessuchasScotland,WalesandIreland.
Following this, there has been an explosion of organisations similar to the FA around the
world (FIFA, unk), cementing the importance of football to the global audience, demanding
year-round entertainment for their viewing. With the formation of so many professional
teams,schedulinghaslongbeenanissuefortheseentities.Initiallytheproblemwassimple:
createaleaguewhereeachteamplayseachothertwiceandtheteamwiththehighestnumber
ofpointsattheendwins.However,internationaltournamentshaveshortenedthetimeframe
for these matches to be played, all while there are an increased number of teams in each
league,thereforeprovidingmoreopportunityforschedulingconflictwithintheseason.
This project aims to create an algorithm that can reliably generate a fixture list for each
league,whilecomplyingbyalltheconstraintsplaceduponitbytheFA.Thiswillbeachieved
byfirsttestingouttwowell-knownalgorithmsonsmallsamplesizes.Thenextstepwillbeto
develop one of these further with the aim of it eventually surpassing the capabilities of the
currentmethodused.
The success of the algorithm is based on the following criteria, excluding the rules and
regulationsimposedonthefixtures:
1. Minimaldistancetravelledinleaguematchesduringweekdays–withminimalnumber
ofderbymatchesduringweekdays
2. Minimaltimetakentoreachsolution–timetakennowisreportedly5-10minutesper
league
3. Minimalnumberofconstraintsbroken–ideallythereshouldbezeroconstraints
broken,howeverwiththedesirablecriteriathisisreportedtobedifficultinpractice,
withallconstraintsinplace
1.2–IntendedAudience/BeneficiariesofWork
The intended recipients of this algorithm in this case are the Football Association (FA), the
FootballLeague(FL)andtheEnglishPremierLeague(EPL),theorganisationsresponsiblefor
therunningoftheFootballLeagueandthePremierLeague.TheFootballLeagueconsistsof
threeleagues:theChampionship,League1andLeague2.
Thisprojectwillalsobeofinteresttogroupsoutsideoffootball–forexample,thepoliceoften
sendrequeststotheFAtoreschedulehighstakesfixturesawayfromothermajoreventsin
thecitiestheyarehostedin.OneexampleofthiswouldbetheCheltenhamGoldCup,oneof
the most important equestrian events of the year, which is held in Cheltenham over a
weekend.CheltenhamTownFootballClubarerequiredtoplayawayfromtheirhomeground
thatweekendtoallowthepolicetofocusontheorganisationofthehugecrowdsthatcome
withtheGoldCup.
1.3–Scope
The four leagues mentioned above (the Premier League, the Championship, League 1 and
League 2) together make up the scope of this project – the completed algorithm should
producefixturelistsforallofthem,whilestillcomplyingwiththeseveralconstraintsplaced
uponthembythetwoaforementionedorganisations.
Each league is normally dealt with individually, however certain constraints require
collaboration.Forexample,hometownrivalscannotbothplayattheirhomegroundsonthe
same weekend for safety reasons. This would affect teams such as West Ham and Millwall
(Brown, 28/08/09), who are historically huge rivals and yet – at the time of writing this
report–playindifferentleagues.
ThoughthemainscopeofthisprojectistheEnglishleagues,thealgorithmcouldbeadapted
inthefuturetofocusonsimilarleaguesaroundtheworldthatfacesimilarissues.Asfootball
isaglobalsport,othercountrieswillinevitablyfacetheseproblemseachyearasthefootball
federationsorganisetheschedule.
1.4–Assumptions
Theultimateaimisthatthisalgorithmwillbeabletoproduceaschedulethatcomplieswith
allconstraints(bothsetbyofficialfootballingbodiesandexternalpartiessuchasthepolice)
at the first time of asking, and will not require any human input after its completion. As a
result, the assumption shall be made that all non-football related events have already been
givenacalendardateandaspecificlocationatwhichtheywillbeheld.Aswillbeexplainedin
theconclusionofthisreport,therewasnotenoughtoimplementnon-footballevents,though
thisassumptionwillideallyholdinfutureworks.
Another assumption will be that these dates are all fixed, and will not change during the
courseoftheseason.Anychangeswillrequireadditionalinput;thereforeoncethealgorithm
hasoutputafixturelist,therewillbenochangestoanyofthedates.
2–Background
2.1–OfficialRulesandRegulations
PremierLeague(TheFootballAssociationPremierLeagueLimited,2015):
• ThisseasontheChristmasfixturesmustbeplayedonthe26thDec,28thDecand2ndJan.
• No fixtures shall be arranged on any of the 6 days preceding the 4 dates agreed
between the League and the Football Association prior to each Season upon which
internationalmatcheswillbeplayed
• Lastmatchon15thMay2016
Football League (Championship, League 1 and League 2) (The Football League,
14/10/15):
• IfateamisscheduledtoplayonaTuesday,andtheirimmediatelyprecedingmatchis
taking place on the Sunday, they should have their match postponed 24 hours to the
immediatelyfollowingWednesday
• Lastmatchon7thMay2016
GeneralRulesforAllLeagues:
• Firstmatchoftheseasonis8/9thAugust2015(normallyweekafterthis)
• Ateamshallneverstartorfinishtheseasonwithtwoawayortwohomematches
• Twopairedteamscannotbothplayattheirhomegroundsonthesameweekend
• ThereisalimitonthenumberofLondon-basedclubsplayingathomeonthesameday
o ThereisaseparateruleforLondonbasedPremierLeagueteams
• ThesameruleholdstrueforManchester
o Thisisarequirementtoaidthepolicingofsuchevents,whichcanbedifficult
giventhehighattendances
• In any five matches there should be a split of three home fixtures, two away or the
otherwayaround
o Maximumtwoawaymatchesinarow
o Maximumtwohomegamesinarow
• Thelastsetoffixturesoftheseasonforeachleaguewillbeplayedonthesameday
o Having all matches beginning at the same time on the same day means that
there will be no teams waiting on other matches to finish to discover where
theyhavefinishedintheleague
• If a team has a European fixture on a Thursday, their next match should be on the
immediatelyfollowingSunday.
o Thisallowstheteammoretimetoresttheirplayers
• IfateamhasaEuropeanmatchonaTuesday,theirpreviousmatchshouldbeonthe
immediatelyprecedingSaturday,nottheSunday.
o Thisallowstheteammoretimetoresttheirplayers
• Reducedistancetravelledonweekdaymatches
o Weekday matches are typically held in the evening, and therefore are difficult
forfanstotraveltoafterwork,especiallyifthey’retravellingtoanothercity.
DesirableConstraints
• FACupfixturesforallteams
• LeagueCupfixturesforallteams
• JohnstonPaintTrophyfixturesforLeague1and2teams
• EuropeanfixturesforcertainPremiershipteams
o Distancewillnotbeafactorforthesefixturesasthisisacompetitionorganised
bytheUEFA–TheUnionofEuropeanFootballAssociations
• Certainteamsshouldnotplayathomeduringmajorcityevents(e.g.Liverpoolandthe
GrandNational)
• Keepderbymatchesonweekends
o Derbymatchesareundoubtedlythehighlightofanyfan’sseason–achanceto
watch your team face off against their rivals. As such, these matches are
preferredplayedontheweekend,toensurethatturnoutforthemismaximised.
2.2–ProblemswithCurrentSolution
Atthetimeofwriting,thetaskofcreatingthefixturesforthefootballseasonistaskedwith
Atos,theinternationalITservicescompanybasedinFrance.Currently,theirmethodinvolves
thefollowing:“Foreverydateintheseason,thefixturecomputerknowswhoisathomeandwho
isawayandthenitwillmixthemuprandomlytodeterminewhichmatcheswilltakeplaceon
whichdate”(PremierLeague,17/03/13).
ThissolutiondoesinvolveminimisingtravelonBoxingDayandNewYear’sDayasmuchas
possible,aswellastryingtopreventcongestionontrainlinesbyensuringteams’supporters
donothavetotraveltoawayfixturesusingthesamerailways.
However, one key area that is not addressed is the distance travelled on weekdays. The
averageworkingdayfinishesatroughly5pm,andtypicallyweekdayeveningfixturesbeginat
7:45pm. Therefore, in order for an away team’s fans to make the distance to watch their
teams, the distance to the opposition’s home ground must be short enough for these
supporterstobeabletowatchthematch.
Thisdoesnotonlybenefitthetravellingteam;thehomeclubselltheticketstothefixture,so
havingahigherattendancebringsthemmoreincomewhichcanbecrucial,especiallytolower
league clubs that are often struggling financially. My solution attempted, but ultimately fell
shortinitsendeavourtoincorporatethedistancesbetweenleagueclubsintothealgorithm;
insuchawaythatdistancetravelledbyawayteamsonweekdaysisreducedtoaminimum.
2.3–ConstraintSatisfactionProblems
(Ghedira,2013)
Aconstraintsatisfactionproblem(CSP)isdefinedasaquadruplet(X,D,C,R)suchthat:
• Xisasetofnvariables
• Disasetofnfiniteanddiscretedomainsforeachofthevariables
• Cisasetofmconstraintsbetweenthevariables
•
Risasetofmrelationsassociatedwiththeconstraints,whereeachRdefinesall
combinationsofvaluespermittedbyeachC
ThereareseveralalgorithmsthatcanbeusedtoattempttoreachasolutionforCSPs,aselect
fewofwhichwillbedescribedbelow.
2.3.1–BacktrackingAlgorithm
Thisisthealgorithmthatwasultimatelyutilisedinanefforttoreachtheobjectivesdefined
above.Backtrackingisadepth-firstsearchalgorithm,meaningitstartsattherootofthetree
andthentraversesdowninsearchofasolution,whichitwillreachoncethealgorithmarrives
ataleafnodewithnoneoftheconstraintsviolated(Rutgers,2015).
In this example, the algorithm would start at node 1, the root node, and make a choice to
eithertraversetonode2or3.Thisdecisioncanbeacomplicatedone,andisexploredfurther
intheDevelopingMainAlgorithmsectionbelow.Theprogramwouldendonceoneoftheleaf
nodesisreached,inthiscasethatwouldbe4,5,6or7.Ifthecodereachesadeadend,itcan
“backtrack”,toanearliernodeandmakeadifferentchoicefromthatposition.
Onecommonproblemwiththismethodisthatasearchcanoftenbecome“trapped”downa
branchofthetreethatisalreadyguaranteedtofail,thusincreasingtherun-timebytraversing
pointlessareasofthetree.Asoneoftheobjectiveshereistominimisethetimetakenfora
solutiontobereached,thisproblemisserious,especiallyasultimatelythealgorithmwillbe
dealing with seasons of 20 teams. However, this can be solved with the assistance of a few
heuristics,whichareutilisedinthefinaliterationofthecodedescribedbelow.
2.3.2–TabuAlgorithm
Tabusearchisanalgorithmthatwasalsoconsideredforfurtherdevelopmentinthisproject.
Itdiffersfrombacktrackingbecausewherethatbuildsupthesolutiononevariableatatime;
tabu creates a solution immediately and begins searching its neighbours for superior
alternatives.
Oneofitskeyfeaturesistheuseofa“tabu”list(GloverandLaguna,1997),asetofbanned
movesbasedonprevioussearchresults.Ratherthanaddingthemovemadetogetfromone
solutiontoanother,theinversemoveistheonerecorded–theideabeingthatasthatsolution
hasalreadybeenvisited,banningthisparticularmovewillpreventanimmediatereturn.This
allows the search to more readily arrive at other potential solutions faster. The tabu list is
usedforshort-termmemory–movesplacedinthislistareunbannedafterafewmoveshave
passed, as the potential of returning to the original solution has been reduced by any
subsequentmoves.
Oneofthemainissueswiththissearchalgorithmisthatallofasolution’sneighboursmustbe
calculated. For the problem described above, the size of the neighbourhood could become
verylarge.Takeaseasonofnteamsinabasicconstructofaseason.Thisseasonhas2n–2
setsoffixtures,eachofwhichfeaturesthesenteamsinsomecombination.Eachsethasn!–1
neighbours;thereforeeachsolutioncouldhave(2n–2)*(n!–1).Ofcourse,thisnumbercan
be reduced by means of the tabu list, however this number will still be computationally
difficult to search through. During the initial testing stage, tabu search is tested alongside
backtrackingtodetermineifthiswillindeedbeconsideredadrawback.
2.3.3–SimulatedAnnealing
Simulated annealing was created as way of getting around the issue that greedy heuristics
usuallyencounter:convergingonalocaloptimumratherthantheglobalsolution.Kirkpatrick,
DanielGalettandVecchiindependentlydescribedthissolution(Kirkpatrick,DanielGalettand
Vecchi, 1983), which was based off of Metropolis’ algorithm (Metropolis et al, 1953) for
simulatingthecoolingofmaterialinaheatbath.
Theideaistoconstructaninitialsolutiontotheproblemandthenbegingeneratingarandom
neighbourofsaidsolution.Ifthecostofthenewsolutionisbetter,thenitisacceptedasthe
newstateandthealgorithmcontinues.However,iftheoriginalhasalowercostthenafurther
stepofverificationisrequired.AcalculationusingtheBoltzmannconstantisdetermined,and
ifacertainthresholdofthisvalueispassed,thenthehighercostsolutionisstillacceptedas
thenewstate.Thereasonforthisistopreventthealgorithmfrombecomingtrappedinalocal
optimum,asshownhereforexample:
Local
Global
Optimum
Optimum
Allowing the occasional uphill move is essential to this goal, and thus allows the simulated
annealing algorithm to outperform a greedy heuristic. The downside of this particular
method,however,isthatitrequiresalargeamountofcomputationtime.Oneoftheobjectives
of this project is to minimise the time taken to arrive at a result (van Laarhoven and Aarts,
1989)soforthisreason,simulatedannealingwillnotbeexploredfurtherhere.
2.3.4–GeneticAlgorithms
GeneticalgorithmsarebasedonDarwin’stheoryofevolution,morespecifically–survivalof
thefittest.Here,Darwinexplainedthatorganismsmostsuitedtotheirenvironmentwilltend
to survive in their struggle for existence and that, naturally, survivors will pass on their
hereditarydispositiontoheiroffspring.
Playing on this, John Holland published a book in 1975 titled “Adaptation in Natural and
Artificial Systems” and devised a system where a solution to a problem could be found by
using some of the ideas that come from the natural world. To set up the algorithm, the
followingsetupisrequired:
• Chromosome–stringofgenesrepresentingasolutioncandidate,forexample,bit
representationofarealnumber:
1
0
1
1
1
1
•
•
Population–setofchromosomes(possiblesolutions)
Gene–singleentrynthechromosome,aparameterofthesolutionsete.g.
1
0
1
1
1
1
•
•
•
•
Allele–valueofagene,e.g.1,0etc.
Locus–genepositioninachromosome
Geneticoperators–transformcurrentchromosomesintonewones
Fitnessfunction–takesroleofcostfunction,exceptingeneticalgorithmsitismore
naturaltoexpressresultsintermsofmaximisingratherthanminimisingi.e.optimal
solutionshaveahigherfitness
Thefollowingaretheonlygeneticoperatorsusedduringthisalgorithm:
• Selection–selectromthecurrentpopulationhechromosomestobecombinedvia
crossover.Theprobabilityofselectionshoulddependonfitness.
• Crossover–2“parent”chromosomescreate2“offspring”chromosomes:
1
0
1
1
0
1
1
0
0
1
1
1
0
0
0
1
1
1
0
0
1
1
0
1
•
Mutation–changeeachallelewithsomesmallprobabilitye.g.
1
0
1
1
1
1
1
1
1
1
0
0
Throughtheseoperators,each“generation”ofchromosomesgradually“evolves”closertothe
optimalsolution.
Thereasonthatthegeneticalgorithmwasnotconsideredforfurtherexplorationwasdueto
its chance dependent outcome – there are no guaranteed results for any of the genetic
operators – and by extension it has a relatively large computational time (Akerkar, Sajja,
2010).AsopposedtotheTabusearch,wherethetimetakentoreachasolutionhadpotential
tobeshortened,thegeneticalgorithm’schanceoutcomeisakeyfeature,uniquetoitbasedon
it’sbiologicalevolutionaryroots.
2.3–GoogleMapsDistanceMatrixAPI
Oneoftheobjectivesrequiredisthatthedistancetravelledontheweekdaysbeaslowavalue
as possible. In order to do this, it is necessary to have the distance between the football
stadiums of every team in the leagues. The Google Maps Distance Matrix API (Google, unk)
providestraveltimesanddistancesbetweenoriginpointsanddestinations,returningthemin
JSON (JavaScript Object Notation) or XML (Extensible Mark-up Language) format. For this
scenario, JSON was chosen as Python (the programming language used in this project)
containsaJSONlibrary,enablingeasyinterpretationoftheseresults.ThisAPIwaschosenfor
thefeaturesshownabove,andalsoforthereasonthatitisfreeforsingledeveloperuse.
The parameters of this API obviously include the origins and destinations, but it is also
possibletospecifycertainaspectssuchas:modeoftransport,languageofresults,routesto
avoid, unit of results, departure and arrival times. For the purposes of this project, the
distances do not need to be completely accurate for each match day and a general set of
results can be used for comparison. The only parameter specified was mode of transport,
whichwassettodriving.Themajorityoffanstravelwithcoachesprovidedbytheirteamand
some, particularly families, drive to the stadiums when their team are playing away from
home.
Thelocationsofeachoftheteamsweretakenintheformoftheirpostcoderatherthantheir
teamnames.ThisisbecauseoccasionallyitcouldbeseenthatcertainnamescausedtheAPIto
takefulladdressesintheUSA,ratherthanintheUK.Forexample,ManchesterUnitedwould
beinterpretedasUnitedWay,Manchester,NewHampshire,USA,whichisclearlynotcorrect.
TheresultsarestoredinatextfileinJSONformat,withthedistancesinmetres.Theresults
are for every team travelling to each team in each of the leagues, not just their own league.
This is because at the end of every season teams move between leagues based on their
positioninthetable,soteamsthatwouldpreviouslyhaveneverplayedwillfaceeachotherin
thecomingseason.
2.4–SimilarProjects
2.4.1–HolidayPeriodFixtures
The most similar recent project related to this one was produced by G Kendall of the
UniversityofNottingham,titled“SchedulingEnglishfootballfixturesoverholidayperiods”and
was produced in 2007. The aim of this paper was to “investigate if we are able to generate
fixtures,forthesetwodays,thatadheretothevariousconstraints,buthavetraveldistances
thatarelessthanthedistancesofthefixturesproducedbythefootballauthorities”(Kendall,
2007). The two days referenced are the Bank Holiday (26th December) and New Year’s Day
(1stJanuary).
Theparticularconstraintsonthesedaysareasfollows:
• Ateammustplayathomeononedayandawayontheother
• Thesameteamscannotplayeachotheronbothdays
• Pairedteamscannotplayeachother
• Thetotalnumberofpairedteamsplayingathomecannotexceedacertainlimit
• ThereisalimitonthenumberofLondon-basedclubsthatcanplayathomeononeday
Kendallusedadepthfirstsearchapproach,coupledwithalocalsearchtooptimizehisresults.
While in principle the aim is the same as the one here, the project’s aim is to create the
fixturesfortheentireseason,notjustthesetwoparticulardaysandasaresultmusttakeinto
accountalloftheotherconstraintsthatareplacedontheseleagues.
2.4.2–TravelingTournamentProblem
AfamousattemptatminimisingthedistancetravelledbyteamswasinspiredbyMajorLeague
BaseballintheUS,andwaslatercalledtheTravellingTournamentProblem(TTP)byEaston,
whose work on this began in 1999. Easton was interested in reducing the overall distance
travelledbyteamsduringtheseason,whichisamuchbiggerissueintheUSAthanitisinthe
UK,duetothelargeareaoflandthatUSAencompasses.
Successherehasbeenfoundwithvariousalgorithms,includingbutnotrestrictedto:branch
andprice,simulatedannealingandtabu(Various,2016).ThekeydifferencewiththeTTPis
theassumptionthatteamswillgoonaroadtripfortheentireseason,duetothesizeoftheUS
as previously stated. So for example, a team may begin playing at its own ground, and not
returnthereuntilithasplayedeveryotherteaminitsleagueattheirground,thustheconcept
ofaroadtrip.Obviously,itisinthebestinterestsoftheteamsthattheirroadtripbeasshort
as possible to reduce time spent travelling and increase their training and recovering time
aheadofmatches.
The football leagues in the UK do not have this issue, as the distances between clubs are
typicallyverysmall,relativetothoseoftheUS.Soforthepurposesofourinvestigation,we
willassumethatallteamswillreturntotheirownstadiumafterplayingateamatanaway
venue.Therefore,theoveralldistancetravelledforateamwillbethesameregardlessofthe
sequence in which their matches are played. Our focus will instead be on minimising the
distancetravelledonweekdays,asstatedabove,andassuchwillnotbefollowingtheexact
approachusedbyEaston.
2.4.3–AndrewGoldberg2003
In 2003, as part of their degree, Andrew Goldberg submitted the following thesis on sports
scheduling(Goldberg,2003).TheproblemheattemptedtosolveisthatoftheNewEngland
Small College Athletic Conference (NESCAC) league, which at the time of writing had a very
inefficientschedulingprocess.
The seasons in this league last only 10 weeks with 8 teams taking part (compared with the
PremierLeagueforinstance,whichlastsroughly10monthswith20teams),howevermanyof
theconstraintsaresimilar.Andrewalsotouchesupontheneedtoreducethetraveldistance
inmidweekgames.Hismethodrevolvedaroundtheuseofthegeneticalgorithmstosolvethis
problem.
Due to the relative similarity of the problems faced by the NESCAC and the English football
leagues,thisprojectwillnotbeconsideringgeneticalgorithmsforitssolutionandwillinstead
look at other heuristic methods. This will aim to provide varied insight into the problems
facedbyvariousleagues.
3–InitialTrials
This section will be dedicated to my initial search for a suitable algorithm to utilise as my
heuristic for finding a solution. I decided to test two different algorithms: tabu and
backtracking.Tabuwasconsideredbecauseithasfrequentlybeenusedinsimilarproblems
withdecentresults(seeTTPabove).
Backtrackinghasnotbeenusedasofteninsuchproblems,perhapsduetoitsdifficultywith
dealingwithsoftconstraints,suchasthosepresentinourproject.Nevertheless,itwaschosen
aheadoftabubecausetheproblemmentionedabovecanbedealtwithbyalocalsearchsuch
astheonedescribedbyKendallinhisproject.
Theinitialtestbetweenthetwoalgorithmswastoorganisealeagueforthefollowing4
premierleagueteams:
• ManchesterUnited
• Arsenal
• StokeCity
• NewcastleUnited
Thefollowingconstraintsweretobeapplied:
• Cannotstartorendtheseasonwithtwoconsecutivehomeorawaymatches
• Cannotplaymorethantwoconsecutivehomeorawaymatches
• Playeachteamhomeandawayonce
• Cannotplayateamhomeandawayinthesamehalfofaseason
Below are the descriptions for the implementation of each algorithm and the results each
produced. The algorithm chosen for further development would be decided based on the
speedatwhichasolutionwasreached,aswellastheaccuracy.
Thesolutionsforbothweregeneratedunderthefollowingprinciples:
• Each“week”wasavariable
o Soaseasonof4teamswouldhave(2xno.Teams)–2=6weeks
• Thevalueswerethepermutationsoftheteams
o Aseasonof4teamswouldhave4!=24possiblearrangementsofthematches
• Valueswouldbegenerateduntilapermutationthatcomplieswiththeconstraintson
thenextvariableisfound
Bothimplementationsarebasic,servingonlytoprovideadirectcomparisonintermsofspeed
andperformance.
3.1–TabuAlgorithm
Thepseudocodeforthetabualgorithmsisasfollows:
xNow = createSolution // Create the initial solution
xBest = xNow // The initial solution is the best by default
currentCost = costOfSolution(xNow) // Calculate initial cost
bestCost = currentCost // Initial cost is best by default
tabuList = [ ] // Empty list, soon to contain banned moves
while bestCost != 0: // Cost of solution must be 0, this
represents a solution which fully complies with all constraints
Generate the neighbourhood of the current solution, also
returns the moves made to reach these neighbours of the
current solution
Find the best solution within these neighbours, which also
performs better than the current solution
Add the reverse of the move made to get from the current
solution to the best neighbour to the tabu list
Set the current solution as the best neighbour
If the best neighbour is also has a better cost than the
current best solution, set it as the current best solution
Return xBest
Thealgorithmwassettocreateaseasonfor4teams;thereforeitwouldencompass6“weeks”
–theideaofmidweekgameswillnotbeintroducedyet.Foreachweek,the4teamswillbe
selectedinarandomorder–theonlyrulebeingthatthesameteamdoesnotplaytwiceinthe
sameweek(i.e.eachweek,allteamsplay).
The cost of this solution (as well as any created subsequently) is calculated by searching
throughthesolutionandaddingtothetotalcostforeveryinstancethataconstraintisbroken.
Initiallyitislikelytobeaveryhighnumber,withtheaimbeingtoeventuallyreducethisto
zero.
The neighbourhood of a solution x is defined as being the group of solutions that are one
move away from x. For example, take the following to be a solution and one example
neighbour:
OriginalSolution:
ExampleNeighbour:
1,2,3,4
2,1,3,4
2,3,4,1
2,3,4,1
3,4,1,2
3,4,1,2
4,1,2,3
4,1,2,3
1,2,3,4
1,2,3,4
2, 3, 4, 1
2, 3, 4, 1
Takenotethatthefirstweekhasbeenchangedfrom(1,2,3,4)to(2,1,3,4).Itcanbeseen
that the neighbours of each week are produced from making one change (i.e. swapping any
twonumbers).Thisequatesto(4–1)!=6possiblechangestomakeforeachweek,totallingin
6*6=36potentialneighboursforeachsolution.Forseasonsofhighernumberofteamsthis
increasesveryquickly(6teams;120possibilities,8teams;5040etc)Eachtimeaneighbouris
found,thechangemadetocreatethatneighbourwillbetracked,justincaseitistobeadded
tothetabulistlaterinthealgorithm.
Determining the best neighbour is a simple task of looping through neighbours – after they
haveeachhadtheircostevaluated–andtrackingwhicheverhasthelowestcost.Neighbours
that have been reached using a move currently on the tabu list cannot be used; with the
exceptionofonethatexceedsthecurrentbestsolution(i.e.hasalowercost).Thisexceptionis
allowedtopreventthealgorithmfromstagnatingatalocaloptimum.
Thechosenneighbour’smoveisthenaddedtothetabulistandtheprocessisrepeated.This
continuesuntilaneighbourisfoundsuchthatitscostis0,indicatingthatnoconstraintshave
beenbroken.
3.2–BacktrackingAlgorithm
Where the tabu algorithm created many solutions, the backtracking algorithm only creates
one(beginningfromanemptylist),addingandremovingvariableswhereneededinorderto
create a solution which complies with the constraints. The general layout of the initial
algorithmusedisasfollows:
calendar = createCalendar // calendar would be an empty list
fixtures = generateFixtures(calendar)
generateFixtures(calendar):
Check if calendar is complete by checking how many variables
have has values assigned
While teamsPlaying != numberTeams:
Use roulette wheel to assign teams to matches based on
how many matches they have already played
Once all teams are playing in this week, assign the week to a
variable in the calendar
Check constraints of the calendar in its current state
If successful:
Call generateFixtures with the current calendar and
updated variables
If unsuccessful:
If number of times this stage has been unsuccessful is
20:
Assume it’s a dead end and go back an extra
iteration, also using recursion
Else:
Recall generateFixtures with original calendar and
variables
Return calendar
Thekeydifferencebetweenthetwoalgorithmsisthatthetabualgorithmisiterative,whereas
backtracking is recursive. It is possible to implement a completely iterative backtracking
algorithm, however, in this version; the generateFixtures method calls itself when it is
successfulandwhenitisunsuccessful.
Teamsareassignedtomatchesusingtheroulettewheelimplementation.Thebasicideaisas
follows:thenumberofmatcheseachteamhasplayedsofaristracked,andthefewergamesa
teamhasplayed,themorelikelyitistobechosenforamatch.Soforexample,ifthenumber
ofmatchesstandsat[3,3,3,4](bearinginmindthemaxnumberofmatchesateamcanplay
is6inaseasonwith4teams)thenthenumberofmatchesremainingforeachteamwouldbe
[3,3,3,2]fortheteamsinorder[1,2,3,4].Inordertoreplicatetheideaofaroulettewheel,
we would create a list with the team name/number as the elements; however each team
wouldberepeatedbthenumberofmatchesithaslefttoplay,sointhisexamplethatwould
be[1,1,1,2,2,2,3,3,3,4,4].Then,ateamisrandomlypickedfromthislist–thusensuring
thatateamthathasalreadyplayedmorematcheswillbelesslikelytobepicked.
Theroulettewheelideausedabovewouldbeveryusefulinafullimplementationofatypical
football season, as these typically have midweek games due to the sheer number of
constraintsplacedonteams(bothinternallyandexternally).Itisnownotuncommontosee
teams in the league who have played more matches than other teams due to other
competitions taking place. In the case of the 4-team season however, it is not particularly
effective as all teams are guaranteed to play each week, due to the problem setup and the
reducednumberofconstraints.
One clear issue with this algorithm however is how often recursion is called. Typically,
recursionisonlycalledwhenasuccessfulvalueforthevariableinquestionisfound.Inthis
version of the algorithm that is not the case; recursion is called when either a successful or
unsuccessful value is found. Aside from decreasing performance ability, this also conflicted
withtherecursiondepthlimit.InPython,thisvalueissetto1000,afterwhichtheprogram
crashes.Withaseasonof4teamsthiswasnotanissue,howeveritquicklybecamesuchfor
seasonswithahighernumberofteams.
3.3–ResultsandDecision
Theresultsforbothalgorithmswereasfollows:
• Tabu
NumberofTeams
TimeTaken(milliseconds)
NumberofIncompleteSolutions
4
93.09274911880493
2
6
1150.0133895874023
0
8
N/A–Unabletoreachsolution
N/A
•
Backtracking
NumberofTeams
TimeTaken(milliseconds)
4
18.01896095275879
6
N/A–RecursionDepthError
8
N/A–RecursionDepthError
As is clear from the results, the calculated from the average run time of 100 run-throughs,
backtracking returns results faster than Tabu, in the case of 4 teams. In addition to being
faster, backtracking also guarantees a successful solution, whereas this implementation of
Tabudoesnot.
Tabucanoccasionallyrunintotroublefindingasolutionwithoutanybrokenconstraints.Due
tothis,theresultgivenaboveincludestherunswherenoapplicablesolutionwasfound.As
we are ultimately searching for an algorithm that produces a solution with no broken
constraints,thedecisionwasmadetocontinuedevelopmentonthebacktrackingalgorithm.
The task now would be to improve its efficiency in order to cope with larger numbers of
teams in a season, with the added help of the degree and minimum remaining values
heuristics.
4–DevelopingMainAlgorithm
Throughouttheupcomingsection,thekeystagesoftheimplementationofthebacktracking
algorithmwillbediscussed,includingwhatactionsweretakentoimproveperformancesand
the reasoning behind it. Full details of the algorithms will not be provided here, however a
morespecificdescriptionofthefinaliterationcanbefoundbelow.
4.1–GeneralImprovements
4.1.1–ReducingRecursionCalls
In this iteration, there were several major changes to the algorithm without actually
introducinganyoftheheuristicsmentionedabove.Onesuchchangewastosolvetheissuein
theinitialalgorithmdescribedabove–theexcessiverecursioncalls.Theproblemspecifically
being that recursion was used both when the algorithm succeeded and when it failed; this
quicklyledtotheprogramexceedingtherecursionlimitofPython.Itispossibletooverride
thislimit,howeveritisnotconsideredbestpracticeandwouldbesidesteppinganissuethat
would only present itself more in seasons with a greater number of teams than the initial
testingvalueof4.
Withthisismind,thefirstimprovementmadewastoremovetherecursionfromtheareaof
thecodewhereavariableassignmentfailed;insteadthiswouldbecomeiterative,thusgreatly
reducingthenumberoftimesrecursioniscalledoverall.Thisallowedtheprogramtoreacha
solutionbeforeexceedingthebefore-mentionedlimit.
4.1.2–Reformatting
Anotherchangewastoreformathowthesolutionwaspresented.Originally,thesolutionwas
presentedasfollowsfora4-teamseason:
[['StokeCity-Arsenal','ManchesterUnited-NewcastleUnited'],['NewcastleUnited-StokeCity',
'Arsenal-ManchesterUnited'],['NewcastleUnited-Arsenal','ManchesterUnited-StokeCity'],
['StokeCity-ManchesterUnited','Arsenal-NewcastleUnited'],['ManchesterUnited-Arsenal',
'StokeCity-NewcastleUnited'],['NewcastleUnited-ManchesterUnited','Arsenal-StokeCity']]
As described above, each variable was a week, rather than just a team, so in the example
shownaboveaweekwouldbe:
['StokeCity-Arsenal','ManchesterUnited-NewcastleUnited']
In this format it would be difficult to change the teams in the variable, as each variable is
createdasapermutationofthe4teams.Thealgorithmwouldhavetosearchthoughtheother
4!–1=23possibilitiestofindonethatwouldwork.Thenewformatwouldbeasfollows:
[ManchesterUnited,NewcastleUnited,Arsenal,StokeCity]
[NewcastleUnited,Arsenal,StokeCity,ManchesterUnited]
[ManchesterUnited,NewcastleUnited,Arsenal,StokeCity]
[ManchesterUnited,Arsenal,StokeCity,NewcastleUnited]
[NewcastleUnited,Arsenal,StokeCity,ManchesterUnited]
[ManchesterUnited,NewcastleUnited,Arsenal,StokeCity]
Here,theteaminthe1stpositionisdesignatedasplayingathomeagainsttheteaminthe2nd
position and so on and so forth. The variables are now the teams themselves, allowing for
easier manipulation of the values as there are only 4 possibilities for each variable, rather
thantheprevious24.
4.1.3–PermutationSelection
Despitethischangeinformatting,forthisiterationthevariableswerestillconsideredtobe
theweeksratherthantheteams.Sopermutationsstillhastobecreatedtofilleachvariable.
Tomakethismorereliablethansimplegeneratingonepermutationatatimeandhopingit
fits, a fixed number of candidate random permutations were created for each variable. For
eachofthesevalues,afurtherfixednumberofrandompermutationsweregenerated.
Thepermutationassignedtothevariablewouldbedecidedasfollows:
1. Assignthecandidatepermutationtothenextvariable
2. Tothesubsequentvariable,assigneachofthecandidate’srandompermutations,
trackingthenumberofthesethatfailanyconstraints
3. Onceallofthecandidate’srandompermutationshavebeenchecked,returntostep
one,beginningwithanewcandidatepermutation
4. Onceallcandidatepermutationshavebeenchecked,assigntheonethatruledoutthe
lowestnumberoffurtherpermutations
Thiswasanearlyattempttomimictheeffectsoftheleastconstrainingvalueheuristic,though
it was not as effect as a fully functioning effort. The reason for this is that, ultimately, the
season will contain 20 teams and the number of permutations of this many clubs is 20! =
2.432902e+18. This is far too high a number for any algorithm to efficiently run through.
Henceonlyafixednumberofpermutationsweregeneratedateachstep.
This raises a flaw with this design; it is impossible to generate a specific permutation in
Python,shortofmanuallycreatingit.Therefore,atthefinalvariablethepossibilityexiststhat
therewillbeoneremainingpermutationthatdoesnotbreakanyoftheconstraints,andyet
the permutation generator may not find it immediately due to the randomness of the
generation.
4.1.4–TrackChanges
One final change that was implemented in this iteration was the introduction of tracking.
Here, once a permutation was found to not break any constraints and was assigned to the
requiredvariable,allofthematchesthatitcontainedwereaddedtoalistinthecode.Oneof
theeasiestconstraintstocheckinthiscodeistoensurethatamatchisneverrepeatedduring
theentireseason.Inotherwords,onceapermutationhasbeenassignedwhichcontainsthe
match ‘Manchester United vs. Arsenal’ for example, no other permutation can contain that
match. They could, however, include the reverse fixture ‘Arsenal vs. Manchester United’,
assumingthathasn’talreadybeenincludedelsewhere.
The effect of this is that when generating random permutations as described above, any
which contain any matches on this list are immediately disregarded, as they clearly break
constraints and would not be suitable as a value. Long term into the algorithm, this should
helpspeeduptheprocessofchoosingavalueforeachvariable,howevertheissuedescribed
at the end of the ‘Permutation Selection’ section will slow progress down significantly
regardlessofthistracking,especiallywithhighernumbersofteams.
4.1.5–PseudoCode
Theabovealterationsallresultedinthefollowingpseudocode:
Create empty calendar
Call generateFixtures function to start algorithm
GenerateFixtures (calendar):
While successful permutation is not found:
If no successful permutation has been found:
Return to previous successful state
Generate more permutations
Select permutation with most promising results when
placed into season and checked against constraints
Store successful parameters in case a return to them in
required
If not all variables have values assigned to them:
Recursively call generateFixtures with updated calendar
If all variables have been assigned values:
Return final calendar and end algorithm
4.1.6–Results
The above iteration was run for seasons of 4, 6 and 8 teams, for comparison to the initial
backtrackingalgorithm.Theresultswereasfollows:
NumberofTeams TimeTaken(milliseconds)
4
39.07046318054199
6
2474.893045425415
8
233685.7030391693
Asisevidentfromthetableabove,thisiterationactuallyperformedworsethantheprevious
attempt. The use of randomly generated permutations may have caused the algorithm be
computationallyinferior.Thiswillbetargetedinthenextiterationofthealgorithm.
4.2–ForwardChecking
Due to the severe problems caused by searching permutation spaces in the last iteration, a
formatting revamp was required to help progress the project. The following solution was
devised:
SeasonMatrix:
[0,0,0,0]
[0,0,0,0]
[0,0,0,0]
[0,0,0,0]
[0,0,0,0]
[0,0,0,0]
PossibilitiesMatrix:
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
[[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]
Firstconsidertheseasonmatrix.Here,every0representsanunassignedvariable.Soinstead
oftheentireweek(rowofthematrix)beingthevariables,eachslotwhereateamcouldbe
placedis,andtheindividualteamsnowbecomethevalues.AsisthestandardinPython,the
firstelementinarow(whichiscodedasalistinPython)isgiventhe0index,theoneafter
beingthe1stindex,then2ndandsoon.Usingthisrule,anyteamthatisplacedinanevenindex
(e.g. 0, 2, 4 etc.) will be considered playing at home. The team in the immediately following
oddindexwillbetheclubdesignatedasplayingawayinthatfixture.
The possibilities matrix is the new addition to this solution. This matrix has the same
dimensions as the solution matrix, except that it contains lists that detail the remaining
possiblevaluesforeachoftheunassignedvariables.Atthebeginningofthealgorithm,every
variable could have any of the teams assigned to it. As the algorithm makes more progress
however,thesepossibilitieswillbereduced.
In this iteration, the variables are not chosen through any special methods, it simply begins
addingvaluesatthefirstavailableslotinthefirstrow,movingontothenextrowonceevery
placeintherowhasbeensuccessfullyassigned.Everytimeavalueisassigned,anyvariables
that affect by this change have their possible remaining values lists updated by a process
knownasforwardchecking.
Akeyaspectofconstraintsatisfactionproblemsisthateveryvariablehasanassigned,legal
valueforthesolution.Sowhensearchingforsuchasolution,itcanhelptoconstantlycheck
thatavalueassignedtoavariabledoesnotbreakanyconstraintsandthatapossiblesolution
canstillbeattained.
The idea of forward checking is to keep track of the remaining possible values for every
variable in the solution. Each time a value is assigned to a variable, all of that variable’s
constrainingneighbours’domainsareupdatedbyremovinganypossiblevaluesthatarenow
invalid.Withoutthisheuristic,thefollowingisnormallywhathappens:
X
Y
{1}
{1,2}
Xisassignedthevalueof1,asthatistheonlyoneremaininginitsdomain.ThedomainofY
remainsthesamehowever,sowhenavalueischosenforY,1isstillanoption,despitehaving
alreadybeenchosenforX:
X=1
Y
{}
{1,2}
If1isindeedpickedforY,thenaconstraintisbrokenandanothervaluemustbetried,inthis
casethatwouldbe2,whichbreaksnoconstraints.Usingforwardcheckingontheotherhand,
thesolutionwouldbearrivedatmuchfaster.When1isassignedtoX,itisalsoremovedfrom
thedomainofY,leavingthestatesofthevariablesasfollows:
X=1
Y
{}
{2}
AsYonlyhas2asapossiblevalue,itisassignedassuch,thusavalidsolutionisreached:
X=1
Y=2
{}
{}
As a direct result of this action, future assignments of values are safe from breaking any
constraints. The only error that can be encountered, assuming correct implementation, is
whenasaresultofforwardcheckinganunassignedvariable’sdomainisempty.Inthiscase,
anerroneousassignmenthasbeenmadeatanearliervariable.Forexample:
X
{2,3,4}
Y
Z
{2}
{2,4}
Supposeinthisexamplethevalue2isassignedtoX.Thestateswouldbeasfollows:
X=2
{}
Y
Z
{}
{4}
NotehowthedomainofYisnowempty,despitenothavingbeenassignedanyvalues.Clearly,
assigning X the value 2 was an incorrect decision, so a different value can be chosen here
instead.Itispossibletoreducethelikelihoodofencounteringthisissuebyusingaseparate
heuristic.
4.2.1–PseudoCode
Create empty calendar
Create tracker matrix, which stores all the possibilities of each
variable
Call generateFixtures function to start algorithm
GenerateFixtures (calendar):
Create lists to track each of the following: successful
seasons, successful tracker matrices and successful coordinates of
new variable assignments
While true:
Determine which variables in the current state of the
season are still unassigned
If there are no remaining unassigned variables, accept
this as the final solution and end the algorithm
Randomly choose the next variable to assign a value to
from the list of unassigned variables
Randomly choose the value to assign to the chosen
variable, selected from the list of possibilities found
in the tracker matrix
Update the tracker matrix, using Forward Checking to
eliminate any values from other unassigned variables
that are part of a conflicting constraint
Check that the Forward Checking heuristic has not left
any unassigned variables with no remaining possible
values
If successful:
Add the successful season, tracker and coordinates
to the tracking lists
Else:
Backtracking aspect occurs here
Find last successful season, tracker matrix and
coordinates
While a suitable season to backtrack to has not
been found:
Find erroneous element added to create latest
version of season
Remove this from the options in the previous
season's tracker matrix for that slot
This will prevent the same mistake from
occurring in the future
If there are options left in the slot in the
tracker then this season is considered
suitable:
Set them up for the next iteration of the
algorithm
Break from the while loop
Else:
Set this season and its tracker as failed
and repeat the process
4.2.2–Results
Delete the last successful states
NumberofTeams TimeTaken(milliseconds)
4
44.16069984436035
6
4353.552293777466
8
1905337.6791477203
Theresultshereshowaslightdeclineinspeedsincethelastiteration.Asefficiencyisshown
inlaterimplementationstoactuallyimprove,theseresultsaremostlikelyduetothefactthat
thisalgorithmisquiteanaïveeffort,lackinginanyrealsophisticatedheuristics.
Anotherfactorisduetoanerrorthatwillbediscussedinsection4.4.1,thefaultybacktracking
aspectofthisformat.Thiswillhaveundoubtedlyimpactedonthissetofresultsandthenext.
4.3–MinimumRemainingValueHeuristic
The next change was to implement the Minimum Remaining Value heuristic, which is
designedtoassistthealgorithmindecidingwhichvariablewillnextbeassignedavalue.The
minimumremainingvalueheuristic(MRV)isdesignedtomakethealgorithmchoosethenext
variablebasedonthenumberofvaluesithasremaining.So,refertothefollowingexample:
X
{2,3,4}
Y
Z
{2}
{2,4}
Mostnaïveimplementations,includingtheoneusedintheinitialtestingphaseabove,would
choosetoassignavaluetoX,beforemovingontoYandZ.UsingtheMRV,thefirstvariableto
haveavalueassignedwouldbeYasitonlyhasonepossibilityremaining.
Theadvantageofmakingsuchamoveisnotnecessarilythatonewillalwaysfindthecorrect
solution straight away; it is more that an invalid solution will be identified faster, if indeed
this choice does lead to such an answer. It can be seen above for instance, that using MRV
wouldleadtoassigningthevalue2tovariableY.Forwardcheckingwouldthenremovethe
valuesof2frombothXandZ,leavingtheirdomainstobe{3,4}and{4}respectively:
X
{3,4}
Y=2
Z
{}
{4}
ThenbyutilisingMRVagain4isassignedtoZ,forwardcheckingremoves4fromthepossible
valuesofX:
X
{3}
Y=2
Z=4
{}
{}
Xthenonlyhasoneremainingpossiblevalueinitsdomain,3:
X=3
{}
Y=2
Z=4
{}
{}
Thisistheonlysetofresultsthatworksinthiscase,andnotehowitwasachievedwithoutthe
needtobacktrackbecauseofanyerrors.However,whatwouldhappeninthecasewheretwo
variableshaveanequallylownumberofvalueslefttochoosefrom?Forexample:
W
X
{1,2}
{1,2,3,4}
Y
Z
{2}
{2,4}
Usingthemethodsdescribedabove,thenextstateofthevariableswouldbe:
W
X
{1}
{1,3,4}
Y=2
Z
{}
{4}
Inthiscase,bothWandZhaveonevalueremaining,thereforearebothviableoptionsforthe
next variable to be assigned a value. How can an algorithm decide which one is more
promising, more likely to reach a successful solution? Implementing another heuristic will
helpprovidethoseanswers.
4.3.1–PseudoCode
Create empty calendar
Create tracker matrix, which stores all the possibilities of each
variable
Call generateFixtures function to start algorithm
GenerateFixtures (calendar):
Create lists to track each of the following: successful
seasons, successful tracker matrices and successful coordinates of
new variable assignments
While true:
If this is the first variable to be assigned:
Randomly select variable to assign a value to
Else:
Find most constrained variables
If there are multiple variables tied on the number
of values remaining they have, randomly select one
of them
Otherwise, just choose the variable that is
returned
Randomly choose the value to assign to the chosen
variable, selected from the list of possibilities found
in the tracker matrix
Update the tracker matrix, using Forward Checking to
eliminate any values from other unassigned variables
that are part of a conflicting constraint
Check that the Forward Checking heuristic has not left
any unassigned variables with no remaining possible
values
If successful:
Add the successful season, tracker and coordinates
to the tracking lists
Else:
Backtracking aspect occurs here
Find last successful season, tracker matrix and
coordinates
While a suitable season to backtrack to has not
been found:
Find erroneous element added to create latest
version of season
Remove this from the options in the previous
season's tracker matrix for that slot
This will prevent the same mistake from
occurring in the future
If there are options left in the slot in the
tracker then this season is considered
suitable:
Set them up for the next iteration of the
algorithm
Break from the while loop
Else:
Set this season and its tracker as failed
and repeat the process
Delete the last successful states
MostConstrainedVariable:
Keep track of the variables with the fewest remaining values
possible left
Check every unassigned variable in the current season,
tracking those that have the minimum number of possible
values remaining
Return the result of this search
4.3.2–Results
NumberofTeams TimeTaken(milliseconds)
4
44.328134059906006
6
9458.876795239999
8
2934233.65614472819
ResultshavenotimprovedwiththeadditionoftheMRV.Thisismostlikelynowtobedueto
thebacktrackingissuethatwillbedealtwithinthenextiterationofthisalgorithm.
4.4–DegreeHeuristic
This iteration introduced the degree heuristic. The degree heuristic chooses the variable
involved in the largest number of constraints with other unassigned variables. When used
correctly, this heuristic can reduce the branching factor on future choices, because if each
variable chosen is involved with a high number of constraints with other unassigned
variables, then as a result, that high number of variables will suddenly have fewer possible
valuesintheirdomains.
Takethesame4variablesasabove,onlythistime,saythatWdoesnothaveaconstraintwith
X,butZdoes.Therefore,Wisonlyinvolvedin1constraintwithanotherunassignedvariable
(Z)butZisinvolvedwith2(WandX).AsZisinvolvedinagreaternumber,itischosentobe
thenextvariable:
W
X
{1}
{1,3}
Y=2
Z=4
{}
{}
Then the algorithm can continue as before, with W being assigned 1 and X can now be
assigned either 1 or 3. This holds true because it was stated above that W does not have a
constraintwithX,thereforethevalueofXdoesnotimpactonthechoiceforthevalueofW
andviceversa.
Even with this heuristic applied, there is still one decision that can sometimes be random.
Whichvaluefromthechosenvariableshouldbeassigned?Takethefollowingexample:
X
{1,2,3}
Y
Z
{1,4}
{1,2,3,4}
Yclearlyhasthefewestnumberofvaluesremaininginitsdomain,sobytheMRVheuristic
thisshouldbethevariabletowhichavalueisassigned.However,thereisstillachoicetobe
madeoverwhichvalueisassigned.
4.4.1–BacktrackingIssue
During the programming of this iteration, a problem was encountered when coding the
backtrackingaspectwiththenewformatting.Theissuestemmedfromthefactthattherewas
no longer any recursion – the algorithm was now totally iterative. As a result, a memory
structure was designed to store all the previous states of the season so that if a variable
assignment failed, the algorithm could return to a previous successful state in order to
continue.
Theissuespecificallywasthatthealgorithmwasunabletobacktrackfurtherthanonestep.
Forexample,saythatthealgorithmreachedaspecificnodethatonlyhadonepossiblevalue
left,butassigningthisvaluemeantthatanotherunassignedvariablenolongerhadanyviable
valuesleft.Takethefollowingtobeasectionofatree:
X
{1}
Y
{1}
Sohere,Xisgiventhevalueof1,andbyforwardcheckingthisremoves1fromthepossible
valuesofY,meaningithasnopossibilitiesremaining.ThusX=1isnotasuitableassignment
for X, so it is also removed from the possible values of X. This however, leaves X with no
remaining possibilities. In practice, the algorithm should then move back to the previous
node, returning the possible values of X and Y to their last successful states – however the
algorithmwasunabletomakethiskeystepduetoabugintheprogram.
Thisproblemwasfixedbeforeworkonthenextiterationbegan,butprogresswasseriously
delayedbythisunexpectedissueasexcessiveamountsoftimewasspentsolvingtheissue.
4.4.2–PseudoCode
Create empty calendar
Create tracker matrix, which stores all the possibilities of each
variable
Call generateFixtures function to start algorithm
GenerateFixtures (calendar):
Create lists to track each of the following: successful
seasons, successful tracker matrices and successful coordinates of
new variable assignments
While true:
Find most constrained variables in the current season
If there is more than one variable with an equally low
number of values remaining:
Use the degree heuristic to determine which value
to choose
Else if there exists a variable with the lowest number
of possible values remaining, choose this one
Randomly choose the value to assign to the chosen
variable, selected from the list of possibilities found
in the tracker matrix
Update the tracker matrix, using Forward Checking to
eliminate any values from other unassigned variables
that are part of a conflicting constraint
Check that the Forward Checking heuristic has not left
any unassigned variables with no remaining possible
values
If successful:
Add the successful season, tracker and coordinates
to the tracking lists
Else:
Backtracking aspect occurs here
Find last successful season, tracker matrix and
coordinates
Find erroneous element added to create latest
version of season
Remove this from the options in the previous
season's tracker matrix for that slot
If there are options left for the variable in the
tracker then this season is considered suitable:
Set up values for next iteration of the
algorithm
Else if there are no options left, set the last
successful season and its tracker as failed:
While a suitable season to backtrack to has
not been found:
Find erroneous element added to create
latest version of season
Remove this from the options in the
previous season's tracker matrix for that
slot
If there are options left in the slot in
the tracker then this season is
considered suitable:
Set them up for the next iteration
of the algorithm
Delete last successful season,
tracker and coordinates from saved
list
Break from the while loop
Else:
Set this season and its tracker as
failed and repeat the process
Delete last successful season,
tracker and coordinates from saved
list
Degree Heuristic Function:
Use same format of function as when used to eliminate
constraining values in other unassigned variables
Instead of deleting value however, simply track how many
variables would have been affected and use this to determine
which variable of the options given is involved in the
largest number of constraints
4.4.3–Results
NumberofTeams TimeTaken(milliseconds)
4
5.731773376464844
6
2567.334794998169
8
3336621.0539340973
The addition of the degree heuristic vastly improves the performance of the 4 and 6-team
seasons,aswouldbeexpected–thisiterationcombinesthisheuristicwithMRV.However,the
8-team season actually performs worse than expected, though it can be seen later that the
implementationofanotherheuristicsolvesthisissue.
4.5–LeastConstrainingValueHeuristic
The final change made was to implement the least constraining value heuristic. Once the
degree heuristic has run its course, there is still a decision to be made on which value to
assign to the variable. Here, the least constraining value is the one chosen i.e. the one that
rulesoutthefewestvaluesintheremainingunassignedvariables.
Return to the three variables in the example above; with the other heuristics in place, Y is
obviously the variable that will have the next value assigned to it. The only question is
whethertochoose1or4.Choosing1willruleoutavalueinbothXandZ,whereasassigning4
willonlyruleoutonefromZ.Basedonthislogic,4isthevaluetobeassigned.
The reason for this decision is that it leaves maximum flexibility for a solution. Over the
course of the entire solution, as many possible remaining values as possible will remain,
hencetheincreasedflexibility.
4.5.1–PseudoCode
Least Constraining Value Heuristic Function:
Use same format of function as when used to eliminate
constraining values in other unassigned variables
Instead of deleting value however, simply count how many
values would have been eliminated and use this to determine
which of the possible remaining values in the variable chosen
will result in the fewest number of values in other
unassigned variables being eliminated
4.5.2–Results
NumberofTeams TimeTaken(milliseconds)
4
5.199885368347168
6
112537.4176979065
8
89.54010009765625
The results here are very mixed. The 4-team season has seen no change from the previous
iteration,indicatingthatthisisalreadyanoptimaltimeforaseasonofthissize.Thegreatest
alteration in results comes with seasons with 6 and 8. Surprisingly the 6-team season
performed much worse than in any of the previous iterations, yet the 8-team season
surpassedallpreviousiterationscompletely.
5–ResultsandEvaluation
5.1–Results
After the promising results found in the last iteration of the backtracking algorithm, it was
decidedtorunthecodeoverlargerseasonstoviewtheresults.Duetotherandomnessofthe
algorithmatcertainstages,thetestswererunasdescribed:eachsetbeingrun10timesand
the total run-time then being divided by 10 to reach an average time. For example, even
though the least constraining value heuristic narrows down the options in the remaining
possiblevaluesofavariabletotheonesthateliminatethefewestnumberoftheconstraining
values,thiscanstillleavethealgorithmwithmorethan1option.Atthisstage,asthereareno
moreheuristicstonarrowdowntheoptions,thechoicebecomesrandom–i.e.eachoutputof
thealgorithmcanbecompletelydifferentandthereforetakedifferentlengthsoftime.
NumberofTeams
TimeTaken(milliseconds)
4
5.199885368347168
6
112537.4176979065
8
89.54010009765625
10
272.85428047180176
12
N/A–Couldnotfindsolution
14
N/A–Couldnotfindsolution
16
1407.730221748352
18
N/A–Couldnotfindsolution
20
N/A–Couldnotfindsolution
Time Taken (milliseconds) to
Reach Solution at Different Sizes
of Season
120000
100000
80000
60000
40000
20000
0
0
5
10
15
20
25
These sets of results are very mixed. For the first time, a season of 16 teams was run to
completionsuccessfully,evenexcellingthoseforsmallerseasonsinearlieriterations.The10teamseasonwasalsosuccessfullyreturnedasolutioninaveryshortamountoftime.
Despitethesepromisingresults,theseasonsofsize12,14,18and20wereunabletoproduce
any viable results i.e. the code was left to run for extended periods of time (extended here
meaning 12hrs+) without returning anything. The potential reasoning for this will be
discussedinthefollowingsection.
The graph above clearly illustrates that the point representing the 6-team season is an
anomaly.Therestofthepointsseemtofollowarelativelysimilarpath,asillustratedbythe
graphbelow,excludingtheseasonwith6teams:
Time Taken (Milliseconds) to
Reach Solution at Different Sizes
of Season
5000
y = 0.019x4.0811
4000
R² = 0.99736
3000
2000
1000
0
0
5
10
15
20
25
Ascanbeseenabove,evenwiththemissingdatapoints,thereisacleartrendinthegraph.
Using Microsoft Excel’s tool for adding trend-lines to graphs, it is seen that the estimated
equation of this line is𝑦 = 0.019𝑥 !.!"## . It should be noted however that this is only an
estimation,andwillmostlikelychangewiththeadditionofmoredata.
5.2–Evaluation
It was shown that the algorithm worked as intended by showing the output every time a
variable had an output assigned. By following this output, it is relatively easy to follow the
algorithm’sprogress–includingwhenbacktrackingoccurs.
Asthefollowinggraphsshow,theperformanceofthebacktrackingalgorithmwhensearching
fora4-team,6-teamand8-teamperformancewasimpactedbythechangesmadeateachof
theiterations.
Time Taken (milliseconds) TO
Find a Solution For a 4-Team
Season
50
40
30
20
10
0
1
2
3
4
5
Forthefirstthreeiterations,theefficiencyactuallydecreased,butwhenthedegreeandleast
constraining value heuristics were introduced performance improved drastically. This
indicates that while the heuristics are effective, they become more so when used as a
combination.
Time Taken (milliseconds) TO
Find a Solution For a 6-Team
Season
120000
100000
80000
60000
40000
20000
0
1
2
3
4
5
Theearlyiterations’performancesarerepeatedfortheseasonwith6teams–thetimetaken
to find a solution actually increases, but the combination of the MRV and degree heuristic
reducesthisagain.Theanomalousresultwithallthreeheuristicsdoesnotallowforaneasy
comparisonwithanyotherresults,howeveritdoesindicate–aswillbediscussedlater–that
thereisanunderlyingissuewiththealgorithm.
Time Taken (milliseconds) TO
Find a Solution For a 8-Team
Season
4000000
3000000
2000000
1000000
0
1
2
3
4
5
Thisgraphfollowsthesamegeneraltrendthatcanbeseeninthegraphsforthe4-teamand6team graphs, the only exception being the 4th iteration that was introduced the degree
heuristic. It actually worsened the performance even further than before. Despite this
anomaly, the implementation of the least constraining heuristic (5th iteration) improved the
performancedrastically.
There is a strong confidence that these results are correct, and are not the product of any
erroneoustesting.Howeverthespecificreasoningandconditionsfortheseresultscannotbe
determined,thusitisnotpossibletoconfidentlypredictwhattheresultswouldbeataseason
ofsize20.ThisnumberofteamsiskeyasitisthenumberofteamsinthePremierLeague,one
of the leagues involved in the objectives. Further testing must be completed in order to
determine what the cause of these seemingly random failed results are. What cannot be
deniedhowever,isthatthereisamarkedimprovementin4ofthe5setswhereresulthave
beenfound–indicatingthattheadditiontothelastiterationimprovedtheefficiency of the
overallalgorithm.
5.3–DiscussionofResultsIssue
Despitetestingseveraltimesatseasonsofsize12,14,18and20,therehasbeennoindication
astowhythealgorithmdoesnotproduceasolution,orwhythe6-teamseasonperformsso
poorly.Thissectionwillaimtodiscussthevariouspossiblereasonsforthisissue,evaluating
eachoneandexploringoptionsforfixingit.
5.3.1–TooConstrained
Onepossiblereasonfortheseresultsisthatthealgorithmissimplytooconstraining.Thisis
one of the downsides of the backtracking algorithm – it will only return a solution that
perfectlycomplieswithallconstraintsplaceduponit.
Thefinaliterationoftheprogramonlyencompasses4constraints,outofthefulllistprovided
atthetopofthereport;thebeliefbeingthatonlyhavingthissmallnumberwouldallowthe
algorithmsufficientflexibilitytoreachasolution.Itmaybe–forseasonsofcertainsizes,that
there simply exists no solution with all these constraints placed upon them, and that they
shouldberelaxedinorderforasolutiontobefound.
Totestthis,theseasonwith6teamswasrunagain,onlythistimetheconstraintstatingthat
teams cannot play more than two matches in a row at home was removed. A solution was
reachedfasterthanpreviouslyrecordedat6350.93092918396milliseconds,althoughthisis
stillmuchlessefficientthantheiterationbeforeit,andalsostillmuchslowerthantheresults
fortheseasonsofsize4,8,10and16.Thisseemstoindicatethatover-constrainingmaynot
be the primary issue here, though it certainly looks to be a factor as evident by the lack of
progresswhentestingthiswithseasonsofsize12,14,18and20.
Ifthisisindeedthecaseasstatedabove,thenitmaysimplybeacasethatthereisnosolution
availableforthelargersetsofteams.Ifthatistrue,thennothingcanbedoneexcepttorelax
therulesandtrytosatisfythemascloselyaspossibleusingasmaller,localsearch,oncethe
backtracking algorithm has run to completion. The only piece of evidence against this
reasoningisthatthealgorithmseeminglyoperatesperfectlyforthe16-teamsseason,perhaps
indicatingthatcertainsizesofseasonhavesolutions,whereasotherssimplydonot.
5.3.2–BuginCode
Abugintheprogramiscertainlyapossiblereasonforwhynosolutionswerefound,though
the data dump from running the 6-team season (Appendix A), seems to show that the
algorithmworkedasexpectedthroughout.However,duetothecomplexityoftheconstraints,
it is entirely possible that a bug does exist and that due to the sheer size of the data it was
missed.
If this is the case, then the best way of locating the bug is perhaps to generate a separate
program to check through each stage of the data dump, searching for any violation of a
constraintthatwasnotpickedup.Itcouldevenlocateaninstancewhereapossiblevaluefora
constraining variable was erroneously removed, thereby eliminating a section of the search
treewhichjusthappenedtocontainthesolutiontotheproblem.Aprogramwouldperhapsbe
bestforthissearchbecause,asstatedbefore,thehumaneyecanfinditverydifficulttofollow
alloftheconstraintsateachstep.
5.4–AchievementofGoals
Thegoalssetatthebeginningattheprojectwereasfollows:
1. Minimaldistancetravelledinleaguematchesduringweekdays–withminimalnumber
ofderbymatchesduringweekdays
2. Minimaltimetakentoreachsolution–timetakennowisreportedly5-10minutesper
league
3. Minimalnumberofconstraintsbroken–ideallythereshouldbezeroconstraints
broken,howeverwiththedesirablecriteriathisisreportedtobedifficultinpractice,
withallconstraintsinplace
Objective1wasclearlynotmet.Thisisduetoitbeinganover-ambitiousaimaswellasthe
difficulty that was encountered when dealing with the unforeseen issues with the coding.
Perhaps in the future this could be implemented, though this would first require the week
beingrepresentedinfull(i.e.weekdaysandweekends,ratherthanasjustonelist).
Objective2ismoredifficulttodeterminewhetherornotitwasasuccessorfailure.Clearly
the results indicate that the efficiency of the algorithm has improved immensely over the
recorded iterations. However, the lack of results for a season of 20 teams means that it is
impossibletocomparethetimetakentoproducealeagueofthatsizetotheofficialstandards
of5-10minutes.
Objective3wasachieved,thoughthiswaswithareducednumberofconstraints.Someofthe
constraintscouldonlybeachievediftherewasafullyrepresentedweek(containingalldays
oftheweek,notjustmatchdays)–thelackofthisseverelyrestrictedthepossibleconstraints.
Itcannotyetbedeterminedwhetherornotthealgorithmwouldworkwithallconstraintsin
place as is required in practice, yet early indications suggest this could be possible, with
furthertestsrequired.
6–FutureWork
Due to unforeseen issues and ambitious project aims, many ideas for implementation were
not achieved throughout the duration of this project, due to the complexity of the large
amount of constraints required. However, I believe they are achievable and could be
addressedinfuturework.
6.1–Failuretoproduceresults
The first objective must be to understand why certain numbers of teams failed to produce
certainresultsinthefinaliterationofthealgorithm.Achievingthiscannotonlyanswerthe
question of whether or not the algorithm performs faster per league than the current
standards, but also open up the possibility of introducing new functionality once this is
complete.
6.2–Midweekmatches
Anotherimportantchangewouldbetointroducethefullweektothealgorithm’scalculations.
Thiswouldimmediatelyallowforevenfurtherexpansion–forexample,theabilityforteams
to play midweek matches. This is important, as playing a midweek match provides the
algorithm with the option of assigning certain teams more than 1 match in a given week –
something that is not currently possible. This in turn would give more flexibility with the
assigningoffixtures.Midweekfixturesarealreadyakey–andregularlyoccurring–concept
inthefootballleagues,soaddingthemhereadvancesthealgorithmonestepfurther.
Midweekfixturesalsobecomemoreessentialoncetheseasonisgivenactualbeginningand
enddates.Duetothenumberofmatchesbeingplayed,itmaybethecasethattherearenot
enoughweekendsforafullseasontobeplayedwithouttheinclusionofthesekeymatches.
They were not introduced in this report because the beginning and end dates were not
implemented;hencetherewasalwaysenoughroomtofitinallmatches.
6.3–MultipleLeagues
Originally the implicit aim was that the algorithm would also include the Championship,
League1andLeague2;however,atpresent,onlythePremierLeagueistakenintoaccount.
Onepossiblemethodofimplementingthiswouldbetofocusonaleague-by-leaguebasis–i.e.
implementthefullseasonforoneleaguefirst,thenmoveontothenextleagueandsoon.The
difficulty of doing this is that it becomes difficult to alter the previous leagues if deemed
necessarye.g.movingamatchontoaweekdaytobypassaconstraint.
Anotherpossiblewaythiscanbeachievedwouldbetotrytoimplementallleaguesatonce,
havingthealgorithmsolveeachleagueconcurrently.Thiscouldhoweverbecomedifficultto
follow,thoughitallowsforeasiermanipulationofthevariousleaguesifsorequired.
Either of these methods would only be possible with the introduction of the full week as
mentionedabove.Thisisbecausevariousteamsthroughoutthevariousleaguesarepaired–
theycannotbothplayathomeonthesameweekendorweekday.Therefore,with4leagues
playingoverafixedperiodoftime,itwillbehighlylikelythatcertainteamswillhavetoplay
midweek to accommodate for this constraint. Many league clubs do play midweek matches
throughoutthedurationoftheseason,thoughthisisalsoinpartduetosomeclubs’seasons
being46matcheslong(allleaguesexcludingthePremierLeaguecontain24teamsthatplay
(24*2)–2matcheseachseason.
6.4–Externalmatchesandevents
Once the concept of the full week is introduced – and the season has calendar specific
beginningandenddates,externalfixturescanbebroughtintoeffect.Amoredetailedlistis
giveninthebackground,butforexamplethismightinclude:
• Cupcompetitions
• Internationalmatches
o Whenthesearebeingplayedthenationalleaguesareonhiatus
• Non-footballingeventswhichmayimpactonwhenfootballmatchesbeingplayedin
thesametowncantakeplace
This would undoubtedly cause more fixture congestion within the season and may begin to
causethealgorithmtoproducelesssatisfactoryresults,howevertodeterminewhetherornot
thisisthecasetestingwillberequired.
7–Conclusions
The aim of the project was to create an algorithm that could generate a fixture list for the
English football leagues, complying with official Football Association, Premier League and
Football League constraints. The algorithm would ultimately be judged on the following
criteria:
1. Minimaldistancetravelledinleaguematchesduringweekdays–withminimalnumber
ofderbymatchesduringweekdays
2. Minimaltimetakentoreachsolution–timetakennowisreportedly5-10minutesper
league
3. Minimal number of constraints broken – ideally there should be zero constraints
broken,howeverwiththedesirablecriteriathisisreportedtobedifficultinpractice,
withallconstraintsinplace
Itwasdeterminedthatofthetwoalgorithmsinitiallytested,tabuandbacktracking,thelatter
wasnotonlyfasteratproducingresults,itwasalsothemorelikelytoproducearesultthat
compliedwithallconstraintsset.
Whilethebacktrackingalgorithmshowedpromise,itwasonlyabletoachievefasterresults
throughtheassistanceoffourkeyheuristics–forwardchecking,minimumremainingvalue,
degree and least constraining variable. Combined, these improvements to the program
increased the efficiency incredibly. However, after the final iteration of the algorithm, a
problemwithanunknownsourceemerged–theinabilityofthecodetoreachasolutionfor
seasonsofsizes12,14,18and20,with6beingnoticeablyslowerthanpreviouslyfound.
Ontheotherhand,theseasonofsize8gaverealconfidenceinthedevelopmentsthatwere
being achieved, having surpassed all expected results and returning solutions almost
instantaneously,somethingthatwasneverachievedinpreviousiterations.Inadditiontothis,
promisingresultsattheseasonwith16teamsseemtoindicatethatsimilarresultscouldbe
produced for a full 20-team league, though the currently indeterminable problem
encounteredpreventsthisfromproducingafixturelist.
The above project is, simply stated, unable to answer the question of whether or not it is
possibletogeneratethefixturesforall4leaguesinEngland.Someoftheprogressdescribed
intheresultsindicatesthatitmaywellbepossibletodosoforasingleleague,butuntilsucha
timethattheprogress-inhibitingissueexplainedisovercome,itremainsimpossibletodraw
anyconcreteconclusionsfromthesefindings.
8–Reflection
Overthecourseofthisproject,Ilearnedaharshlessonwhenitcomestoambitiousgoals.A
moreachievablegoalwouldhavebeentoassesstheuseofthebacktrackingalgorithmforthis
typeofproblem.GivenmyexperiencewiththisprojectasInearthedeadlinethataimingto
fullyreplicatethecurrentsystemwasseveralstepstoofar,andIshouldhavebeenmorewary
of the potential to fall short of such an ambitious goal. Having said this, I’ll never shy away
fromenthusiasmandbeingambitiousasthesewerethequalitiesthatconvincedmetogofor
suchanintriguingproject.
I also learned a great deal regarding time management. At the beginning of my project, I
researched distances between the 92 football clubs in England (Appendix B), rather than
focussingonthemorepressingmatterathand,whichwasthedevelopmentofthealgorithm.
Instead,IcreatedatoolbywhichIcouldquerytheGoogleMapsAPIandretrievewhatresults
Ineeded.Whilethiswasasuccess,mytimewouldhavebeenbetterspentelsewhere.IfIwere
toattemptthisprojectfromthebeginningagain,Iwoulddefinitelybegindevelopmentonthe
algorithmsfirst.Oncethiswascomplete,IwouldthenbeginutilisingtheGoogleMapsAPIto
introducetheconceptofdistancebetweenclubs.
Converselytothesetwoscopesforimprovement,oneareainwhichIbelieve,uponreflection,
Icompletedwellwasthefurtherdevelopmentofthebacktrackingalgorithm.Theapproachto
solving this particular problem – where I iteratively added major improvements to the
algorithm–wastheappropriateapproachtosolvingthisproblem.
OverthecourseofthisprojectIlearnedagreatdealofusefulskills.One,forexample,wasthat
IimprovedmyabilityagreatdealinPython.Inowhaveadeeperunderstandingofhowit
works;itsmemorystorageandbestpracticesforcodeefficiency.However,theareasinwhich
Ilearnedthemostwastheuseofsearchalgorithmsandheuristics.ThoughmyresearchI
discoveredseveralnewalgorithmsthatIwasnotfamiliarwithinpractice(e.g.backtracking,
tabu,simulatedannealingetc.),havingonlybrieflylearnedabouttheminlectures.Iamnow
confidentthatIwouldbeabletoutilisethemtosolveotherproblemsthatIfaceinthefuture.
9–References
RajendraAkerkar,PritiSajja.2010.Chapter8:GeneticAlgorithms.In:Knowledge-Based
Systems,pp.236.
OliverBrown.28/08/09.WestHamvMillwall:ahistoryofhowtherivalrystarted[online].
England:TheTelegraph.Availableat:
http://www.telegraph.co.uk/sport/football/teams/west-ham/6105500/West-Ham-vMillwall-a-history-of-how-the-rivalry-started.html[Accessed:05/05/16].
DevelopersGoogle.unk.GoogleMapsDistanceMatrixAPI[online].Google.Availableat:
https://developers.google.com/maps/documentation/distance-matrix/[Accessed:
05/05/16].
AndrewGoldberg.2003.HighlyConstrainedSportsSchedulingwithGeneticAlgorithms
[online].Availableat:
http://pages.cs.wisc.edu/~goldberg/publications/AndrewBGoldbergThesis.pdf[Accessed:
05/05/16].
FIFA.DatePublishedUnknown.HistoryofFootball-TheOrigins[online].Switzerland:
FédérationInternationaledeFootballAssociation.Availableat:http://www.fifa.com/aboutfifa/who-we-are/the-game/[Accessed:05/05/16].
FIFA.DatePublishedUnknown.HistoryofFootball-TheGlobalGrowth[online].Switzerland:
FédérationInternationaledeFootballAssociation.Availableat:http://www.fifa.com/aboutfifa/who-we-are/the-game/global-growth.html[Accessed:05/05/16].
TheFootballAssociationPremierLeagueLimited.2015.PremierLeagueHandbook2015-16
[online].England:TheFootballAssociationPremierLeagueLimited.Availableat:
http://www.premierleague.com/content/dam/premierleague/sitecontent/News/publications/handbooks/premier-league-handbook-2015-16.pdf(SectionL:
Fixtures,ArrangingFixtures)[Accessed:05/05/16].
TheFootballLeague.14/10/15.Section5-Fixtures[online].England:TheFootballLeague.
Availableat:http://www.football-league.co.uk/global/section5.aspx(Section26:
AdministrationandArrangementofFixtures)[Accessed:05/05/16].
KhaledGhedira.2013.1.2.1Formalism.In:ConstraintSatisfactionProblems:CSPFormalisms
andTechniques,pp.9-10.
FredW.Glover,ManuelLaguna.1997.2.1-MemoryandTabuClassifications.In:TabuSearch,
pp.29-31.
G.Kendall.2007.SchedulingEnglishfootballfixturesoverholidayperiods[online].The
UniversityofNottingham,Nottingham,UK.Availableat:
http://www.cs.nott.ac.uk/~pszgxk/papers/gxkjors2008.pdf[Accessed:05/05/16].
Kirkpatrick,S.;GelattJr,C.D.;Vecchi,M.P.(1983)."OptimizationbySimulated
Annealing".Science(Volume220)(Issue4598):pp.671–680
P.J.vanLaarhoven,E.H.Aarts.1989.8.1–ParallelImplementations.In:SimulatedAnnealing:
TheoryandApplication,pp.139.
Metropolis,Nicholas;Rosenbluth,AriannaW.;Rosenbluth,MarshallN.;Teller,AugustaH.;
Teller,Edward(1953)."EquationofStateCalculationsbyFastComputingMachines".The
JournalofChemicalPhysicsVolume21(Issue6):pp.1087- 1092
PremierLeague.17/06/13.Perfectmatch:Howthefixturelistiscompiled[online].England:
PremierLeague.Availableat:http://www.premierleague.com/en-gb/news/news/201314/jun/how-the-fixture-list-is-compiled.html[Accessed:05/05/16].
ProfessorEmeritusRutgers.2015.Chapter5,Backtracking.In:FoundationsofAlgorithms,pp.
203-248.
Various.LastUpdate:January29,2016.ChallengeTravelingTournamentInstance[online].
Availableat:http://mat.tepper.cmu.edu/TOURN/[Accessed:05/05/16].
10–Appendix
AppendixA–“6-TeamSeasonDataDump.txt”
AppendixB–“Distances_Between_Clubs.txt”