Pandemic Activity Modifier (Part 2): Activity Plans

Introducing activity plans and how they can be manipulated using PAM

Fred Shone
Arup’s City Modelling Lab
5 min readMay 20, 2020

--

Fred is a data scientist at Arup working on machine learning and city modelling.

The Pandemic Activity Modifier (PAM) is our little open source effort against COVID-19. Like what you see? — check out our project repo.

This post is to help you get up to speed with Activity Plans with PAM and sow a few seeds of inspiration about what is possible. This is the second part of a series on PAM:

Part 1: Pandemic Activity Modifier: Intro

Part 3: Pandemic Activity Modifier: Applying Complex Policies

Activity Plans

Activity Plans are the core medium of information in PAM. Activity Plans hold information about who, what, where, when, how and even why. But how do we build these plans and what do they look like?

Example Activity Plans

The remainder of this article will go through in some detail how to define Activity Plans using the PAM API. However, for most use-cases, building plans in such a way is not necessary — PAM has methods to read and write plans from various traditional transport formats, including trip diaries and MATSim plans. We also support a host of other outputs for analytics and further modelling. For example you can export activity plans as conventional origin-destination (OD) matrices.

PAM read and write ecosystem

Creating Activity Plans from scratch

Activity Town

Firstly, welcome to Activity Town! Now let’s add some people…

Introducing Billy

Billy lives in Zone A and works in Zone G. Her Activity Plan for the day is a simple tour from home to work and back again. If we were to create Billy from scratch using PAM, it might look a bit like this:

Billy’s simple Activity Plan

In PAM, Activity Plans are stacks of activities with legs in between. Activities have a certain type, e.g. “work”, take place at a specific location and have start and end times. Legs have modes, e.g. “public transport”, start and end at specific locations and have start and end times.

Consistency in plans is important, people must start and stop neighbouring plan components at the same times and at the same places. We note that it is nice and convenient when plans close, i.e. have the same activity and location at the start and end of the day, and ideally that activity be “home”. But we don’t enforce this in PAM — for example PAM can accommodate night shift workers, visitors who never go home and non complete tours, i.e. tours that don’t start or end at the same location.

The Smiths

Real Activity Plans are generally more complex and people often belong to households. Consider then the other members of Billy’s household — Bobby and Bradly. Bobby goes to school in Zone B and Bradly works in Zone C. In the evening, once Billy has returned the car, they return to Zone B to do some shopping:

The Smiths’ Activity Plans — Billy, Bobby and Bradly

Households are important to PAM. People in a household often travel together and share resources (like cars). When we apply policies to change people’s behaviour, this logic often revolves around the logic of the household — someone needs to go shopping, everyone needs to quarantine and so on.

Populations

PAM can combine hundreds of thousands of unique households to represent whole populations. In aggregate this gives us a glimpse of big trends like densities, facility use and travel. PAM can help with some of these outputs or you can output disaggregate summaries and do your own analysis.

Population in aggregate — people (top-left), facilities (top-right), travel (lower-left), densities (lower-right)

Looking at the population in aggregate is useful and more pleasant than dealing with loads of unique Activity Plans. But if we want to make logical and detailed changes to people’s behaviour then we need to work at this disaggregate level. Even simple modifications like removing a work activity can have complex impacts depending on the individual or household — what if someone used to shop in their lunch break? What if they drove someone else to work? What if they used to pick up someone on the way home?

The PAM API helps deal with this complexity in a powerful and flexible way.

Next Steps

PAM is an open source (MIT license) python project on GitHub. It is work in progress but has a stable API and is maintaining over 80% test coverage.

We’re still busy adding functionality and documentation — if you like what you see and want to get involved or make use of PAM then please get in touch — citymodelling@arup.com

--

--

Fred Shone
Arup’s City Modelling Lab

Technical Lead @ Arup City Modelling Lab. Making simulations really big and really useful.