Simulating the Actions of Commuters Using a Multi-Agent System

The activity of commuting to and from a place of work a ects not only those travelling but alsowider society through their contribution to congestion and pollution. It is desirable to have a means of simulating commuting in order to allow organisations to predict the e ects of changes to working patterns and locations and inform decision making. In this paper we outline an agent-based so ware framework that combines realworld data frommultiple sources to simulate the actions of commuters. We demonstrate the framework using data suppliedby an employer based in theCity of EdinburghUK.Wedemonstrate that theBDI-inspireddecision making frameworkused is capableof forecasting the transportationmodes tobeused. Finallywepresenta case study, demonstrating the use of the framework to predict the impact of moving sta within the organisation to a new work site.

In this paper we seek to answer the research question; to what extent can multi-agent technologies combined with access to multiple data sources provide the basis for a framework to model and predict the actions of commuters ? We seek to answer this question by designing a so ware agent framework that can simulate the actions of commuters, and validating it using a case study around commuting for a university workforce and predictions for the e ects of a possible site move. The aim of the framework is to provide a means of combining data sources (workforce data, geospatial data and transport network data) with means of prediction.

Related Work
. Previous studies that look at employer-led travel demand management (TDM) programs find that they can change commuter behaviour to a degree, but they o en require financial investment to provide additional incentives such as free parking and discounted tickets for public transport. For example, (Cairns et al. ) review case studies of UK employers that have implemented a TDM program, and find that commuter behavioural change can be achieved, but it will require the employers to provide facilities such as free parking and travel information display. Similarly, (Meyer ) review various employer TDM programs in the U.S. in the last years, and conclude that some incentives or disincentives must be present to encourage commuters to change their behaviour. Moreover, even with incentives, changing commuter behaviour can be hard if they are already heavily reliant on cars. One of the major issues surrounding the simulation of commuters is the gathering of data concerning patterns of commuting, (McNeill et al. ) attempt to reconstruct commuting patterns by analysing Twitter data, attempting to establish home and work locations for individuals. Some countries, such as the Netherlands (CBS ), have collected such data at a national level through mass surveys. Within the United Kingdom, the National Census taken every years records information regarding, home and work locations and the means of travel between them. Visualisations of commuting patterns (based on the census) may be viewed online at (DataShine ). Because of the low frequency of the census the commuting data is not generally timely enough to be used in work such as this. .
A way to reduce commute time and travel demand without incurring additional cost to the employer is by providing the workers with more flexible work hours or work locations. (Sundo & Fujii ) study the e ect of a compressed working week (shortened working week with extended daily work times) on the activity-time patterns of employees of the University of the Philippines. They found the two-hour increases in the compressed working week workday substantially changes commuters' activity and travel patterns. During the compressed working week, commuters reduced household activities, sleeping time, and pre-work preparation time. Their commuting time is also reduced significantly due to changes in departure times. (Ge & Polhill ) show that under certain conditions, flexible work schedules are more e ective in reducing commute time and commute time variability than building new transport infrastructure. Multiple studies shows that flexible work schedules which allow commuters to avoid travelling at peak times can significantly reduce congestion and average commute time (Komma & Srinivasan ; He ; Zhang et al. ). Finally, (Ge et al. ) shows that giving workers more flexibility in their work locations could reduce commute time and commute patterns under certain social environments and corporate cultures, but could also lead to unintended consequences in others. .
The e ectiveness of employer-led TDM programs depends highly on the type and nature of the organization in which the program is implemented and the existing transport infrastructure. For example, (Aoun et al. ) looks at The American University of Beirut (AUB) located in the city centre of Beirut, Lebanon, which has a markedly di erent TDM program than the campuses from most developed countries. Because of Beirut's insu icient public transport and ine ective law enforcement, and the relatively wealthy population and thus higher car ownership on campus compared with the rest of the country, standard strategies used in the developed world such as subsidized public transport, and restricted or priced parking are considered unsuitable there. As a result, the authors conclude that campus transport services do not always have to rely on existing public transport services. Rather, they proposed that a dynamic taxi-sharing scheme could be a more e ective solution in that case. (Van Malderen et al. ) look at TDM programs of companies in Belgium and find that the e ect of a program di ers by the size and location of the employer. For example, the promotion of bicycles suits small workplaces best, whereas the promotion of public transport suits large companies located in city centres best.
. This paper introduces a framework which is designed to address a number of shortcomings in literature. Our framework is implemented using theJava programming language. An alternative platform for implementation of simulation aspects of this work would have been the Multi-Agent Transport Simulation (MATSIM) (Horni et al. ). MATSIM is primarily an application for simulating transport networks. MATSIM allows agents to follow pre-determined travel plans within the network. For this application Java allowed a greater degree of flexibility as the agents and their associated behaviours are written in the Java language, in particular the speed of the simulation may be increased by not having the overhead of a large package such as MATSIM. We obtain our journey times (by various modes of travel) from an external source (TravelLine Scotland) rather than through simulation of journeys using MATSIM. Our framework will be capable of accepting travel data (e.g. journey times, costs and pollution estimations) from a variety of sources. It will be capable of being easily expanded to incorporate data sets that may become available in the future. By utilising a multi-agent system it will be possible to modify agents (e.g. the commuters or data sources) to take account of new policies and incorporate them into the solution.

