# Rolling the Dice to Simulate Resilience

So far I’ve written one or more posts about representing community resilience conceptually (and many other posts), quantitatively (and this one), and visually (and). I haven’t talked about how one might go about algorithmically representing resilience—loss and bouncing back from that loss. None of those other representations allow you to pose “what if” questions and simulate the answers to them. How fast is recovery if you do X and what if you try Y? (Personally, I like Z best.) Well, fear not, there are many ways one can create algorithms in order to simulate resilience.

I’ll grab a subset of algorithms from the simulation model I have been developing for the past decade. It’s called ResilUS. ResilUS uses an approach called Monte Carlo simulation, which is an homage to rolling dice a bunch of times to see how much you win or lose. Basically, there’s an element of chance rolled into the outcomes of the simulation, along with all the fancy algorithm equations. You’ll see below a bit more about the dice rolling analogy. I know, I know. Another post with equations. But there is a picture that really is all you need to look at to get the idea.

I chose these algorithms to not only give an example of potential algorithmic representations but also show how some of the concepts I’ve written about in other posts can be dynamically operationalized (i.e., wind up the concepts-as-toys and watch them go). In particular, I’ll show how the distinction between the capital of a house and the service of shelter (why you have a house) can be simulated.

Inside ResilUS, building reconstruction, BL(t), for households (and businesses) is represented as a time series of logistic step functions  implemented using Monte Carlo simulation. Output values range from 0 to 1, where 1 represents complete reconstruction. ResilUS operates at a time scale, t, of weeks. One step, SS, represents an increment of progress in rebuilding in a respective week. BL at t = 0 is determined by hazard-induced building damage. Rebuilding progress may temporarily or permanently stall or reach full reconstruction (BL = 1). BL is defined by the following equation.

$BL(t+1) = BL(t) + SS$

SS is determined by a generalized building type indicator (BTYPE) that ranges from 0 to 1, with 1 representing the most complex type of building in a particular area. BTYPE has the effect of making the step size smaller for more complex buildings and thus the shortest possible reconstruction time longer.

$SS = \frac{1}{SHORT + LONG*BTYPE}$

The denominator of SS is the minimum possible rebuilding time for a particular building. SHORT is a parameter that represents the minimum possible time to rebuild the simplest type of building in the area, which could be determined via survey of local professionals. LONG represents the additional time required beyond SHORT to rebuild the most complex type.

A step of progress is not guaranteed each week; some weeks rebuilding may stall. Within ResilUS, the probability of making a step of progress each week depends on whether the building has been inspected (INSP), the availability of construction resources (CONSTR), the amount of financial resources (RES), and the service level for transporting construction materials into the respective neighborhood (TRNSn). All values are normalized to range from 0 to 1. Notice that TRNSn is an indicator of service, rather than capital (i.e., the ability to get around, not condition of physical assets). The service of transport of materials is what is important for reconstruction, not specifically the capital used to provide that service. If no inspection has been done, no progress is possible. The remaining indicators are combined to calculate the probability of progress, Pss, using the following logistic function.

$P_{SS}(t) = \frac{1}{1+e^{z(t)}}$

$z(t) = \beta_{0} + \beta_{1}CONTSR + \beta_{2}RES(t) + \beta_{3}TRNS_{n}(t)$

Logistic regression can be used to determine the best fit linear combination of the three indicators as represented by the β coefficients.

Reconstruction progress is simulated using a Monte Carlo realization (dice roll!) for which a uniform random number between 0 and 1 is generated. If the probability of a step, Pss, is greater than the number generated, rebuilding progress increases by one step, SS, for a respective household’s home in the respective week. The process is repeated for each week until BL(t) = 1 or the simulation ends.

The figure at the top of this post presents a conceptual illustration of the algorithm described above.  The probability of recovery progress is determined based on a set of input factors (e.g., CONSTR, RES, and TRNS). For each Monte Carlo realization, the probability is compared to a random number generated at each time step after modeled earthquake. A single step in recovery progress occurs each instance that the probability exceeds the particular random number. The figure shows how simple the concept really is. Develop a curve that defines the probability of transition, calculate a particular instance of that probability, compare it to a random dice roll between 0 and 1, and see if you win or lose after each dice roll. Simple!

Okay, so far we just looked at capital — houses.

But households require the service of shelter, which depend on the built capital of residential buildings, in order to maintain basic well-being. In turn, shelter is not serviceable without lifeline infrastructure services derived from various types of built capitals (for example). Complete reconstruction of a building—capital—does not mean that the necessary level of shelter service (SHEL) is available for a household’s well-being. In this case, complete likelihood that the level of shelter service is adequate is only possible if water, WAT, and electricity, ELEC, service is available. ResilUS currently only considers water delivery by truck as an alternate capital for providing lifeline services; this will be expanded in future work (e.g., to consider backup generators). The probability that shelter service level is adequate is assumed to be 1 if a household is placed in short-term housing, STH, while their home is being reconstructed.

$P_{ SHEL }(t)=BL(t) \, WAT(t) \, ELEC(t), \text{ if } STH=0$
$P_{SHEL}(t) =1, \text{ if } STH=1$

talked about how metal plates could be used to substitute the capital of a boardwalk destroyed by Hurricane Sandy. Well, this is another example of how infrastructure capital can be substituted to provide similar infrastructure services.