Linking the Species to Grow Dynamic Population Models with MATLAB
From the series: MATLAB for Agtech Video Series
A current growth area in stock management (fish within a fishery, trees within forestry corps, or feral animal control) is the use of dynamic agent-based simulations. Agent-based simulations are becoming popular because of their flexibility and power. With relatively simple coding, complex emergent behaviors can accurately represent chaotic real-world systems. For example, a set of agents within a fishery might represent the fish population both spatially and temporally, while other agents represent fishing fleets that make cost benefit analyses to decide whether to fish or not based on commodity pricing.
Walk through the process of building a complex population dynamics model using a plug-and-play coding approach. Using the classic three-species predator-prey model with grass, sheep, and dingoes, you'll create the world in which the simulation runs. You'll also learn how to dynamically generate a food web—so that as you add new species, they can automatically be preyed upon—and how to add mathematically simple rules to generate emergent properties.
Recorded: 16 Mar 2021
Hello, and welcome to this presentation today on linking the species to grow dynamic population models with MATLAB. We're going to be talking about methods to create age-based simulations for population dynamics. But before we jump in, just a quick reminder, if you have any questions, pop them into the Q&A chat and we'll collect them as we go. I can't see them as we're going through this presentation, but we'll get to them through the chat. And if you have any problems with the session itself, please also pop them into the chat and one of our administrators will get around to talking to you and trying to get the system back up and running for you.
So look this is where we're really here today is, I'm going to be using the Classic three species simulation. In this case, we have a predator prey model where we have dingoes that feed on sheep, which feed on plants. And this is a classic problem. There's a number of different methods of solving this and working with it. Like this, the locker of Volterra equations which are first order ideas published back in the 20s, 30s, to study the interactions of these problems.
There's also a NetLogo implementation from Northwestern University which is an early and quite successful agent based simulation. And we also have a shipping example within our MATLAB documentation of how you can use the system identification toolbox to simulate gray box, non-linear time series models. But look, what I'm going to be doing here today, is I'm going to be doing something a little bit differently. I'm going to be working from object oriented approach to this. And the reason I'm going to be doing that is flexibility. So let's jump right down and work through this together.
And so, the idea for flexibility is that we can then make this transportable to different sets. And we we're working on a predator prey animal model here. Do we need to work with fisheries for population dynamics with fish growing and harvesting? We're working in forestry logging regrowth where cellular automata might be more appropriate than an agent. The idea is to introduce flexibility here to make your modeling successful.
So funny thing what we're going to do through here is, I'm going to actually show relatively little code, OK? As what I want a key takeaway here is that your modeling task is going to be really the hard part here. You have to understand the concepts and understand why you want to go to. And then we can the code will generally follow naturally from that.
So the key takeaway is really, leverage the power of object oriented in MATLAB. It's not as scary as it thinks for those of us that haven't worked with it before, and those that have worked with object oriented in other languages, can be pleasantly surprised that MATLAB is fully functional and has the full power of within that context. And we're going to then move to deploy flexible agent-based simulation.
So the key here is flexible. I'm working with these three species model. But what we're going to be going here is you can drag and drop, and drop in your own agents into this simulation framework. And rapidly move from this relatively simple template approach, and build up the complexity of the modeling you need to develop for your simulation. So the key here is we're going to be starting to develop and combine simple elements to build complexity. And it's going to be a theme I want you to think about as we're working through here, is how can I drop my code into here on my agents.
And let see agents in the most broadest possible term. They can be fish, trees, grass, sheep, even people for doing human encroachment studies into wildlife areas. Agent in this term in this context is a very broad concept, so let's just jump right in.
So as a little bit of introduction. My name's Peter Brady. I have a Phd in fluid dynamics and high performance computing. I'm an application engineer here with The MathWorks Australia. I'm based in Sydney supporting Australia, New Zealand. I work within our core product portfolio of maths, stats, and optimization, as well as cloud scale out and deployment of those solutions.
So my background is in numerical simulation and high performance computing. So hopefully bring some value to the discussion tonight for you. And more importantly, I hope to bring some inspiration for you to see yourself doing this in your day to day work tomorrow. So what we're going to cover today. We're going to cover an introduction for why we're here. Let me kind of just give you a big picture of object oriented code in MATLAB. This is not a lecture on object oriented, and I'm going to try and steer clear of code in general.
But what I encourage you to do is contact me afterwards, and download a copy of this code yourself. And have a chat to me. Set up a meeting when we go there. And the way we're going to do this, is we're going to work through two different versions. We're going to work with a grassroots forever model, and then we're going to extend that by adapting and tweaking our agent around to showing how the grass can then die and regrow before concluding our presentation today.
So look why are we here. Look, we're here because agents by simulation is increasingly popular. It's being seen as a effective tool for modeling both small and large scale, complex systems that move beyond simple statistical models. But it can be tough to get started. It can be a little bit intimidating to get going. And that's reflected with a lot of my comments with customers and people in the field that they often say this is an abstract concept often linked to academic pursuits. But that's not just in the case. And I want to discourage you of that thought and encourage you to jump in and get going. Because there are some quite excellent results that can be run through this.
So again what we're going to be working through here today, is we're going to use the classic three species model. Or a predator prey model as a proxy, and we're going to work through that and use that as an example as I developed this and show you how I break down this project to develop and implement the framework to support this model. And then most importantly, the real thing that I want you to remember is that you can use this framework to drop in your own models. You can pull out my sheep. You can pull out my dingoes and drop in your own agents. Just tweak and adapt them.
Or you could just take my framework and add in, keep the dingoes the sheep and add in some kangaroos and look at how the competition for the grassland is affected by adding in some additional herbivores to the system. And remember, coding will be the last step. Always state with start with the thought exercise in the planning before jumping into the code. And I know I'm repeating this, but think before you jump. It's probably my number one tip for getting started today is, it's easy to get bogged down in the code if you don't have a big plan before you go. So just to take a little sidestep into MATLAB before we get started.
Really the development process that I want to go through here is neatly encapsulated by this idea. So in terms of the research and discovery phase to start to think about what you're doing, develop your prototypes verify as you go, and then the power of MATLAB that I'm not going to talk about here, but I'm very happy to as I said I've talked about our support cloud and Skyla, is as we move through to prototype and our confidence in our modeling gets better we move into a production phase. And I think of the life cycle of the model we move into deployment.
MATLAB allows for easy and trivial single click of moving your code out into production systems. And it's important as mentioned over on the side there to think of continuous testing and verification. If you're talking to your IT people they think of terms like CICD and DevOps. They all play nicely with MATLAB and we can all work together in a nice big Catholic family. So thinking more about a progression of programming techniques, it's fairly common to start over on the left of this diagram when we're starting to work with command line and scripting.
And this is just a natural progression as we work through things that prototype to development. But as we move forward, we increase with both the complexity and the power that we get from class-based or object oriented programming. And you get more value out of you as with your data and your algorithm in terms of reusability and powerful computations. But MATLAB is designed to make this easy for you. We have a number of tools that allow you to inspect the class structures you're going through and creating them. So the figure on the right here is actually a snapshot from the project that we're going to get to in a little while.
They allow you to inspect and look at those classes, for look for dependencies and how the classes interact, as well as debug with the interactively throughout your system. Now just a bit of boilerplate I said, I'm going to try and stay away from the code, but you'll see from my source that I'm using a number of constructs here to make my life simpler and sort of tidy, and I encourage you all to do that as well. The two big concepts here is namespace and classfolders.
So namespaces we put a plus in front of the folder name, and that assist MATLAB. Everything encapsulated inside he is within that same namespace. And classfolders allow us to put all our class methods in one folder. And we put that by the act in front of the class symbol of the folder name. So that as our classes get bigger, we have smaller little files with encapsulating individual methods, which is just neater and easier to work with. And finally, source control integration.
I think this is a good way of doing it, like as your models become more complex, source control is a really good skill to learn and it's not that difficult. And your IT people will love you when you start talking terms about it, and CICD and DevOps and how you're doing agile development of your code project.
Now the point of object oriented really is to allow class hierarchies. And class hierarchies allow us to represent our concepts of our real world in extendable and reusable code. So we allow things like consistent interfaces reusable through inheritance and composition. And we're going to see these concepts in practice in a little while. So I'm not going to talk too much about them right now.
And finally a real key power that we can leverage with MATLAB, and this is great for modeling environments is particularly with multistakeholder complex engagements where we're putting management structures onto systems, is we can formally document. Somewhere we can leverage those software development tools to document and leverage how those requirements and those external requirements match into your code development.
And interface control-- this is the final concept I'm going to throw at you at teh moment. So interface control allows you to really write extensible code when you're working. And it separates front end from back end. So imagine myself as a user of this code that I'm going to show you today, a lot of it is template based. And you don't actually have to care how it works. But all you need to know is how to interface into it. So an animal needs to know how to move, it needs to know how to eat. It doesn't necessarily know how or care how the world deals with that. But what we have is we have a consistent interface. OK. Big picture. Let's jump a bit further forward here.
So what we're going to do is, we're going to take this essentially as a thought process as we work through this. And we're going to break down the system and think about it before we get started on drilling and look at algorithms. So let's break this down. Let's think about, what the concepts we need here. So what do we really need to get this guy? Well, I thought of this as a few ways doing it. So first up, we need a world. And this is where our simulation occurs.
How agents live in here for want of a better term, they move around in there. That's where they breathe, die, have some fun. So clearly then if we've got a world where I talk about agencies, we need some form of organisms. We need, whether we're going to use the term of organisms or agent, I think of these as the most broadest definition. Whether they move around within that, they live, they grow, they die.
And finally look we probably need some infrastructure. We need some supporting frameworks around this to handle things like pulling in data in the middle, pulling the data out at the end, doing that IO and those visualization tasks that support us, and make that model so much more useful than just a pure piece of code. So stepping forward then, let's now just take the next step and break these down and we'll look at some detail about those particular components.
So the first component we want to think about is, our world. And clearly we've already said it contains all our organisms. That it needs to a little bit more than that. So we need to do it need to know about some relationships between those models. So for instance the most common relationship we want to deal with at this point is we need, it's a predator prey model. So we need to know who feeds on what, who's eaten by what, and how they interact with each other.
And again, what I was thinking about and how I would approach this is. Try and minimize hardcoded. So let's see if we can later do this automatically without having to worry about hard coding who it's who, and having to force that later on. And then clearly once it's got all these entities inside it, we actually need to have that step or that soulsville logic of how we iterate this world through, and how that world evolves in time. And how we might do it. So that's the key requirements that I thought of for the world.
And this may evolve over time and may be slightly different for you, but this is how I'm approaching this. Now as an aside before we jump too much further forward, we saw that food web represented as a graph in this case. So as just to take an aside out into graph theory, MATLAB has full inbuilt graph and network support. So this allows us to build up really complex networks like some of those graphs poked out on the side there, and we get full, all the power you'd expect from graph theory. So we have shortest path, weighted path, but we can, the key here is I want to say is that, we can leverage this for food web.
We don't have to hard code our relationships. We can dynamically build these up on the fly per simulation. So if we want to move from a three species to a four species in and say a kangaroo or an additional wild dog population that's going to act as a predator for us, we can put that in easily and it'll be dynamically built for us. In graph theory terminology, a node is going to be representing our organism. And our link is going to be eaten by methodology.
Now one other feature of graph theory that we can leverage at this point, is we can actually add in options and we can specify parameters such as link weights. And link weights can be used to represent difficulty of predation. So I've got an example here over on the right is a full species food web, where a dingo may opportunistically feed on sheep or kangaroo who in turn both feed on grass. From a predation perspective, sheep relatively are easier to predate than a kangaroo. So we can use those link weights to specify these predation or other information that we need to encourage within the system.
So an aside the graph theory as when moving back, now let's think. We need to talk. We need to move for our organisms. And remember, organisms in this class of the most broadest class we can class. They're going to be our agents they're going to be our systems. I think being broadly at this case, what can you use? Forest, fish, who knows? Now for this particular three species problem, is the single organism class going to be enough?
Well I was thinking about this. So we've got some grass, we've got sheep, and we've got diggers. So I actually think no, it's probably not going to be enough. And my reasons are that plants and animals are conceptually different organisms. Plants in this framework are fixed in place. They don't move around with animals do move around. Conceptually, the plants are really only going to get eaten, they're going to grow, whereas animals can breed. They can die themselves if they run out of food.
But however they do share some common properties. And we're going to have to leverage that through the inheritance later. So in our OO terms then what we have is we have organisms. And I'm going to refer to this as a super class. It's going to be an abstract. And an abstract class is something that we will never see in practice. It always has to be defined, it always has to have some inheritance, and it always has to be defined by somewhere else. So those subclasses are going to be plants and animals, and they're showing an inheritance relationship where a plant is an organism and an animal is an organism.
And what that allows us to do is we can segment our common properties down into our organism. And we can then just leverage those common properties across both plants and animals. And then in the plant and animal class, we can just define the differences that we need or the additions in the additions in top of an organism that make a plant, or the additions in top of an animal or on top of an organism that make an animal. And one of those additions for an animal, is an animal has a movement.
So we need to be able to tell animals how to move, so that they can be moving in the direction towards food away from prey. So this has a relationship. So we can plug and play and change those movements there. Now we've already said we need a world. This is just going to be a single class. It's going to be containing our environments and our methods for stiffing this environment forward.
So it's going to have some animals. This may change, they may grow, they may die out, they may regret. But we don't quite know in advance whether they're going to be. And finally, in terms of interaction we have some visualization classes. And these visualizations, one or more, depending on what we want, we might want to push out pictures to generate something like the animation I showed at the fast, or we might be running this in a Monte Carlo framework, where we're just interested in looking at getting the raw numbers out of it. So that we can do some pre processing after that Monte Carlo frameworks run through.
So let's drill into this. Version one, grass is infinite. So in this case, this is the classic model. This system is dynamically unstable. It is dependent on the random number generator. So the plots will look slightly different every time. But in general this system will pretty much always end where both systems die out. So we will end up with some sort of a plot like this both times.
So what I do at this stage is, conceptually now I've worked out where I want to be, I've got a rough idea of the objects in the classes and how they're going to interact with each other. And now let's just sort of drill down and have a look at some of these tasks.
So first off, let's think of this through in the same way. So we'll start off with our world. And what does our world have to do? Well a couple of tasks that I think the world has to generate first off is, we have to generate our food web, we have to generate our world grid, and this is what's just been shown on this animation in the writing. And we have to populate that world.
So we have to destroy and distribute, not destroy, distribute our agents around the world and around the simulation to prepare for some sort of prepare and construct them. And construct is a good term in here as much as initialise. Because construct is the object oriented term for building that class and starting an office we construct it.
The other major task that the world has to do is, we have to run the simulation with that world. So we're going to step the animals through. We want to visualize those simulations and do those sort of boilerplate code to make our simulation run. Now when I say generate the food web, we actually say that's let's make our life easy. And let's do that automatically. So how can we actually do that when we think it through. So the way I've chosen to implement that for this stage, is when we define the animals we have a parameter that says what they feeds on.
So in this case, I'm defining some sheep, and I'm defining as dingo's. And we can see the sheep feeds on the grass, and the dingo feeds on the sheep. And what we do then is as part of our world, we have a method. And a method is what the world is a function of the world can execute. And that method processes the animals to generate that directed graph forth.
And I'm going to introduce some pseudocode here on the right here. Because this is a step that I go through as I'm developing my models and my simulations is, before I sit down to start really punching out the MATLAB code that I'm looking at, I just start to think of a process flow as it's going through. So I can describe the algorithm here is, we just step through each animal and the benefit of doing an algorithm like this is, I'm going to go to in this case. But what if I have 10 or 20 different animals in a more complex food web?
So what I do is step through each animal, and conceptually my algorithm then says, does my animal already exist? If not, let's add a node for my animal. And let's check that's next step is find my food. Just my food, is my food existing on the graph, if not, I'll add a food node and then finally, because I've got both me and my food, let's create a link between me and my food. And that's conceptually that the algorithm we can use for creating a food web.
Now the next step is, we've gone through our world process. And we now need to think about what our organism tasks are going to be. So in this case, we're defining by biology property. So animals are going to live, they're going to breed, they're to have a probability of breeding that may not. So thinking about this, what is an organism need to do is we're working through the definition of this case. Well, realistically the minimum requirements we need is how to eat, how to breed or how to extend energy and die. And we can encapsulate those traits. That that's really the critical for an organism at this level.
And then let's start to think about this a little bit further. We've got plans and we've got animals. Well, we've made an assumption to make our life easier at this point. So we only have a grass at this point. And the grass is going to be infinite at this point. So, we don't actually need to worry about it. We don't need to worry about how it's going to die or live, or whatever, because web just going to be, it's just going to be there. We don't have to think about it.
But we do have to also have an additional requirement for animals. We have to code how they move. Because they're going to move around the framework like sheep and dingoes they move, they don't just sit there. And they move around a paddock, they might be constrained by a fence or not by a fence, but they need to move.
OK. So now let's drill down and have a look at those organisms. The first question to ask is, we've got two different organisms here, where we've got plants and animals, and is there a difference between those plants and how they eat? I would have thought about it. But then looking at our herbivores and our carnivores, is there a difference between how they eat. And the answer to that is yes. And conceptually the difference comes down to the fact that as herbivores are moving around our world, the plants that they eat affixed into the grit underneath them.
So the questions the herbivore are to answer or ask is, is there a plant underneath me in which case, yes. I can eat it and I get that corresponding gain in energy from the food that I eat. If there's not though, then they're going to go hungry.
In contrast, though trial carnivores. Carnivores are tracking moving prey, while they themselves are moving around the grid. So their question becomes not am I standing on a prey, is it in that world grid behind me. That is it near enough for me that I can eat from. So conceptually there's a slight difference there, and we need to handle that in our coding as we move through.
So that's our organism. We need to think how to eat. So the next thing we said was how we're going to breed. So how do animals breed? But in this case, conceptually we can start off with a simple model. And we can start simple like I say, and then build up the complexity. So we can essentially flip a coin, and determine if it's heads breed. In which case, the algorithm I've implemented here is, that we will have the energy from the parent and clone the offspring from our parent. So if we have a parent sheep that has 20 units of food, let's just split them in half so we get two new sheep that have 10 units of food each.
But once we've got this framework in place, we can think about a whole lot of things we can add to this. We can change the number of offspring that the sheep may do. We can change the energy distribution between those sheep. We can add even a condition. So if we're working with a kangaroo, and the kangaroo moves into a hunger state. We all know that kangaroos can reduce their breeding rates dependent on their food loads. So we can add in a condition where essentially an understatement if my energy level is below a certain threshold, don't breed, hold that.
So that's where we say we're building that complexity. So the final thing we have to think about at this top level for all organisms, is how do they expend energy and time? Well in this case, it's simple. All our animals burn energy at a fixed rate. So conceptually our pseudocode is for each time step reduce our energy by a specific unit. And if the energy gets low we're at to zero, this organism unfortunately dies. The pseudocode here I showed is one, but it's very easy to have more efficient organisms. So some animals may be more efficient. So a sheep may take more energy per step than a kangaroo. And a cow may take more energy per time step than both of those combined.
So we can extend those options to handle different animals working in concert together and look how they evolve through a system. And then the final thing that we have to determine is how to move. And the inspiration I've taken is based on the original and NetLogo implementation of this three species model. Where the organism tends to move in the same direction, but it can make a random decision as to whether it's moving left or right at each time before it moves in that direction. But again, once we've got this age framework in place, we can think of extensions to add that in. We can add some vision.
So our sheep are just not moving randomly around the board hungry, they can move towards grass. They can stay away from them, but they can also see the dingoes in this model. And they can move away from predators. And Simulink, we can do exactly the same thing for dingoes. We can let our dingoes see where the sheep are, so they can move towards the closest sheep or the highest concentration of sheep to maximize their reward. We can change move speeds. We can even fish, we can even add in some flocking and squealing techniques relatively simply. So that as we've added these objects, so that we can see emergent behavior.
So there's some wonderfully simple voice type models that we can add in to introduce flocking and squealing behavior. And so that we can more accurately represent the complex behavior that we see in natural systems, as they emerge from our code through relatively simple rules. So finally to say that, then that is actually our version one complete. We've conceptually worked through this. We've broken apart this system and had a quick look at how we can sort of pull it apart to go.
And I would be remiss if I don't just quickly jump into MATLAB at this point to actually just show that how the system is running. So this is MATLAB 2021, released a little while ago. So that it's nice and new. And what I'm doing is I'm leveraging some of that power of MATLAB here. So I've created a MATLAB project to containerize and manage all my functions. So let's have a quick look at our projects. We can pull out our dependency analyzer. Now dependency analyzer is a really fantastic feature that's been around for a few releases now, and I encourage you to have a quick look at it if you can.
But dependency analyzer allows us to look at the interaction of all our different functions. So we can say I've got a world, and it's we're stepping plants. These are all the different methods that where I was talking about showing. And the dependency analyzer allows us to show how they interact with each other. And so for instance, if I make a change to my animal, well where does that cascade through? What depends on my animal and what is in turn dependent on it?
But I mentioned class hierarchy. So we can have a look at the different classes and how they interact together, so we can see. Our animals and our plant classes are composed of our organism, and we've got a couple of move structures to work with.
OK. So let's have a quick look at our first script. So our first script is our version one grasses infinite let's have a look at this. So we've got some boilerplate. Now, for development I strongly encourage you to use this construct of setting there of the random number generator to default. So what that does is that means your random number generators that are consistent states, makes debugging easier because these simulations are highly dependent on the random number generator you will get vastly different results each time.
So for debugging let's just leave the random number generators to follow. Now this is how we define the entities. So grass, we don't really have to do much about that. We're just going to call a grass. If we want to call it spin effects, we can just quickly change the name of grass and spin effects. The sheep and the dingo's in this case, and add a little bit more work to classify, but basically the two things the minimum constructs you need is you need to give the name for this particular species. And you need to tell the program who this species feeds on. So that it can generate the food web.
After that, the remainder of this code is boilerplate to just fine tune the visualization. Do I want a particular color for my object as it's moving around? Do I want a particular shape for my object as it's moving around? And then we can see we're using exactly the same construct for our dingoes where we're naming the species. Defining who we feed on, and we're defining some convenient colors and parameters to simulate that animal.
So first step is we construct our world once we've created those. So we're now creating our world simulation, and we've generated our initial time step. So we've constructed our world, we've put our grid around, and we've deployed a number of different sheep and dingoes throughout this world. And they're randomly distributed. We have a method for plotting our food web. This food web is not strictly required, but it's part of the visualization to be able to check and see what's going on, and how our simulation works.
I always encourage you to double check and plot up in this manner, because it's a good just to check to make sure that you haven't accidentally plugged a sheep into a dingo instead of a dingo into a sheep. So just always I suggest double checking.
And then the final method, is to actually just then start to run a simulation. And I'll just keep this off and run the first few timestamps to show what's happening, and then we can say our simulation is starting to step three. Nice and easy up at the front, so we've done the hard work behind the scenes. I encourage, strongly encourage you to download this code, have a chat with me, and start to work this your problem.
OK. So now we've done the first simulation step. We want to extend that to have the next simulation where the grass is finite, but it does regrow. And may end up with a simulation like this, and in contrast to the first which is 100% dynamically unstable and will always result in extinction for all species. This simulation is highly dependent on the random number generator, but it has two states of dynamic equilibrium.
So we're seeing the first state of a boom and bust cycle coming through from step 0 to about 400 or 500 at this stage, where we move through a predator prey boom and bust cycle where the sheep feed on the grass, they breed, and then there's a corresponding lag the predators grow. And like I said, it is dependent on the random number generator, but then we move from about step 500 on where the dingoes have actually died out, and we're moving to an unsteady interaction between the sheep and the grass.
So the trick here is what do we actually have to do to move from simulation one to simulation two. Well, we need a world, we need organisms, we need all those same objects, but we need to tweak a few parameters. So what we have to do first off is, there's actually really no difference to our world constructor. We have to generate a food web. We have to generate a world grid. And we have to populate the world. The only real difference this time is we just tweaking the grass parameter to say grass, might be alive or it might be dead in a regrowth phase.
So that's what we're representing on the right here is this wild regrowth. We are growing up our world and the brown squares represent no grass, with the green representative of grass. But our run iterations and visualizations is pretty much the same. We just have to add an additional step to step our plans through the system. Now generating our food web, no changes. We've already done it. We've put the hard work in, we're able to reuse and this is one of the powers of this code-based approach. We can reuse and leverage that code as we move through.
So thinking more about organisms. The additional for plants only is that plants have an ability to be eaten. And it takes time to run. So pseudocode basically says, am I alive? Yes that can be eaten. If not, no I'm regrowing. And just we need to keep a track of when that plant was eaten, so that we can say if it regrows in 10 times or 20 times steps it becomes available to me again. But as with previous, we have a number of extension options. We can add different energy levels for being a, we can have different regrowth rates.
So if we have a multi forest, multi plant ecosystem with different types of grass, different types of trees, we can add we can extend that food web for the sheep. So the sheep can say we can preferentially feed on grass, because it's easy and we get the most energy for It, as opposed to a tree. Where trees are hard to feed on and we don't get a lot of energy out of it. And we can tune those regrowth rates. So grass regrowth fairly quickly, trees take much longer to regrow. So we can see the ecosystem changing over time and days.
And strangely enough, version 2 is now complete. And I really hope that this is the aha moment. Because once we've put this work into the framework and I encourage you to download my code and try, this basic framework allows us to easily extend and change the system to look at those different parameters and say, how does this model change if I have different types of grass. More hungry sheep, or less hungry sheep. We can even start to introduce concepts such as drought and water availability, and we can introduce a river running through our world grid, and see how the grass depends on the groundwater table and there's more availability of water closer to the river.
So please, see this as the aha moment and say, I can do this. I can sit here and I can use this framework to extend to my task and my problems. So look, in conclusion, I've run through a really quick overview of object oriented in MATLAB. I've used the classic three species predator prey model to address how I go about taking that this is in our web problem. And how we can leverage the power of object oriented to make the success of this extensible.
And we've worked through a couple of simulations on this to say, working with the grass is infinite as shown on the right. Or how long we can then tweak and tune that parameter to say the grass is finite, but then it does regrow from there. So the key for you at this point that I'd like you to remember is that this framework is extensible. I've shown some very simple examples of how we can change the parameters to grass, that we can easily change those objects to represent oceans and reefs. In which case, we're suddenly doing an agent-based fisheries simulation.
We could do trees and woodland and become a forestry model in simulation. This is really only limited by your imagination and your need. We can change the animals if we're following that fisher example. We can make these become fishery fleets, and we can tune parameters as they look at estimates such as how much does it cost to run the fuel to get out to the reef? How far does the different boats have to take? Is that boat more efficient? What's the dollar cost of the market price of the fish? And how much fish can we extract from that?
Simulink for logging operations, we can describe our agents with properties such as how far is it to the mill? How far is it from the depot to the coop where logging at this point? Pick up this code as I've said, this is a framework to adapt to your needs. It's extensible and adaptable.
So finally, you can get started right on this now. Contact us to get a copy of the code, if you don't already have MATLAB download a trial yourself to get started. And bootstrap your project with our consultants. Let our consultants help you drive your project fast. And finally, check out the MathWorks website to discover more. Thank you very much for your time. And I hope to be hearing from you soon to see how this code can leverage your management issue. Thank you very much.