The Commuting Problem
Edinburgh Napier University data . In this paper we use Edinburgh Napier University (ENU) as a case study. At the time of the study ( ) the University employs just under sta located at three campuses across the City of Edinburgh, Scotland. We consider University employees rather than students; employees are likely to represent a more generalised instance of a commuter compared to students. .
In order to utilise the University as a case study the authors have access to two datasets, firstly the results of an annual travel survey conveying the existing commuting habits, and secondly an anonymized dataset derived from employee records that contains ome and work postcodes for each University employee. The postcode dataset may be used to specify problems in terms of the numbers of employees that need to move between home and work. The travel survey data may be used to validate the results of any predictions carried out.
. The travel survey questionnaire was not designed for this project, but gives some insight into the nature of the problem from the perspective of individual commuters. The survey contained responses from sta members from a total of eligible contributors. An indication of the transport modal split of commuters within the survey is presented in Figure . We note from this that over % of journeys are car based, with the second most popular form of transport being bus/tram.

.
The survey results were then divided into the three workplaces (Merchiston, Craiglockart and Sighthill) at which the University employs sta .
. The travel survey contains eight commuter attributes that might influence travel mode:
It should be noted that the travel distance question was answered directly by the user, as a numerical value, and hence should be considered as perceived distance. UK postcodes comprise two main sections the outward code and an inward code, e.g.the code EH DT has an outward code of EH and an inward code of DT. The outward code specifies a district ( ) within the City of Edinburgh district (EH), the inward section specifies a specific building or buildings. We can therefore treat postcodes as specifying the home location to a set of buildings or using only the outward code specify an area within the City of Edinburgh or surrounding area.

Decision tree analysis of the survey data
. Decision Tree analysis was applied to the survey data to establish the influence of any of the items on travel mode choice. Decision trees were constructed using the J algorithm as implemented within the WEKA (Hall et al. ) package. The data was divided into the three workplaces. A tree was constructed for each workplace by using -fold cross validation in order to minimise over fitting. .
When applied to the Craiglockart data, WEKA used the Postcode field as the splitting criterion, which created an leaf tree, resulting in rules that associated a specific postcode with a travel mode and a more general rule, that all journeys more than miles should be classified as a car journey. This tree correctly classified only % of instances.  .
The algorithm was reapplied using only the outward section of the home postcode in order to force the algorithm to find more general rules. This, however, resulted in the algorithm classifying all journeys as car travel, which allowed % of instances to be correctly classified. .
In the case of the Sighthill employees data, J creates a decision tree that classifies all commuters as car drivers, this leads to % classification accuracy. For this dataset, using only the outward section of the postcode makes no di erence.
. When applied to the Merchiston employees dataset, a more complex tree was created when presented with the dataset containing the full postcode, as shown in Figure . For a commute distance between and miles, a commuter will drive, or if over miles use the train. A distance of less than miles is classified as a bus journey. However, this tree only classified % of commuters correctly. .
When presented with only the outward section of the home postcode the tree shown in Figure is generated. This tree increased the classification rate to . %. Note that a perceived journey length of miles is still significant for car use, but those walking to work (< . miles) can now be identified.
. Figure is applied to all three datasets then we note that % of Craiglochart journeys were correctly identified, rising to % for Sighthill based sta . Applying the tree to the entire dataset results in % of journeys being correctly identified.

