solving the physical traveling salesman problem tree search and macro

Upload: justt-angga

Post on 02-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    1/15

    IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014 31

    Solving the Physical Traveling Salesman Problem :Tree Search and Macro Actions

    Diego Perez , Student Member, IEEE , Edward J. Powley , Member, IEEE , Daniel Wh itehouse , Member, IEEE ,Philipp Rohlfshagen , Member, IEEE , Spyridon Samothrakis , Member, IEEE , Peter I. Cowling , Member, IEEE , and

    Simon M. Lucas , Senior Member, IEEE

    Abstract This paper presents a number of approaches forsolving a real-time game consisting of a ship that must visit anumber of waypoints scattered around a 2-D maze full of obsta-cles. The game, the Physical Traveling Salesman Problem (PTSP) ,which featured in two IEEE conference competitions during 2012,provides a good balance between long-term planning ( nding theoptimal sequence of waypoints to visit), and short-term planning(driving the ship in the maze). This paper focuses on the algorithmthat won both PTSP competitions: it takes advantage of t hephysics of the game to calculate the optimal order of waypoints,

    and it employs Monte Carlo tree search (MCTS) to drive the ship.The algorithm uses repetitions of actions (macro actions) to reducethe search space for navigation. Variations of this algorithm arepresented and analyzed, in order to understand the strength of each one of its constituents and to comprehend what makes suchan approach the best controller found so far for the PTSP .

    Index Terms Computational and arti cial intelligence, gamesearch, Monte Carlo tree search, real-time games, reinforcementlearning.

    I. I NTRODUCTION

    ARTIFICIAL INTELLIGENCE (AI) for real-time video

    games has become an important

    eld of study in recentyears, and within the eld there are a diverse rangeof interestingchallenges and benchmarks. The games studied vary greatlyin complexity, and, sometimes, several problems have to betackled to progress within small decision time budgets.

    In this paper, the focus is on the Physical Traveling Salesman Problem (PTSP) , a single-player real-time video game wherethe pl ayer needs to complete a puzzle providing actions at a rateof one every 40 ms. This game featured in two internationalIEEE competitions during 2012 [1], receiving numerous entries

    Manuscript received December 11, 2012; revised February 14, 2013;accepted May 13, 2013. Date of publication May 17, 2013; date of currentversion March 13, 2014. This work was supported by the Engineering andPhysical Sciences Research Council (EPSRC) under Grants EP/H048588/1and EP/H049061/1, both under the project UCT for Games and Beyond.

    D. Perez, S. Samothrakis, and S. M. Lucas are with the School of Computer Science and Electronic Engineering, University of Essex, Colchester CO4 3SQ,U.K. (e-mail: [email protected]; [email protected]; [email protected]).

    E. J. Powley, D. Whitehouse, and P. I. Cowling are with the Departmentof Computer Science, University of York, Heslington, York YO10 5DD,U.K. (e-mail: [email protected]; [email protected]; [email protected]).

    P. Rohlfshagen was with the School of Computer Science and ElectronicEngineering, University of Essex, Colchester CO4 3SQ, U.K. He is now withSolveITSoftware, Adelaide, S.A. 5000, Australia (e-mail: [email protected]).

    Color versions of one or more of the gures in this paper are available onlineat http://ieeexplore.ieee.org.

    Digital Object Identi er 10.1109/TCIAIG.2013.2263884

    that tried to solve the problem by employing a range of differenttechniques.

    This paper is centered on the application of Monte Carlo treesearch (MCTS) [2] to the PTSP , using different planners andmechanisms to reduce the search space and to improve perfor -mance. MCTS is based on two main concepts: the rst one isthe balance between exploration and exploitation of the searchspace, using a tree selection mechanism based on the u pper con- dence bound for trees (UCT) [3]. The second concept is the useof Monte Carlo (MC) simulations to compute estimated rewardsfor applying different actions in certain s tates. The controller ex- plained here is the winner of both editions of the competition.The goal of the paper is to provide insight into the various com- ponents of the controller, analyzing it s strengths, weaknesses,and the importance of each one of its constituents.

    MCTS is a game tree search method that has shown out-standing performance where some o ther techniques, such asminimax or depth rst search (DFS), have failed. A clear ex-ample of this is the game of Go , where MCTS is the rst algo-rithm able to provide a professional level of play in some ver-sions of the game [4]. Since then, MCTS has been applied to awide range of different games and applications. Browne et al.[5] present, in a comple te survey, the description of the algo-rithm, variations, and applications.

    In the domain of real-time games, MCTS has been appliedto different problems . For instance, Samothrakis et al. [6] com- pared different MCTS variants in the game of Tron , includingheuristics that dissuaded the player from performing suicidalmovements. Also , Den Teuling [7], in a more recent paper, pro- poses a UCT player that handles simultaneous moves and pre-dicts outcomes without completing a full simulation.

    Another domain where MCTS has been successfully appliedis Ms Pac-Man . In this game the player controls Ms Pac-Man,aiming to eat all the pills scattered in the maze while avoiding being capt ured by the ghosts. Ikehata et al. [8] propose a versionof MCTS that identi es dangerous moves and zones in the mapwhere it is likely to be captured.

    Single-player real-time games, such as the PTSP , have also been used as benchmarks for MCTS techniques. For instance,Zhongjie et al. [9] applied MCTS to the well-known game of Tetri s. The authors included a novel mechanism in MCTS that pruned branches of the tree to remove those actions that wouldcreate holes in the array of blocks. The modi cation increasedthe time needed to decide a move, but theactionstaken produced better results than the unmodi ed version of the algorithm.

    1943-068X 2013 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission.See http://www.ieee.org/publications_standards/publications/rights/index.html for more information.

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    2/15

    32 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    Fig. 1. Action space of the PTSP .

    The PTSP itself has also been approached using MCTS tech-niques. A previous version of the problem, where the maps hadneither obstacles nor boundaries,was used by Perez et al. [10] tosuggest the importance of heuristic knowledge in the tree search policy and the MC simulations. Finally, the algorithm describedin this paper won the PTSP competition twice in 2012, makinguse of MCTS. The rst version of the winning controller is ex- plained in [11]. One of the key aspects of this controller is the

    use of macro actions . As the PTSP is a single-player and de-terministic game, it is very convenient to group single actionsinto prede ned sequences to reduce the search space size. For instance, a macro action would be the repetition of a single ac-tion for time steps. These abstractions can help to reducethe branching factor, and the MC simulations of the algorithmcan look further ahead with perfect accuracy. The idea of macroactions (or temporally extended actions) has a long history in AI(see [12]) and has been used extensively in domains where thesize of the state space would make the cost of searching pro-hibitive with current computational resources (e.g., [13]).

    Balla and Fern [14] applied UCT to the real-time strategygame Wargus . This game is based on tactical assault planning,where multiple units are concurrently performing actions in thegame, and different actions, executed simultaneously, can takea variable duration. The authors discretize this continuous statein an abstraction that simpli es the characteristics of the currentgame layout: transitions between states are managed by actionsthat affect a group of units, reducing the size of the tree searchand allowing more ef cient simulations.

    Abstracted action spaces have also been used, for instance, by Childs et al. [15] (and recently revisited by Van Eyck andMller [16]), who applied combined groups of actions whenusing UCT in the arti cial game tree P-Game. A P-Game treeis a minimax tree where the winner is decided by a countingmechanism on the nal state of the board. In their study, the au-thors group several similar actions into a single move to reducethe branching factor, obtaining promising results. Powley et al.[17] employed a similar technique when applying MCTS to thecard game of Dou Di Zhu , where a single move choice is some-times split into two separate and consecutive decisions to reduce branching factor at the expense of tree depth.

    The rest of this paper is organized as follows. Section II de-scribes the PTSP game, and Section III explains the general ar-chitecture of the PTSP controller. Section IV introduces the treesearch methods employed in this research, and Sections VVIIdescribe the different components and parameters of the con-troller: macro actions, value functions, and TSP solvers, respec-tively. The experimental setup is described in Section VIII, and

    Fig. 2. Example of a PTSP map.

    the results and analysis are presented in Section IX. Finally, theconclusions and future work are presented in Section X.

    II. PHYSICAL TRAVELING SALESMAN PROBLEM

    A. The Game

    The PTSP is an adaptation of the traveling salesman problem(TSP) to convert it into a single-player real-time game. The TSPis a well-known combinatorial optimization problem where aseries of cities (or nodes in a graph) and the costs of traveling between them are known. A salesman must visit all these cities

    exactly once and go back to the starting city following the pathof minimum cost.

    In the PTSP , the player (i.e., the salesman) governs a space-ship that must visit a series of waypoints scattered around amaze as quickly as possible. The PTSP is a real-time game, im- plying that an action must be supplied every 40 ms. The avail-able actions are summarized in Fig. 1. These actions are com- posed of two different inputs applied simultaneously: accelera-tion and steering. Acceleration can take two possible values ( onand off ), while steering can turn the ship to the left , right , or keep it straight . This leads to a total of six different actions. Incase the controller fails to return an action after the time limit, a NOP action (ID: 0) is applied, which performs no steering andno acceleration.

    The state of the ship is kept from one game step to the next,and three different vectors are modi ed after applying a singleaction. The orientation of the ship is changed, as shown in

    (1)

    given the ships orientation in the last step and the rotationangle (a xed angle that can be positive or negative, de- pending on the sense of the steering input, or 0 if the ship istold to go straight). Equation

    (2)

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    3/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 33

    Fig. 3. Example of different routes and performances in PTSP . (a) and (c) Order of waypoints according, respectively, to a distance-based TSP solver and a second planner that takes the physics of the game into account. (b) and (d) Trajectory described while following these routes. Note that the distance-based route completesthe game in 1040 game ticks, while the physics-based one visits all the waypoints in only 564 steps.

    indicates how the velocity vector is modi ed, given the previousvelocity , the new orientation, an acceleration constant ,and a frictional loss factor . In this case, the accelerationinput determines the value of : being 1 if the action impliesthrust or 0 otherwise. Finally

    (3)

    updates the position of the ship by adding the velocity vector toits location in the previous game step . This physics modelkeeps the inertia of the ship between game cycles, making thetask of navigating the ship more challenging

    The obstacles of the maze do not damage the ship, but hittingthem produces an elastic collision, which modi es the velocityof the ship (both in direction and magnitude). An example of amap distributed with the game is shown in Fig. 2.

    In addition to returning an action every 40 ms, a controller designed for the PTSP must respect two other time limits: an

    initialization time and a limit to reach the next waypoint in thegame. Both times depend on the number of waypoints present,which in the experiments described in this paper are 30, 40, and50. The initialization time that can be used by the controller to plan the route to follow before the game begins is set to 1 s per each ten waypoints. The time to reach the next waypointdepends on the density of the waypoints in the maze: maps with30 waypoints allow 700 time steps, 40 waypoints imply 550game ticks, and 50 waypoints permit the usage of 400 gamesteps. These counters are set to this limit every time a waypointis visited, and are decreased by 1 at every cycle. If the valuereaches 0, the game is over. There is also a second counter that

    counts the total number of steps of the game.The nal score of the game is de ned by the tuplewhere is the number of waypoints visited and is the totaltime used. Between two matches, the one that gets more way- points is considered to be the best. In case of a draw, the one that nished the game in fewer time steps wins.

    At every game step, the controller is supplied with a copy of the current game state and the point in time the move is due. Thegame state contains information about the ship itself (position,velocity, orientation), the game (time left, number of waypointsvisited), the map (position of obstacles and path nding queries),and waypoints (positions and whether they have been visited).However, the most important feature of this game state is that it provides a forward model to runsimulations. In other words, it is possible to check what the future states of the game would be if

    a speci c sequence of moves were played. The PTSP is a deter-ministic and single-player game, and the simulations performedare completely accurate. This makes tree search and simulationapproaches especially well suited for this kind of problem.

    B. PTSP Versus TSP

    A reasonable approach to solving the PTSP is to divide the problem into its two constituents: the order of waypoints tofollow and navigating the ship to each one of them. However,these two problems are highly interdependent, as ignoring the physics model of the game may lead to a suboptimal order of waypoints. In particular, if the order of waypoints is obtainedonly taking the distances between the waypoints into account(calculated, for instance, using the A* algorithm), the nal re-sult may be suboptimal. It is worth noting that the nal objec-tive is to minimize the time taken to visit all waypoints, andnot the distance. Hence, routes that might not seem optimal be-cause of their length could provide better solutions if the ship

    is able to drive them quickly. In general, it has been suggested[1] that routes that minimize the changes of direction and cover waypoints in straight (or almost straight) lines are better for the PTSP . Fig. 3 (from [1]) shows a clear example of these situa-tions in PTSP .

    C. The PTSP Competition

    The PTSP featured in two competitions in 2012, held at twointernational conferences: the IEEE World Congress on Compu-tational Intelligence (WCCI) and the IEEE Conference on Com- putational Intelligence and Games (CIG).

    In both competitions, the participants were able to create

    controllers in Java by downloading a starter kit that containedsome sample controllers and ten different maps. A server,accessible at www.ptsp-game.net, was running continuously,receiving submissions and executing the controllers in theseten maps and other groups of maps, created to provide a testmechanism for the participants in the machine where the nalevaluation would be made.

    Following the deadline of the competition, the controllers played a set of 20 new maps that had never been seen or played by the participants before. Each controller was executed vetimes on each map. The nal result was the average of the best three matches, featuring waypoints and time taken. The players, ranked according to number of waypoints visitedand time taken, were awarded following a Formula One stylescoring scheme (described in Section IX-C). The winner of the

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    4/15

    34 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    Fig. 4. General scheme of the PTSP controller.

    competition was the player who submitted the controller thatachieved the most points across all maps.

    In the WCCI competition [18], only maps with ten waypointswere considered. However, in the CIG edition of the competi-tion, the maps were changed to contain 30, 40, and 50 way- points. In this study, the maps used for the experiments are theones employed for the nal rankings of the CIG competition.

    The winning method of both bot competitions was the entry

    by Powley et al. , who described their WCCI controller in [11].This controller, based on MCTS, macro actions, and a physics- based TSP solver, is the base for the experiments described inthis paper.

    III. T HE PTSP CONTROLLER

    The following sections describe the different constituents of the PTSP controller, such as the TSP solvers, search methods,and macro-action discretization. Fig. 4 shows the general archi-tecture of the controller, which is common for all con gurationstested in this research.

    During the initialization step, the TSP route planner (or

    TSP solver ) obtains the order of waypoints to follow duringthe game. Then, the game requests an action from the PTSP controller (also mentioned here as the driver ) at every gamestep, providing information about the game state, until the gameis ended. In each one of these cycles, the controller simulatesactions in the game, deciding which will be the next actionto execute. As will be explained in Section V, macro actionsare used to discretize the search space. While the controller isexecuting a given macro action at time , the simulations are performed in order to nd out which is the best macro actionto execute at time (where is the length of all macroactions).

    IV. S EARCH METHODS FOR THE PTSP CONTROLLER

    Three different search methods have been employed in thisstudy to tackle the PTSP : DFS, MC simulations, and MCTS.All these methods share the same time constraint: a move deci-sion must be made within the time given (40 ms). This featuredetermines the way the algorithms are designed, as adjustingto this time budget makes it impossible to reach the end of thegame in the vast majority of cases.

    Additionally, the PTSP is an open-ended game: it is not pos-sible to nd a state in the search space where all waypoints arevisited just by applying uniformly random action selection. In-deed, even reaching the next waypoint to visit is not normallyachievable via uniform random simulations. It is, therefore, es-sential to add a heuristic value function capableof evaluating the

    quality of the different states found in the game (for a descrip-tion of these, see Section VI). This section details the search procedures employed in this study.

    A. Depth First Search

    DFS is a traditional graph or tree search algorithm. It searchesexhaustively at each node of the tree, iteratively expanding thenext unvisited child and searching deep until a nonexpandablenode is reached. The search navigates up the tree to nd thenextunexpanded node and continues this process, until all nodes below the root have been visited.

    Starting from the root, which represents the current state of the game, actions are applied that lead to future game states,using the forward model mentioned in Section II. These futurestates, derived after applying an action, are taken as childrenof the parent node. Finally, the action that led to the best scoreachieved is taken as the move to play in the game.

    In order to ful l the time budget limitations, a maximumdepth for the search needs to be decided. In this case, it has beendetermined empirically that when depth 4 has been reached,DFS cannot expand any further without exceeding the imposedtime limit. Therefore, when a node in this depth is reached, anevaluation is performed in order to assign a score to the statefound, using one of the state evaluators described in Section VI.Owingto this depthlimitation,the number of states that are eval-uated for each decision is .

    B. MC Simulations and UCB1

    MC methods are based on random simulations that samplethe search space uniformly or guided by heuristics. In the caseof the PTSP , simulations are performed from the current state

    of the tree (or root), choosing a sequence of actions uniformly atrandom until a maximum depth has been reached. The state of the game is then evaluated. Different values for the simulationdepth have been tried in the experiments described in this paper.The depth of the simulation and the 40-ms time budget sets thelimit of how many simulations can be performed.

    If actions are picked uniformly at random, it is expected thateach action is selected one sixth of thetime, producing an evenlydistributed search. This approach, however, does not bene tfrom the fact that one or more actions can be better than others,as suggested by the scores obtained by the evaluations at the endof the simulations.

    To overcome this problem, a multiarmed bandit selection policy is employed. Multiarmed bandits is a problem from probability theory where each one of the multiple slot ma-chines produces consecutive rewards (for time

    ) driven from an unknown probability distribution.The objective is to minimize the regret, i.e., the losses of notchoosing the optimal arm. Multiarmed bandit policies selectactions in this problem by balancing the exploration of avail-able actions (pulling the arms) and the exploitation of those that provide better rewards (optimization in the face of uncertainty).

    Auer etal. [19] proposed the upper con dence bound (UCB1) policy for bandit selection

    (4)

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    5/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 35

    The objective is to nd an action that maximizes the valuegiven by the UCB1 equation. Here, represents the em- pirical average of choosing action at state . It is calculatedas the accumulated reward of choosing action divided by howmany times this action has been picked. is the exploita-tion term, while the second term (weighted by the constant ) isthe exploration term. Note that, if the balancing weight ,UCB1 follows greedily the action that has provided the bestaverage outcome so far. The exploration term relates to howmany times each action has been selected from the given state

    and the amount of selections taken from the currentstate . W hen action is c hosen, t he v alues o f and

    increase. The effect of this is that the exploration term for other actions different than increase, allowing a more diverseexploration of the different available actions in future iterationsof the algorithm.

    The value of balances between these two terms. If the re-wards are normalized in the range , a commonlyused value for in single-player games is . It is also impor-tant to notice that, when for any action, that actionmust be chosen. In other words, it is not possible to apply UCB1if all actions from a state have not been picked at least once.

    When the time budget is over, the action to execute in thegame is the one that has been chosen more times by UCB1.

    C. Monte Carlo Tree Search

    MCTS is a tree search technique that creates a tree by per-forming MC simulations. The best known version of MCTSis UCT, proposed by Kocsis and Szepesvri [3], [20]. UCTuses UCB1 (as described in Section IV-B) to build a potentiallyasymmetric tree that is grown toward the more promising parts

    of the search space. Every time UCT selects an action that leadsto a state which is not represented in the tree, a new node isadded to it and an MC simulation is started from there.

    TheMCTS algorithm can be seen as a four-stepprocess that isrepeated for severaliterations. During the rststep (the selectionstep), the tree selection policy (e.g., UCB1 for UCT) selects thenext action to take. The action leads to a node in the tree. If thenode is already present in the tree, then the selection policy isapplied again (and so on recursively); if not, it is added as a newleaf node (the expansion step). An MC simulation is initiatedfrom this node until a predetermined depth or the end of thegame. The state reached at the end of the simulation is evaluated

    (the simulation step). This MC simulation is driven by a default policy that can be uniform at random (as it is in this study) or guided by a heuristic.

    The last step in the iteration is backpropagation . During this phase, the reward obtained by the evaluation function is back- propagated throughout the visited nodes until the root. All thenodes traversed update their internal statistics: , ,and , gathering knowledge for the tree selection phase inthe next iterations of the algorithm.

    As in the previous cases, the depth of the MC simulation must be limited as, if not, it would not be possible to reach the end of the game within theallowed time budget. These depth values arede ned in the experimental setup, but it is important to noticethat the simulation depth corresponds to the number of actionstaken from the root of the tree, and not from the new expanded

    node at each iteration. This is done in order to provide the samelook ahead from the children of the root despite the asymmetrictree growth.

    V. M ACRO A CTIONS IN THE PTSP

    The algorithms presented in this paper treat the PTSP as two

    different (but related) subproblems: navigating the ship and planning the order of waypoints to be followed. This sectiondescribes the approach used to drive, or steer, the ship along theroute chosen by the methods described in Section VII, i.e., howto follow the paths from one waypoint to the next. (In line withgames literature, steering here includes acceleration as wellas rotation of the ship.) An input to the ship is sent once every40 ms, in order to steer the ship around obstacles and towardwaypoints.

    The steering problem for PTSP can be considered as a se-quential decision problem on a tree. It can also be considered asa problem on a directed graph, i.e., allowing multiple paths tothe same node and possibly cycles, but, for simplicity, the graphis assumed to be a tree. The nodes of the tree are states and theedges are actions . A macro action is de ned as a sequenceof actions . Executing a macro action corre-sponds to playing out the sequence of actions contained withinthe macro action. A decision tree of macro actions can be built:the node set of this tree is a subset of the node set of the originaldecision tree.

    In the PTSP , the set of legal actions from a state (i.e., the setof edges out of the corresponding node) is the same forall states.If this was not the case, more care would be needed in de ningmacro actions: if the macro action is to be applied at state ,and is the state eventually obtained by applying all actions,

    then must be a legal action from .For the PTSP , the purpose of macro actions is to reduce the

    size of the problem and to increase the ability of tree searchmethods to perform forward planning. This can be achieved byreducing the granularity of possible paths and preventing theship from making small (sometimes meaningless) adjustmentsto speed and direction. The macro actions used in this paper arearguably the simplest possible, consisting of executing one of the six available actions (see Fig. 1), for a xed number of timesteps .

    More complex macro actions were tested, such as rotating toone of several speci ed angles while thrusting or not thrusting.

    One problem that arosewas that search methods did not performwell when different actions took different lengths of time to exe-cute: since the evaluations used(Section VI) are implicitly func-tions of distance, a search method optimizing these value func-tions tends simply to favor longer macro actions over shorter ones. Having each depth of the tree corresponding to the samemoment in time and having the search roll out to a xed depthmeans instead that search methods will optimize the path length(by maximizing distance traveled in a xed amount of time).

    On a map of 50 waypoints, the game always takes less than20 000 time steps (a longer time would imply that the time limit between waypoints was exceeded at least once). Thus, the de-cision tree has up to nodes. The game takes less than20 000/ macro actions, therefore the size of the macro-actiontree is bounded above by , which represents a hundreds

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    6/15

    36 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    Fig. 5. Examples of the path followed by the MCTS controller. The light grayline has corresponding to 90 turns. The black l ine has corre-

    sponding to 30 turns.

    Fig. 6. Example of the scanline ood ll algorithm. Cells colored gray are un- llable. The cell marked is the current cell. The cells marked , on the samerow as , are lled. The cells marked , on the rows directly above and below

    , are enqueued.

    of orders of magnitude reduction in the size of the problem to be solved (when ). To illustrate this, let us make a con-servative estimate of 2000 time steps for the average length of a

    game, and set . The game tree containsstates, whereas the macro-action tree containsstates. The size of the macro-action tree in this example is com- parable to the game tree size for a complex board game: for comparison, the number of states in 9 9 Go is bounded above by . The macro-action tree is of the order times smaller than the full game tree.

    The parameter controls the tradeoff between the granularityof possible paths and the forward planning potential for treesearch. Since one rotation step corresponds to a rotation of 3 ,a setting of restricts the ship to only making 90 turns.(Note that the ship may have an initial velocity, and may thrust

    while turning, so the restriction to 90 turns does not restrict the path to 90 angles). When using this setting, search algorithmswill nd paths that have to bounce off walls or follow convo-luted routes to line up with waypoints. A choice of corresponds to 30 turns, which allows for a ner control of theship and smoother paths. The difference is illustrated in Fig. 5where the path with 90 turns is more jagged (and takes longer to follow) than the one with 30 turns. On the other hand, when

    reaching a depth in the search tree corresponds to a point in time sooner than with . This impacts the steeringcontrollers ability to plan ahead.

    It is worthwhile mentioning that a different approach couldalso be possible: instead of executing all the single actions fromthe best macro action found, one could only apply the rst one.Macro actions are employed during MC simulations, but all

    routes are possible for the driver as the next best macro actionis computed every 40 ms. This approach, however, allows lesstime for deciding the next move, as only one game step can beused to pick the next action to take.

    VI. V ALUE FUNCTIONS

    The goal state in PTSP (a state in which all waypoints have been collected) can be several thousand time steps, or severalhundred macro actions, into the future. Finding such a state purely by tree search is intractable. Instead, the search is per-formed to a xed depth, applying a heuristic evaluation functionto the resulting nonterminal state, and allowing the tree searchto optimize this heuristic value.

    The value functions are based around the shortest pathdistance to a target waypoint, taking obstacles into account.Section VI-A describes the precomputed data structure we useto calculate these distances, and Sections VI-B and VI-C givethe two value functions tested in this paper.

    A. Computing Distance MapsFor route planning, it is necessary to estimate the travel time

    between all pairs of waypoints, taking obstacles into considera-tion. For the evaluation function used by the driving algorithms,it is necessary to nd the distance between the ship and the nextwaypoint, again accounting for obstacles.

    The distances between every waypoint and every other nonobstacle point on the map are computed upfront. This can be done quickly and ef ciently using a scanline ood ll algo-rithm: maps for the PTSP are represented as 2-D arrays, whereeach cell is either an obstacle or an open space. This bitmap-likerepresentation is particularly amenable to algorithms from com-

    puter graphics. Distance maps are computed using a modi edscanline ood ll algorithm [21]; see Algorithm 1.

    Algorithm 1: Scanline ood ll algorithm for computingdistance maps. For conciseness, array bound checks areomitted.

    1: function COMPUTE DISTANCE MAP2: create a 2-D array with the same dimensions as3: for each coordinate pair in the map do4: if is a wall, or then5:

    6: else if is a wall then7:8: else if and then9:10: else11:12: create a queue , and push onto it13: while is not empty do14: pop from15: if ISFILLABLE then16: MinDist17: if ISFILLABLE then18: push onto19: if ISFILLABLE then20: push onto

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    7/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 37

    21: S CAN22: S CAN23: return

    24: function SCAN25: for do26: if ISFILLABLE then27: M INDIST28: if ISFILLABLE29: I SFILLABLE then30: push onto31: if ISFILLABLE32: I SFILLABLE then33: push onto

    34: function M INDIST35: ,36:37: return

    The resulting 2-D array is called a distance map . Once thesedistance maps are computed, nding the distance between awaypoint and any other point (waypoint or ship position) can be looked up quickly in time.

    The algorithm initializes every entry inthe array to , apartfrom the entry corresponding to waypoint s position, which isinitialized to 0. The algorithm maintains a queue of cells fromwhich to scan, beginning with waypoint s position. From eachcell, the algorithm scans to the left and to the right. For eachscanned cell , a tentative distance is computed as

    (5)

    where ranges over the orthogonal and diagonalneighbor cells of . The cell is considered llable if

    , i.e., if the tentative distance is less than thedistance currently stored in . During the scan, llable cellsare updated by setting ; the scan terminatesupon encountering an un llable cell. While scanning, thealgorithm checks the cells immediately above and below thecurrent row: upon transitioning from a region of un llable cells

    to a region of

    llable cells, the

    rst

    llable cell is enqueued. Anexample of this is shown in Fig. 6.Obstacle cells are always considered un llable. Every ob-

    stacle is also surrounded with an un llable -shaped regionwhose radius is equal to the ships radius.This effectively meansthat the distance map and the algorithms that use it ignore anyspaces or corridors that are too narrow to accommodate the ship.A -shaped rather than circular region is used purely for com- putational speed: for the purposes of removing narrow corridors, both are equally effective.

    Whether a cell is llable depends on the tentative distance,which, in turn, depends on the contents of the distance map sur-rounding the cell, a cell that has previously been lled or con-sidered un llable can become llable again later on. This cor-responds to a new path being found to a cell, shorter than the

    Fig. 7. Example of a distance map for the point marked . This is a contour map: lines show regions where the distance map value is a multiple of 25.

    shortest previously known path. This is in contrast to the clas-sical ood ll algorithm [21], where a previously lled pixel isnever lled again.

    Fig. 7 shows an example of a distance map. Note that sincedistances are computed based on orthogonally and diagonallyadjacent cells, the contours are octagonal rather than circular.Circular contours could be more closely approximated by en-larging the adjacency neighborhood, but this implementation isa good tradeoff between speed and accuracy. The distance mapsdo not need to be completely accurate, merely accurate enoughto serve as a guide for route planning and obstacle avoidance.

    B. Myopic Evaluator

    At any given point during the game, the route planner (Section VII) identi es the current target waypoint. Letdenote the fraction of the distance traveled toward the targetwaypoint, scaled so that when the ship is at the previously collected waypoint (or at the start position if nowaypoints have yet been collected) and when the shiphas reached the target waypoint. Here, distance is the shortest path distance, looked up in the distance map for the targetwaypoint (Section VI-A).

    The myopic evaluation for state is calculated as follows:

    if the target waypoint is uncollectedif the target waypoint is collected.

    (6)In other words, the state value is proportional to distance untilthe target waypoint is collected, with all postcollection stateshaving the same value . Optimizing the distance in this way,instead of rigidly following the gradient-descent paths sug-gested by the route planning phase, encourages the controller to take shortcuts to the next waypoint, taking advantage of the physics of the game.

    It is important that , i.e., that postcollection stateshave a higher value than all precollection states, as this incen-tivizes the search toward waypoint collection. Without this, the

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    8/15

    38 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    Fig. 8. Evaluation of the current state by (7) against time, for an instance of PTSP . Vertical lines denote states where a waypoint was collected while exe-cuting the previous macro action. Note the jump in evaluation score at thesestates.

    evaluation is very close at positions in the neighborhood of awaypoint, which often results in the ship waiting near the way- point, or spiralling around it (usually getting closer with eachrotation) but not actually passing through it.

    C. Stepping Evaluator

    The myopic evaluator is shortsighted in that it does not dis-tinguish states after collection of the target waypoint. Another value function is de ned to remedy this, which causes the shipto collect the current target waypoint and end up in a favorable position for collecting the waypoint after it.

    The evaluation of the ship being in a particular state is cal-

    culated as follows:

    (7)

    where is the number of waypoints that have been collectedso far along the route recommended by the route-planning phase (Section VII), is the proportion of the distance trav-eled from the last waypoint to the next target waypoint instate according to the distance map (Section VI-A), andis the speed of the ship, to encourage the steering algorithm tomaintain momentum. The values are weights that need to betuned.

    Note that is de

    ned similarly to for the myopic eval-uator, with one crucial difference: considers the target way- point in the root state, whereas considers the target waypointin state . This is the distinction between the myopic and step- ping evaluators: once the target waypoint is collected, the my-opic evaluator considers all states to be equally good whereasthe stepping evaluator begins optimizing the distance to the nextwaypoint. Choosing means that there is a step (a dis-continuous jump) in reward associated with collecting the nextwaypoint (see Fig. 8).

    The evaluation explicitly does not reward the agent for collecting waypoints early (out of route order). Otherwise, theMCTS driver has a tendency to make detours to greedily collectwaypoints, which generally turns out to be detrimental in thelong term.

    Since the amount of time taken is not directly represented inthe evaluation, a different evaluation is used at terminal stateswhen all waypoints are collected

    (8)

    where is the number of waypoints, is the timeout be-tween collecting waypoints, is the total number of time steps taken to collect all the waypoints, and is a param-eter to tune. This ensures that terminal states have an evaluationof at least , which is higher than that of any nonterminalstates, and that terminal states which are reached in less timehave a higher evaluation than terminal states which took moretime.

    The stepping evaluator worked well in the PTSP competi-tion, but has a few aws. Most notably, if the ship must turn inthe opposite direction after collecting a waypoint, initially after collecting it, the value function will be decreasing as the shiptravels farther away from the new target waypoint, and we will

    have . This occasionally results in the driving algorithmnot collecting the waypoint, as states in which it is collected ap- pear worse than states in which it is not. This situation can beseen in Fig. 8 as a dip in reward immediately following the spikefor collecting the waypoint; if the depth of the dip exceeded theheight of thespike, the likelihood is that the controller wouldfailto collect the waypoint. Solving this problem requires careful balancing of the parameters and , to ensure that collectinga waypoint always results in a net increase in value.

    VII. TSP S OLVERS

    This section describes the methods tested for planning theorder in which waypoints are visited. The ordering is crucialto performance, since a good ordering will result in fast andshort routes and a bad ordering may be impossible to traverse(the controller will run out of time between waypoints). Fur-ther, the search techniques used for steering the ship do not planfar enough ahead to nd good waypoint orderings. In all cases,the distance between waypoints refers to the ood ll distancetaken from precomputed distance maps (Section VI-A) and notEuclidean distance.

    A. Nearest Waypoint Now

    The simplest planner tested does not plan ahead at all. It al-ways instructs the steering algorithm to collect the nearest way- point. The target waypoint may change on the path between twowaypoints, when one becomes closer than another. This can leadto indecisive behavior in the controller, the target waypoint mayfrequently change, and no waypoints are collected. All the other planning methods avoid this issue by deciding a xed orderingupfront.

    B. Nearest Waypoint First Planner

    This planner selects a waypoint ordering greedily, bychoosing the closest waypoint at each step. In other words, theth waypoint in the route is the closest waypoint (that does not

    occur earlier in the route) to the th waypoint. Theseorderings may not always be possible to traverse, since the

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    9/15

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    10/15

    40 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    change of direction, the incoming and outgoing vectors point inopposite directions, and so their dot product is 1 (i.e., the costis negative). If passing through the waypoint requires a 180turn, the dot product is 1 (i.e., the cost is positive). andare parameters to be tuned.

    3-opt uses this heuristic in the natural way: when consideringwhether to make a 3-opt move, the value of isconsidered in place of the total path length. Note that if

    , this planner is identical to the TSP planner without physics.

    VIII. E XPERIMENTAL SETUP

    All the experiments described in this paper have been exe-cuted in the set of 20 maps used to run the nal evaluations of the IEEE CIG 2012 PTSP Competition, each map being playedten times. These maps contain 30, 40, and 50 waypoints, whichmakes the problem much more challenging than the maps fromthe WCCI Competition (only ten waypoints). Also, this set of maps permits a straightforward comparison with the other en-tries to the competition. Additionally, the machine used to runthe experiments is the same server from which the competitionwas run (a dedicated Intel Core i5 server, 2.90 GHz, 6 MB, and4 GB of memory), which provides reliable comparisons.

    The experiments presented in this paper analyze the impactof each one of the following parameters.

    Search method: DFS, MC, or MCTS. The parameter for (4) has been set to 1, a value determined empirically.

    Depth of simulations : Number of macro actions used,set to 120, 24, 12, 8, 6, and 4.

    Macro-action length : Each simulation depth is as-signed to one of the following values for : 1, 5, 10, 15,

    20, and 30, respectively. Note that each pair tested produces a look ahead in the future of steps (or single actions). This produces a fair comparison between algorithms that use different values for these two parameters.

    Function evaluator: Myopic evaluator versus steppingevaluator.

    TSP solver: Nearest waypoint now, nearest waypoint rst planner, TSP planner, and physics-enabled TSP planner.

    The experiments have been divided into two groups of tests.A preliminary batch of experiments was run in order to nd agood driver for the PTSP , combining only the rst four param-eters described above. These tests aim to identify those drivers

    that are able to reach most of the waypoints of each map, usingthe simplest TSP solver prepared for this study (nearest way- point rst; see Section VII-A). This also allows us to discardsome of the parameter values that perform worse, in order tofocus the second batch of tests on the most promising param-eter values, where the other three TSP solvers are tried.

    Comparing two executions with several runs is not as trivialas it might seem. The simplest option would be to calculatethe average of waypoints visited and the time taken to do so.However, this might lead to some unfair situations. An examplewould be to have two drivers and that obtain differentamounts of waypoints on average ( and ) withtheir respective times ( and ). Followingthe game de nition of which solver is better (as described inSection II), should be considered to be better than because

    . However, one could argue that is better as it ismuch faster and the difference between waypoints is not too big.Therefore, two different measures are taken to compare results.

    Ef cacy: Number of waypoints visited, on average. Thisvalue is to be maximized.

    Ef ciency: The ratio , that represents an average of thetime needed to visit each waypoint. The problem with thisratio is that it does not scale well when the amount of way- points is very small, or even 0. Therefore, only matcheswhere all waypoints have been visited are considered for this measure. The smaller this value, the better is the solu-tion provided.

    IX. R ESULTS AND A NALYSIS

    This section presents the results of all the experiments per-formed in this research. These results are also available in a doc-ument 1 and in the PTSP Competition website. 2 The documentcontains links to each one of the runs, which detail statisticalinformation and the result of each single match. Additionally,

    the page with the run details contains links, which allows allmatches played to be watched in a Java applet.

    A. Macro-Action Length and Function Evaluator

    The rst batch of experiments analyzes the effects of usingdifferent macro-action lengths and value functions. In this case,all controllers employ the nearest waypoint now TSP solver (asdescribed in Section VII-A). The goal is to be able to identifythe best attributes for the driver.

    Figs. 11 and 12 show the number of waypoints visited usingthe myopic and stepping evaluation functions, respectively,measuring the ef cacy of the solvers. Both pictures include ahorizontal line showing the maximum average of waypoints

    achievable (39), which comes from the distribution of way- points in the maps tested (seven maps with 30 waypoints,eight maps containing 40 waypoints, and ve maps with 50waypoints).

    These two gures show that the myopic approach performsslightly worse than the stepping evaluator function. For bothfunctions, the number of waypoints visited increases when thelength of the macro actions reaches a high value (10 to 20).Table I shows that the number of waypoints visited decreasesslightly when the macro-action length is increased to 30. This phenomenon happens for the three search methods presented inthis paper, suggesting that the reduction of the problem achieved by the inclusion of macro actions leads to better performance.

    In general, DFS performs worse than the other algorithms,and even in those cases where the length of the macro actions issmall (1 and 5), better results are obtained with MC and MCTS.It is also worthwhile mentioning that none of the algorithms isable to reach an optimal ef cacy (39 waypoints). In other words,all methods fail to catch all waypoints in at least one of the 200matches played, which shows the complexity of the game.

    The ef ciency of the controllers is calculated as the average of the ef ciency ratio (time/waypoints) in those matches where allwaypoints are visited. Figs. 13 and 14 show these measurementsfor the myopic and stepping function evaluators, respectively.As explained in Section VIII, this ratio can be misleading if the

    1https://www.dropbox.com/sh/ksxa53qtm5cjsmj/A_wxxMrLGE2http://www.ptsp-game.net/bot_rankings_advanced_f1.php

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    11/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 41

    Fig. 11. Number of waypoint visits with myopic function evaluation andnearest waypoint now TSP solver.

    Fig. 12. Number of waypoint visits with stepping function evaluation andnearest waypoint now TSP solver.

    number of waypoints visited is far from the amount of them inthe maps. For this reason, the macro-action length of 1 is notincluded in these pictures.

    The ratios obtained (the smaller, the better) show again thatMC and MCTS methods achieve better results than DFS, and

    these results are better when the length of the macro actionsis high (10 to 20). However, as shown in Table I, raising thevalue of to 30 provides signi cantly worseresults. In the com- parison between the myopic and stepping function evaluators, better ef ciency is obtained with the stepping evaluator, and, inthis case, the difference is more signi cant (about 30 points).

    Table I shows the numeric results of the tests, for all con- gurations tested, including the standard error of the averagesobtained.

    One point of interest is the ratio obtained when the length of the macro action is 1: four out of the six con gurations are un-able to provide reasonable results. Only MC and MCTS, usingthe stepping evaluator function, are able to visit at least onceall the waypoints scattered around the maps tested. Another in-teresting result is that MCTS achieves the best performance for

    Fig. 13. Ratio time/waypoints with myopic function evaluation and nearestwaypoint now TSP solver.

    Fig. 14. Ratio time/waypoints with stepping function evaluation and nearestwaypoint now TSP solver.

    almost all combinations of macro-action length and value func-tion. MC only gets slightly better results in twocases: number of waypoints visited, using stepping function evaluator, for macro-action lengths of 15 and 20.

    In many cases, the results obtained by each algo-rithm are very similar to each other. For this reason, theMannWhitneyWilcoxon test (MW test) has been performedin order to con rm if there is a statistical difference in thosecases where the results are alike. For the sake of space, notall MW-test results are included in this paper, but the mostinteresting ones are explained here: the tests show that there isstatistical difference between MCTS and the other two methodsfor 15 and 20 macro-action lengths using the stepping evaluator (for , -values of 0.109 and 0.001 against DFS andMC, respectively; and for ). Inother words, this suggests that the lower ratio shown in Fig. 14responds to a truly better performance of MCTS over MC andDFS in these cases. Regarding ef cacy, these methods providethe same results in the scenarios mentioned.

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    12/15

    42 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    TABLE IWAYPOINT V ISITS AND R ATIO FOR D IFFERENT A LGORITHMS AND M ACRO -ACTION LENGTHS , USING NEAREST W AYPOINT NOW TSP S OLVER .

    SHOWING A VERAGE W ITH STANDARD ERROR , BOLD FOR BEST R ESULT IN EACH R OW

    TABLE IIWAYPOINT V ISITS AND R ATIO FOR THE B EST M ACRO -ACTION LENGTHS AND STEPPING EVALUATOR , COMPARING ALL TSP S OLVERS .

    SHOWING A VERAGE W ITH STANDARD ERROR , B OLD FOR OVERALL BEST R ESULT IN V ISITS AND R ATIO

    B. TSP Solvers

    After the analysis performed in the previous section, somevalues for the parameters tested are discarded in order to focuson those t hat provide better results. The goal at this stage isto evaluate how the different TSP solvers affect the controllerstested. In this case, the parameters are con gured as follows:

    search m ethod: DFS, MC, or MCTS; depth of simulations : 12, 8, and 6; macro-action length : 10, 15, and 20; function evaluator: only stepping evaluator.Table II shows the results obtained with all TSP solvers and

    these parameters.Several ob servations can be made about the performances

    shown in these tests. First, the overall best TSP solver is the physics-enabled ood ll planner, obtaining better performancein terms of waypoints visited and ratio of visits. This result con- rms the hypothesis drawn in Section II-B: better performanceis obtained when the physics of the game are taken into consid-erati on when planning the order of waypoints to visit.

    For the best TSP planner, MCTS behaves better than bothMC and DFS in the two measures taken. Regarding the macro-actio n length, a value of 15 provides the best result in ratio of waypoints visited, while 20 seems to be the best choice for theef cacy of the controller. Actually, the controller that obtained rst place in the PTSP competition was the con guration usingMCTS, physics-enabled ood ll planner and .

    Again, statistical tests have been calculated between the mostinteresting values. For instance, ood ll planner and physics-enabled ood ll planner have been compared for MCTS with

    values of 15 and 20. The MW test provides values of 0.015

    and 0.052, respectively, showing a high con dence in the caseof and only a fair indication that the distributions aredifferent for .

    Another interesting result is that nearest waypoint now solver seems to produce better results than the planner version of thesame algorithm. It can be surprising that a planned route of waypoints behaves worse than a version that just pursues theclosest waypoint at any time, but the explanation is again inthe physics of the game. The nearest waypoint now TSP solver only takes into account the distances between waypoints, butignores the inertia and speed of the ship while traveling aroundthe maze. This inertia could take the ship closer to another way- point (which may not be the next one to visit in the planned

    version) but obviously, it could be faster to visit this one insteadof changing the course to follow the plan. A better solution thanthe one provided by the nearest waypoint now solver is obtainedwith the physics-enabled ood ll planner (80.10 versus 81.78,MW-test -value of ), using , which seemsto be the best overall value for the macro-action length.

    C. Analysis by Map

    An interesting comparison between the techniques presentedin this paper is the map-by-map comparative. It is possible thatsome methods behave better in distinct maps, depending on howthe obstacles are distributed around the maze.

    A score system that stresses the differences between maps isthe one used in the PTSP competition (see Section II-C). Thisranking scheme awards points for the rankings on each of the

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    13/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 43

    TABLE IIIR ANKINGS OF THE BEST CONTROLLERS FOLLOWING THE POINT A WARD SCHEME OF THE PTSP COMPETITION . IT SHOWS TEN CONTROLLERS (R OWS OF

    THE TABLE ) EVALUATED ON 20 MAPS (C OLUMNS ). THE NAMES OF THE CONTROLLERS I NDICATE (IN THIS ORDER ): METHOD , NUMBER M ACROACTIONS , MACRO -ACTION LENGTH , EVALUATION FUNCTION , AND TSP S OLVER (FFNP: F LOOD FILL PLANNER ;

    PEFF: P HYSICS -E NABLED FLOOD F ILL PLANNER ; NEAR : NEAREST W AYPOINT NOW )

    Fig. 15. Ratio time/waypoints per map. The smaller the bar, the faster the controller visits waypoints. In maps 18 and 19, not all algorithms are able to reach allthe waypoints in any of the games played.

    maps where the controllers are evaluated. The nal winner isthe controller that achieves more points in total. For every map,the points are awarded as in the Formula One Championship:25 points for the best controller, 18 points for the second bestcontroller, 15 for the third best controller, and 12, 10, 8, 6, 4,2, and 1 for the bots ranking from fourth to tenth controllers,respectively. The distribution of points in this scheme highlyawards the best controller on each map.

    Table III shows the points achieved in each map, following

    the PTSP competition ranking scheme. The controllers shownare the ten best bots ranked this way. It is interesting to seethat the best controller is still the one submitted to the PTSP Competition that ranked rst.

    However, it is not able to achieve the best results in all maps:in map 18, it gets 0 points. (Note that this does not mean that itdoes not visit any waypoint. It is just worse than the tenth con-troller in this particular map.) The best result in this map is ob-tained by the same algorithm but using as macro-actionlength, which suggests that, for certain maps, this parameter iscrucial to obtain a good performance.

    The PTSP Competition scheme favors those controllers thatvisit more waypoints, with the time spent relegated as a tie breaker when the visits are the same. This is the reason why inthese rankings an algorithm that uses the nearest waypoint now

    solver quali es second (as seen in Table II, the ef cacy of thisTSP solver is high).

    Fig. 15 shows the waypoint ratios per map, which allows acomparison of the ef ciency of the different controllers. For thesake of clarity, this picture shows only the best four controllersaccording to the rankings of this section. As can be seen, the best approach generally needs less time steps to visit waypoints,while the second controller often uses more time for this. Someexceptions are maps 4 and 6, where the controller using the

    nearest waypoint now solver provides better solutions. This isstrongly related to the results shown for these maps in Table III,where the best controller does not achieve the best performance.

    Finally, maps 18 and 19 are missing some of the bars for some controllers. These are the cases where the bots were notable to visit all waypoints in any of the matches played in thesemaps, and therefore the ratio calculation is not very descriptive.In these cases, the controllers achieved 0 points in the maps, asshown in Table III.

    D. Performance in the PTSP Competition

    As was mentioned before, the con guration that provided the best results in this study (MCTS, , stepping evaluator function and physics-enabled ood ll planner) was the winner of the CIG PTSP Competition. It would be interesting to see

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    14/15

    44 IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI IN GAMES, VOL. 6, NO. 1, MARCH 2014

    if any of the other con gurations tested here would have wonthe competition anyway, using the results obtained in this re-search. The reasoning behind this test is as follows: in manycompetitions, the controllers and their heuristics are tweakeduntil they obtain the bestpossible performance. One might ques-tion, therefore, whether the winner of this (or any other) com- petition is providing a superior method, or only a very goodheuristic that could work with different AI techniques.

    The document referenced at the beginning of Section IX con-tains links to the potential results that would have been obtainedif each potential controller had been submitted instead ofthe onethat was actually sent. The following lines summarize the sta-tistics drawn from these potential submissions.

    None of the controllers tested would have won the compe-tition using the myopic function evaluator.

    Out of the con gurations tested, all controllers which usedthe physics-enabled ood ll planner would still have wonthe competition.

    Out of those controllers that used ood ll planner (no

    physics), all but one would have nished the competitio n in rst place. Only MC with would not win, rankingsecond instead.

    Only the MCTS controllers that use the nearest waypoint planner TSP solver would have nished in rst position inall cases tested.

    For the nearest waypoint now TSP solver, only 14 out of 36 (38%) would still win.

    In general, 38 out of the 63 different tests performed (60%)would have won the competition.

    Of course, these measures are illustrative, and theymight wellhave been different had the other competitors submitted dif-ferent controllers, but the test still allows the dr awing of someconclusions. For instance, these numbers suggest that MCTS,with the appropriate evaluation function, is the best algorithmsubmitted so far to the PTSP competition. The v alues of todiscard are 1, 5, and 30, but any of the other values (10, 15, and20) produce results that are good enough to win the competition.

    X. CONCLUSION AND FUTURE W ORK

    This paper presents a study of the algorithm that won the PTSP IEEE CIG 2012 competition, some variations of it, andhow the different values for the algorithms constituents affectthe overall performance of the controller. This performance ismeasured in terms of the ef cacy (or how many waypoints are

    visited) and the ef ciency (the average time steps needed to visitwaypoints) of the controllers.

    One of the rst conclusions that this study offers is the factthat using macro actions in the PTSP improves the quality of thesolutions enormously. This is especially interesting consideringthe rather simplistic repeat-T-times nature of the macro actionsused. The macro-action lengths that provided good performanceare valuesfrom 10 to 20, obtaining the best results with .

    It is also worthwhile mentioning that the design of an ap- propriate value function, especially for games like the PTSP where the real-time constraints usually prevent the algorithmfrom reaching an end game state, is crucial in order to obtaingood results. In this particular case, a simple myopic state eval-uator behaves poorly compared with a more sophisticated step- ping evaluator.

    Another aspect highlighted in this paper is the dependency between the order of waypoints and the driving style of the bot,in other words, how the physics of the game affect the optimalsequence of waypoints to follow. It has been shown in the resultsobtained that the TSP solver that considers the physics of thegame achieves signi cantly better results than the others.

    Finally, MCTS has been shown to behave better than the other two algorithms compared in this paper: MC and DFS. Of par-ticular signi cance is the fact that any of the MCTS variantstested in this research, using the stepping evaluator function andthe appropriate macro-action lengths, would have won the CIG PTSP Competition.

    This research can be extended in several ways. For instance,it would be interesting to investigate how the shape of the mapsaffects the performance of the algorithms, and under what spe-ci c conditions some macro-action lengths seem to work better.Additionally, as exposed in this paper, the design of the macroactions is just a simple repetition of actions. It would be inter-esting to develop more sophisticated macro actions and com- pare their performance. Another possibility is to further improvethe algorithms presented: by looking at the results and games played, it is clear that the performance is not optimal. Com- bining MCTS with other techniques, such as evolutionary al-gorithms or TD learning, could improve the results shown inthis study.

    Finally, another interesting test would be to reduce thetime budget further and test how this affects the quality of the solutions obtained. Initial experiments show that at leastMCTS still produces high-quality solutions when the budgetis reduced to 10 ms. Nevertheless, further testing is neededto understand how this limitation affects the search methods

    presented here, as well as nding the minimum budget timethat allows these techniques to keep providing good results inthis and similar domains, where decisions must be taken withina few milliseconds.

    R EFERENCES[1] D. Perez,P. Rohlfshagen, andS. Lucas, Monte Carlo tree search:Long

    term versus short term planning, in Proc. IEEE Conf. Comput. Intell.Games , 2012, pp. 21926.

    [2] R. Coulom, Ef cient selectivity and backup operators in Monte-Carlotree search, in Proc. 5th Int. Conf. Comput. Games , Turin, Italy, 2006, pp. 7283.

    [3] L. Kocsis and C. Szepesvri, Bandit based Monte-Carlo planning, in Proc. Euro Conf. Mach. Learn. , 2006, vol. 4212, pp. 282293.

    [4] C.-S. Lee, M.-H. Wang, G. M. J.-B. Chaslot, J.-B. Hoock, A. Rimmel,O. Teytaud, S.-R. Tsai, S.-C. Hsu, and T.-P. Hong, The computa-tional intelligence of MoGorevealed in Taiwans Computer Go tourna-ments, IEEE Trans. Comput. Intell. AI Games , vol.1, no. 1,pp.7389,Mar. 2009.

    [5] C. Browne, E. Powley, D. Whitehouse, S. Lucas, P. Cowling, P. Rohlf-shagen, S. Tavener, D. Perez, S. Samothrakis, and S. Colton, A surveyof Monte Carlo tree search methods, IEEE Trans. Comput. Intell. AI Games , vol. 4, no. 1, pp. 143, Mar. 2012.

    [6] S. Samothrakis, D. Robles, and S. M. Lucas, A UCT agent for Tron:Initial investigations, in Proc. IEEE Symp. Comput. Intell. Games ,Ireland, 2010, pp. 365371.

    [7] N. G. P. Den Teuling and M. H. M. Winands, Monte-Carlo tree searchfor thesimultaneous movegame Tron,in Proc. Comput. Games Work- shop at ECAI , Montpellier, France, 2012, pp. 126141.

    [8] N. Ikehata and T. Ito, Monte-Carlo tree search in Ms. Pac-Man, in Proc. IEEE Conf. Comput. Intell. Games , 2011, pp. 3946.

    [9] C. Zhongjie, D. Zhang, and B. Nebel, Playing Tetris using bandit- based Monte-Carlo planning, in Proc. AISB Symp. AI Games , 2011, pp. 1823.

  • 8/10/2019 Solving the Physical Traveling Salesman Problem Tree Search and Macro

    15/15

    PEREZ et al. : SOLVING THE Physical Traveling Salesman Problem : TREE SEARCH AND MACRO ACTIONS 45

    [10] D. Perez, P. Rohlfshagen, and S. Lucas, Monte-Carlo tree search for the physical travelling salesman problem, in Proc. EvoAppl. , 2012, pp. 255264.

    [11] E. J. Powley, D. Whitehouse, and P. I. Cowling, Monte Carlo treesearch with macro-actions and heuristic route planning for the phys-ical travelling salesman problem, in Proc. IEEE Conf. Comput. Intell.Games , 2012, pp. 234241.

    [12] A. McGovern and R. S. Sutton, Macro-actions in reinforcementlearning: An empirical analysis, Univ. MassachusettsAmherst,Amherst, MA, USA, Tech. Rep., 1998.

    [13] S. Ontan, Experiments with game tree search in real-time strategygames, 2012 [Online]. Available: http://arxiv.org/abs/1208.1940

    [14] R.-K. Balla and A. Fern, UCT for tactical assault planning in real-timestrategy games, in Proc. 21st Int. Joint Conf. Artif. Intell. , 2009, pp.4045.

    [15] B. E. Childs, J. H. Brodeur, and L. Kocsis, Transpositions and movegroups in Monte Carlo tree search, in Proc. IEEE Symp. Comput. In-tell. Games , 2008, pp. 389395.

    [16] G. Van Eyck and M. Mller, Revisiting move groups in Monte-Carlotree search, in Advances in Computer Games , ser. Lecture Notes inComputer Science. Berlin, Germany: Springer-Verlag, 2012, vol.7168, pp. 1323.

    [17] E. J. Powley, D. Whitehouse, and P. I. Cowling, Determinization inMonte-Carlo tree search for the card game Dou Di Zhu, in Proc. Artif. Intell. Simul. Behav. , York, U.K., 2011, pp. 1724.

    [18] D. Perez, P. Rohlfshagen, and S. Lucas, The physical travellingsalesman problem: WCCI 2012 competition, in Proc. IEEE Congr. Evol. Comput. , 2012, DOI: 10.1109/CEC.2012.6256440.

    [19] P. Auer, N. Cesa-Bianchi, and P. Fischer, Finite-time analysis of themultiarmed bandit problem, Mach. Learn. , vol. 47,no.2, pp.235256,2002.

    [20] L. Kocsis, C. Szepesvri, and J. Willemson, Improved Monte-Carlosearch, Univ. Tartu, Tartu, Estonia, Tech. Rep. 1, 2006.

    [21] H. Lieberman, How to color in a coloring book, ACM SIGGRAPH Comput. Graph. , vol. 12, no. 3, pp. 111116, 1978.

    [22] J. L. Bentley, Experiments on traveling salesman heuristics, in Proc.1st Annu. ACM-SIAM Symp. Discrete Algorithms , 1990, pp. 9199.

    [23] S. Lin, Computer solutions of the traveling salesman problem, Bell Syst. Tech. J. , vol. 44, pp. 22452269, 1965.

    [24] D. S. Johnson and L. A. McGeoch , The Traveling Salesman Problem: A Case Study in Local Optimization . New York, NY, USA: Wiley,1997.

    [25] G. Snook, Simpli ed 3D Movement and Path nding Using Naviga-tion Meshes, in Game Programming Gems . Newton Center, MA,USA: Charles River Media, 2000, pp. 288304.

    Diego Perez (S12) received th e B.Sc. and M.Sc. de-grees in computer science from the University CarlosIII, Madrid, Spain, in 2007 . He is currently workingtoward the Ph.D. degree in arti cial intelligence ap- plied to games at the Unive rsity of Essex, Colchester,U.K.

    He has published in the doma in of game AI, par-ticipated in several game AI competitions and orga-nized thePhysical Traveling Salesman Problem com- petition, held in IEEE co nferences during 2012. Healso has programming experience in the videogame

    industry with titles p ublished for game consoles and PC.

    Edward J. Powley (M10) received the M.Math. de-gree in mathematics a nd computer science and thePh.D. degree in computer sciencefrom theUniversityof York, Heslington , York, U.K., in 2006 and 2010,respectively.

    He is currently a Re search Associate at the Univer-sity of York, where he is a member of the Arti cialIntelligence Group in the Department of Computer Scienceand alsoo f theYork Centre forComplexSys-tems Analysis (YCCSA). His current work involvesinvestigating M onte Carlo tree search (MCTS) for

    games and sequential decision problems with hidden information and stochastic

    outcomes.Dr. Powley was awarded the P B Kennedy Prize and the BAE Systems ATCPrize

    Daniel Whitehouse (S11M13) received theM.Math. degree in mathematics from the Universityof Manchester, Manchester, U.K., in 2010. Heis currently working toward the Ph.D. degree inarti cial intelligence at the Department of Computer Science, University of York, Heslington, York, U.K.and is funded as part of the Engineering and PhysicalSciences Research Council (EPSRC) project UCTfor Games and Beyond.

    He is a member of the York Centre for ComplexSystems Analysis (YCCSA) at the University of

    York. His research interests include games and game AI and he is investigatingthe application of Monte Carlo tree search methods to games with chance andhidden information.

    Philipp Rohlfshagen (M11) received the B.Sc.degree in computer science and arti cial intelligencefrom the University of Sussex, Brighton, U.K., in2003, winning the prize for best undergraduate nalyear project. He received the M.Sc. degree in naturalcomputation and the Ph.D. degree in evolutionarycomputation from the University of Birmingham,Birmingham, West Midlands, U.K., in 2004 and

    2007, respectively.He completed a series of postdoctoral positions inevolutionary computation and games and is now a

    Principal Scientist working for SolveIT Software, Adelaide, S.A., Australia.

    Spyridon Samothrakis (S10M12) is currentlyworking toward the Ph.D. degree in computationalintelligence and games at the University of Essex,Colchester, U.K.

    His interests include game theory, computationalneuroscience, evolutionary algorithms, and con-sciousness.

    Peter I. Cowling (M05) receive d the M.A. andD.Phil. degrees in mathematical sciences fromCorpus Christi College, Unive rsity of Oxford,Oxford, U.K., in 1989 and 1997 , respectively.

    He is a 50th Anniversary Professor of Computer Science and Management at th e University of York, Heslington, York, U.K., based in the inter-disciplinary York Centre f or Complex SystemsAnalysis (YCCSA). His work centers on comput-erized decision making in games, scheduling, andresource-constrained o ptimization. He has worked

    with a wide range of industrial partners, has been a director of two researchspin-out companies, an d has published over 90 scienti c papers in high-quality journals and conferences.

    Prof. Cowling is an Ass ociate Editor of the IEEE T RANSACTIONS ONCOMPUTATIONAL I NTELL IGENCE AND AI IN GAMES .

    Simon M. Lucas (M98 SM07) received theB.Sc. degree from Kent University, Canterbury,Kent, U.K., in 1986 an d the Ph.D. degree from theUniversity of Southampton, Southampton, U.K., in1991.

    He is a Professor of Computer Science at the Uni-versityof Essex, Colchester, U.K., where he leads theGame Intelligenc e Group. His main research inter-ests are games, evolutionary computation, and ma-chine learning, a nd he has published widely in these elds with over 160 peer-reviewed papers. He is the

    inventor of the s canning n-tuple classi er.Prof. Lucas is the founding Editor-in-Chief of the IEEE T RANSACTIONS ONCOMPUTATIONAL INTELLIGENCE AND AI IN GAMES