 endowments of goods initially, but common rules, thank you, all right, and they're going to interact. And what you get is interesting sorts of interactions. You can model things that aren't easily modeled with traditional linear modeling techniques. While working on this agent-based modeling, I came across Alexander Stepanov and Daniel Rose's books from mathematics to generic programming. And I was very much inspired by this. What is this idea of generic programming? Well, first of all, Python is a great language for doing generic programming in. And it has two of the key ideas. One of them is don't repeat yourself, which is what we're trying to do with generic programming. The second thing that really makes it a great platform for this is duck typing. There's our duck. So object-oriented languages have polymorphism built in most of them. So if something is of a list type, if it's an ancestor's list, you can pass it anywhere that list is required as a perimeter. In C++, Stepanov wrote the C++ standard template library. What it allowed was that you could pass in things that weren't ancestors of a common type, as long as they supported the operations that were going on. So, for instance, if your function was going to use greater than and the addition operator, then you could use a template and any type that could have greater than and plus applied to it would work. The parameter didn't all need to be ancestors of the same type. With Python duck typing, that already works. So Python already gets us a ways towards generic programming. This I put up because I noticed when people are doing very important presentations, I always had a long pause and blow. I don't know that this is a very important presentation. I didn't want anyone to feel it wasn't. So what Stepanov and Rose do, they're inspired by abstract algebra, which is taking things like ordinary arithmetic, ordinary algebra dealing with numbers, and abstracting from the fact we're dealing with numbers, and you could be dealing with, for instance, knots, you know, mathematically represented knots, but you could vision them as knots in a piece of rope, and you can add knots. So this operation of addition can be abstracted from how it applies to numbers and can apply to anything that follows the rules of addition. And what Stepanov and Rose are trying to urge programmers to do is think in these terms, these very abstract operations, and set down, capture the pattern of the abstract operation, and then you can reuse it in many different coding situations. So addition can apply to clocks and knots, not just integers or reals. Clock addition, of course, if it's 9 and we add 4, the answer is 1, not 13. And knots, we don't want to go into a discussion of not addition and not algebra, but knots can be added as well. So if we're writing, for instance, a summation function, what Alexander, Stepanov, and Daniel Rose were saying is, we should be able to sum anything where the objects follow the rules of addition, not just numbers where we add them in the way we're familiar with. I touched on what agent-based modeling is earlier. Basically, it's an attempt to capture, it's used often in social sciences, often in biology. For instance, people will model cells as agents and give the cell a set of rules, then they set a bunch of cells going in environment and say what does their interaction amount to? Do we get some kind of, you know, a spread of a disease or some spread of a cancer in this environment of cells? So we want to code individual units and then have them interact and have some outcome emerge that may be surprising to us and see if, following these simple rules, we get this macro behavior. A good example is the movement of a flock of birds. So how do birds do this thing where they swirl around together in the air? Well, it turns out that you could model this by giving each bird fairly simple rules, stay a certain distance off the right wing of this other bird. And if you give them simple rules like this, you'll get flocking behavior. So this is the kind of thing agent-based modeling is trying to capture. Some of the models we've implemented, this is a forest fire model where the black or burnt-out trees, green or healthy, red or fires. A very interesting example of this kind of modeling, Nobel Prize winner Thomas Shelly did this. At first, his modeling technique was to take a chessboard and a bunch of coins and run his model on the chessboard. We can do it a little faster with somewhat bigger sets of agents with the computer. And we want to know Nobel Prize, one of the things they cited was the fact using this fairly simple model where the agents had a rule of shuttles looking at segregated neighborhoods and he's saying, does this mean everyone, you know, we see large segregated neighborhoods in the city? Does that mean everyone wants to live in a segregated neighborhood where 100% of the people are the ethnicity, color, whatever of them? And what he's demonstrated was that all you need is for people to have a preference for not being too much of a minority. So someone might, for instance, be fine if 40% of the people in the neighborhood are Irish like they are, right? But when it drops below that, they start to feel uncomfortable, too small of a minority. That means those people to leave and that drives it below 35%. Now the people who are happy at 36% start to leave and that drives the percentage down to 29% of people who have been happy at 30% leave. So without anyone having a preference for completely segregated neighborhoods, we can get them anyway. This is, we have red and blue agents here and we just give them a minimum percentage. I want to see at least X% blue around me or I'm uncomfortable when I go. And picking percentages fairly moderate like 40%, you can wind up with a fully segregated city. So this is an example of what you do in agent-based modeling. Create these software units, objects with simple rules, set them going, see what the result is. The process of generalization is interesting. My belief, it's not a good idea to start out with a broad generalization and then try to generate your system from that. This is not the way mathematics developed the generalizations that it deals with. It started out with very concrete problems. Where is the corner of your field? How do we put up these stones to capture the sunrise on a particular day? And then gradually went through these increasing levels of abstraction. What didn't happen, sometimes people try to write software it's as if mathematicians devised abstract algebra and then came to some peasant farmers and said, look I think you could find a way to apply this to measure your fields. That's not what happened in mathematics. So what we've tried to do is build a bunch of agent-based models. We had certain commonalities that we had an agent that was going to act. We had an environment we was going to act in. But with just those bare common features we then built a bunch of models and then began looking for commonalities among them and gradually abstracted out of the concrete models useful generalizations. I don't want to go in too much into the particular abstract algebraic structures we're using but in abstract algebra what they've done is built starting from a set you can add axioms one at a time and build up structures about which you can prove more and which you have knowledge of further operations but that are more restricted. So we've been looking at what people have done in abstract algebra and trying to find some level of the abstractions that they've generated that will capture a number of the models we're using. So the forest fire model for instance is the abstract algebraic structure known as a group. The segregation model turns out to be a module. What that adds is there's multiplication by elements. A group has elements that can be added and produce other members of the group. The module adds the idea of a second set that can be multiplied by the group members and produce another group member. In fact what you usually are doing is taking a real number and multiplying it by something like a vector. So from the models we've built we began thinking about what kind of abstract algebraic structures could this model be taken to represent. What we decided to call the general thing we're doing was a prehension and here the idea we're capturing is that in all these models basically you have an agent with some internal state. It's got a goal, a representation of how it's feeling, how its utility is, whether it's a pile too high in the sand pile amount and then it somehow gets a view of its environment. Now for North Whitehead we call these prehensions. We couldn't think of a better word in Whitehead and already used it so as out there so we said okay we'll take Whitehead's term. So I'm in a situation, I have a certain endowment of goods that are giving me a certain utility and I run into this fellow and I see he has other goods and I can trade the goods so I have a prehension of my own state, I see his state and see what goods he has and I decide if I get him an apple and he gives me an orange I'll be better off. Okay, let's skip that. So we have some basic, so looking at this in terms of abstract algebra it gives us some rules. For instance we have closure, a prehension and a prehension will always give us another prehension. Associativity, it doesn't matter what order, how we group these things. So we can take prehension A plus B plus C and that'll equal A plus B plus C. There's an identity element so there's a null prehension. We didn't see anything in the environment of interest to us so our state doesn't change basically. So for when we get up to modules for instance or a billion groups we add commutativity, modules add invertibility. Okay, so this is basically as I said an agent's view of its environment and of its own internal state. Null prehension is nothing is interesting in the environment, I'm not going to change. Invertibility, so if you have a tendency for instance a tendency to smoke but then there's a smoking ban that will cancel out that and set, that will invert it and you'll get back the null prehension. Essentially nothing will happen because the ban will cancel out your tendency. So I'm showing you how we can apply these abstract algebraic concepts to agents. Intensification, we want to take my tendency to want to move to a different neighborhood and perhaps some new factor enters in and that tendency will become stronger. So what we've actually implemented so far has been very interesting. These were existing models and we sought out these abstract structures in them and we've been able to achieve 40-50% reduction in the amount of hope in these models. And this is just starting out. Our feeling is we're going to find many more models that we can fit into these structures. So what we're trying to do, the way these are usually coded, the forest fire model is hand coded so that trees, see if there's a tree next to them on fire, they catch on fire, after they are on fire for one turn they transition to the state burned out, then they stay in that for 20 turns or something then regrow. But analyzing this we saw that this is a Markov chain. We can take transition matrix and you have lightning strikes and usually these are coded in the environment level. We pick a random tree and set it on fire. But what we can do with transition matrix is just set a probability that if you're healthy, green and growing, there's a small probability you'll catch fire and that's like a lightning strike. So we don't need to specifically make code or have a lightning strike. It just enters into the transition matrix and now you can set that as a parameter when you start the model. The number of turns it's going to take you from burned out to healthy is also you don't need to count turns. You can just set, if it's 20 turns, just set a 5% probability and on average at 20 turns you'll start regrowing and that really won't change the behavior of the model. In any case we've had success so far hunting for these abstract algebraic structures behind these models. Doing so has enabled us to have a great deal of code reuse already and having found these structures we're sure is we implement further models that will get a good deal more code reuse. So in any case I recommend Steppenhof and Rose's book to you. I found it fascinating and we've had good luck trying to implement their ideas. Thank you.