If the tree shown in
.
If we consider all employees regardless of site the tree shown in Figure is created. The useful conclusion is that the tree splits on perceived distance. This tree classifies commuters across four travel modes: train, car, bus and walk. Overall a prediction accuracy of % is achieved by this tree. .
The tree analysis suggests a number of issues which need to be taken into account when constructing an agent- Figure : Combined tree that considers all employees together regardless of their site.
based system. Firstly, there are cut o distances of . , and miles between modes. But it should be remembered that values entered are based on the users' perceived distance -it may be the case that users tend to associate distance with time. We also gain a possible hierarchy of modes based on perceived distance/time being walking, bus, car and finally train. From a practical perspective this makes sense, employees living close to a campus are likely to walk, while the comprehensive bus network in Edinburgh is likely to be attractive to many commuters who live out with walking distance. Edinburgh has little suburban rail network, hence rail is only an option for longer distance commuting from outside the Edinburgh area.

Model Design and Implementation
The commuting process . Our model of commuting takes an organisational view, based on modelling the activities of commuters belonging to a particular organisation. Previous research (see above) has examined commuting from a broader geographical perspective, but such approaches struggle to model, realistically, the choices of individuals. By concentrating on the employees of a specific organisation we can more accurately model the choices of individuals. .
In this paper we will view commuting as the journeys made by members of a workforce to and from their place of work. We will concentrate on forecasting modal choice, i.e. whether an individual uses car, bus, train or walks to work. We do not, at this stage take into account the departure times for the commuting journey. In terms of planning, it is useful for organisations to know the mode of travel most likely to be adopted by their employees when commuting.
Model structure .
The model design presented is based on the fundamental principles of one agent representing one human commuter. At present the model concentrates on the choice of transport mode. Figure shows the basic structure of the model.

.
To support the agents in making their decisions, there are two aspects to each travel mode; . Information of the availability of travel and the likely travel times; . Feedback on the outcomes to an agent of its modal choice.
. Aspect one is dealt with the the Modal Travel Oracle agent (MTO; Figure ). The role of the Oracle is to answer travel-related queries from an agent. The MTO encompasses data sources containing timetable and other realworld information concerning travel times and costs associated with that travel mode. The data within the MTO is based on ideal travelling conditions and does not take into account congestion or other forms of delay.

Agent communication .
Upon commencing the simulation the agents initially contact the TM in order to establish which travel modes are available within the simulation (see Figure ). The TM contacts each MTO for journey details. Each MTO responds with journey details, if that mode is valid -some modes e.g. bus or rail are not open to all agents as no appropriate service exists. Having had a response from each MTO the TM responds with a list of all available travel options for that agent. This initial list of travel options is used for form the agents' initial set of beliefs.
. Each simulated day the agents receive feedback based on the previous days travel (see Figure ) -except in the case of the first day.

Decision making .
Within the model of commuting being discussed here, each agent has to choose the travel mode to be used when commuting.
In the examples examined within this paper there are five modes available. Each agent must model the human-like decision process involved in choosing a travel mode. The commuter agents will use the Belief-Desire-Intention (BDI) model (George et al. ). BDI is designed to replicate the processes used by humans when making a decision, based on the following concepts: • Belief -What the agent knows about the world • Desire -Things that the agent would like to achieve • Intention -Things that the agent could do (options) In the case of commuting the agent should choose between travel modes, picking the one that a human would pick given the same journey requirements. Each agent will make one decision for each simulated day, at the end of each simulated day the agents' knowledge will be updated based on feedback received about how their journey went, which may lead to a modified decision. We recognise that the decision to walk may be made on di erent criteria, as it may be considered a lifestyle decision. Therefore within our BDI mechanism we allow each agent a specific belief regarding their pre-disposition for walking to work.

BDI for commuters .
We implement BDI tailored to the commuting scenario. At present, we base our decisions on travel modes. Our BDI model is then defined as follows: • Beliefs -The travel time for each possible travel mode • Desires -The need to travel to/from work in a minimal time

• Intentions -Available travel options
The range of possible intentions will be governed by factors such as availability of public transport or the practicalities of active travel modes (cycling and walking).
Our BDI framework is described in pseudo code in Algorithms and . Algorithm describes the initialisation of each agent, essentially each agent queries the TM to find out the basic journey options available for each mode. This provides the agent with a basic set of beliefs about the journey times for each mode of travel. An agent has a belief that it has a certain probability of adopting walking as its preferred mode of travel. The likelihood of walking is set by the function toWalk(), which can set the probability based on Ge and Polhills' ( ) formula or based on an arbitrary distance/time to work (as suggested in Figure ).
Although the BDI mechanism is executed each day (see Algorithm ) a patience variable is incorporated within the mechanism to limit the number of times the BDI mechanism can force a change in mode. The patience value provides a tipping point for agents changing mode (see Algorithm ): the larger the patience value the more days an agent will tolerate travel issues before changing mode.

Algorithm :
The initialisation phase of the agents' BDI mechanism message(travelManager, getMyTravelOptions); options = getReply() ; for journeyOption in options do beliefs.add(journeyOption.mode, journeyOption.time); intentions.add(journeyOption); end currentMode = findQuickestJourney(); patience = rand( -) // Days agent will put up with sub standard journey; predisToWalk = toWalk(); The daily BDI decision making mechanism is outlined in Algorithm . At the start of the process the agent seeks feedback on the previous days activities from the TM, the architecture allows for a list of feedback messages to be sent. Feedback specifies increases or decreases in time, cost or emissions associated with a journey as determined by the appropriate MTS agent. Currently only travel times are used, details on emissions and costs will be added during future development. The changes in time are added/subtracted from the journey time held by the commuter agent within its beliefs for that mode of transport. This allows the calculation of journeyT ime representing the actual time taken the previous day. If the journey time has increased then the patience value is decremented, if it has improved then the patience value is incremented. Once the patience value is updated, the journey time held by the agent within its beliefs is updated to take account of the feedback. If the agent has a journey time with its beliefs that is less than journeyT ime then the agent decreases the patience value. The agents' beliefs are updated to take account journeyT ime.
If the patience value has reached then a change in mode is initiated for that day, with the mode switching to whichever the agent believes has the quickest journey time.
The patience value stops the agent from changing mode too frequently. A journey that the agent believes to be longer than by other modes will be tolerated for a few days (depending on the initial patience value) and depending on the actions of other agents may improve and thus not require a change in mode.

Algorithm :
The BDI implementation utilised by the authors. This represents the mechanism used by each agent within every simulated day. The prototype framework (as described in Figure ) has been implemented using the Java programming language. The data used within the simulation may be split into two categories, employee data and geospatial data. The employee data is based on that outlined earlier. We treat each site that University employees are located at as a separate problem, the size of the problems may be seen in Table . Site Sta Merchiston Sighthill Craiglochart Table : Sta numbers at the sites modelled. .
The authors also have available to them the results of a travel survey that recorded the travel habits of ENU sta . Within the survey members of sta responded and indicated their current means of commuting. The modal split for commuters at ENU, based on survey results is shown in Figure . .
As well as data concerning the agents, the model also requires geospatial data, this will be used by the MTO and MTS agents to allow them to provide realistic feedback to the agents. The principle source of road-network data is Open StreetMap combined with the GraphHopper library (see: GraphHopper Directions API with Route Optimization). Table shows the principle sources of data used. TravelLine Scotland data is accessed via their bulk journey planner which allows transport options to be downloaded en-masse for a collection of journeys. The GraphHopper templates for Car, Cycle and Walking were used to produce journey times for these modes. Note that in this application the journey times are fixed,

Methodology .
Three problem instances were created based upon the ENU site data, each of which would be simulated for days, with the BDI mechanism taking into account journey times. The aim is to have the agents achieve a modal split that is comparable to that shown in Figure . Our aim is to be able to simulate trends in modal choice across the entire workforce. .
A major constraint on commuting by car is the limited availability of parking spaces at the sites. Figures were obtained for each site and were added into the car travel MTS agent. The MTS agent notes the car journeys to a site and their arrival time, spaces are allocated on a first-come-first-served basis and once the car park is full the remaining agents arriving by car receive feedback comprising of a minute time penalty, designed to represent the time taken to find a parking space in an adjacent street and then walk back to the workplace. A similar mechanism is in place for cyclists as a limited number of cycle storage spaces are available at each site. A smaller minute penalty represents the time cost of finding another location to store the bicycle. Cycling has a minute fixed time cost added to all journeys to work to represent the time to change clothing upon arrival at work.
For those who may wish to reproduce the results in this paper or undertake similar simulations of their own, the source code for the framework is available online . The Edinburgh Napier Travel survey results are not available, but users may source their own problem instances. Geographical data from Open StreetMap (Haklay & Weber ) is available for download directly from Open StreetMap. Public transport journey details are available from TravelLine Scotland, other sources of public transport data could be adapted for use with the framework.  to reduce the error (in brackets) as far as possible. The first attempt shows a poor result, especially within car use. The car use times were based on the journey times generated by GraphHopper, but such journey times are based on a free-flow road network. An empirical comparison between sample journey times produced from GraphHopper and a commercial journey planning tool which takes into account congestion suggested that, in general, journey times were a factor of three times greater when congestion was included. The Car MTO agent was modified to increase journey times by a factor of three, representing a congenstion factor. The e ect of introducing the congestion factor be viewed in Table . Making the choice to walk .
As discussed earlier we treat the choice to walk as being a special case, with each agent being predisposed towards walking to a certain degree. We use two methods of determining the level pre-disposition to walking. The first is the method used by (Ge & Polhill ), the second is simply having every commuter within a specified time radius walk. Ge and Polhill determine the probability of an individual walking as P (walk) = where t walk is the time to walk to work.  (table ) across modes on all three problems ( . %). We note that Ge and Polhill's method with radius . is less accurate at purely predicting walking than the radius method, but the radius method improves accuracy on this at the expense of much less accuracy on the other modes.

Case study .
As stated previously, the purpose of this simulation is to denote trends in commuting and assist organisations in setting policies. Within ENU there is a proposal to relocate one academic school from the Merchiston site to the Sighthill site.
. The original data supplied by the University recorded each individual's department/school within their place of work, making it possible to identify those individuals who will be a ected by the proposal. A set of modified data files were thus created with the appropriate members of sta relocated to the Sighthill site. The e ects of the move, as predicted by the simulation, may be seen in Tables , and . Our interest lies in the trends shown in Table , which suggest a rise in car use, a rise in bus use and a significant reduction in walking. The department at Merchiston has been established for many years and anecdotally, many sta live locally and walk to work.
The travel modes used by those who would be a ected by the move are given in table , note that due to the very low response rate, this must be regarded as anecdotal, but it does suggest significant bus/bike/walk use. We can analyse the distances travelled by those who would be moving (the distance being the distance through the street graph taking the shortest possible route). Of those moving % live km or less from campus and are likely candidates to walk/cycle a further % live between and km from campus and are likely to use non-car based travel. If the move takes place, many of those who walk to work, will not be able to continue walking hence the increase in car and bus use.   Table : The before and a er results for the simulated sta move.   Table : The predicted net changes in mode over both sites a er the move.

Conclusions
. In the introduction, the research question "to what extent can multi-agent technologies combined with access to multiple data sources provide the basis for a framework to model and predict the actions of commuters?" was asked. This paper has proposed a BDI based agent framework for modelling and predicting the actions of commuters. The results presented demonstrate that the framework can simulate commuters to a reasonable level of accuracy. This initial work has concentrated on modelling the modal choice of commuters. Conversations with planners and corporate sustainability experts has suggested that predicting travel mode is potentially the most useful outcome from the simulation. .
The framework allows workforce data and transportation data to be utilised and a BDI based mechanism used to model the decisions of individual commuters. The University case study demonstrates that the basic version of the framework discussed in this paper is capable of predicting travel modes to a reasonable degree of accuracy. The current extent of the simulation is to predict travel mode, but predictions of factors such as time, costs, pollution and congestion will be possible as the system is extended to include further data sources allowing more detailed information and feedback to be incorporated.
. We believe that this work represents a significant improvement on the earlier work by Ge and Polhill in that it includes public transport within the model and has the facility to have additional modes of transport (data sources and feedback criterion added).
. Future work to be carried out includes extending the belief system to take into account other factors, an important consideration is whether all agents should place the same weight on di ering factors -e.g. some will individuals will place a higher emphasis on environmental impact. This raises the question as to whether all agents should have the same belief mechanisms or whether a variety should be used across the simulated workforce.

Notes
The so ware is in a GIT repository at https://github.com/Zoeoeh/Napier-Commute