Ask Python Expert

Practical Computing for Scientists Assignment -

Object-oriented programming and Individual-based Simulation Models: Lotka-Volterra Predator-Prey Interactions

As we have been working on in class, individual-based simulation models are powerful tools for exploring all kinds of hypotheses about how natural systems function. In order to use these tools, however, you must understand how object-oriented programming works and how programs can be written to "model" natural systems. In class, we worked on a single organism population model, but now we will progress to one in which we will examine a more complicated dynamic.

Predator-Prey interactions have been an important areas of research in the field of Population Ecology for a long-time and one of the classic examples in this field are Predator- Prey interactions as described by Lotka-Volterra equations. The Lotka-Volterra equations were analytical solutions (partial differential equations) derived to describe a system where there existed only two populations of species, a predator and a prey species:

438_figure.png

where x is the number of prey (for example, rabbits); y is the number of some predator (for example, foxes); dy/dt and dx/dt represent the growth rates of the two populations over time; t represents time; and α, β, γ, δ are positive real parameters describing the interaction of the two species. Overall, these equations yield the following dynamic of a harmonic relationship between the two species:

176_figure1.png

For your assignment, you will be altering a provided "population" Python script similar to one we worked on in class to re-create this dynamic, but from an individual-based modeling perspective. There are two options you will have to set when running the program: 1) where to do a parameterization run or not ('Y' or 'N'); 2) how many iterations to run on the model. To complete this assignment, do the following:

1) Add a "Predator" class (called "Predator") to the population.assignment.py script. It must have variables for "age" and "offspring" that are initially equal to zero, a method called "reproduce" that changes the number of offspring each Predator has to 2, and a method called "changeAge" that changes a Predator's age to increase by 1.

2) Fill in all the blank comments throughout the program. These are lines with only a "#" on them. Explain what is the purpose/action of the code following each of these "#"s. FYI: "pop" method for lists removes an item from the end of the list each time it is called.

3) Add code to use the matplotlib package to create a single line plot with two line for lists that track the Prey and Predadator populations, respectively. Run the program with parameterization turned off ('N') and 1 iteration. You should see Lotka-Volterra-like behavior.

4) Change the line of code that is currently shown as:

if(PreyPop[i].age>=PreyAgeReprod and len(PreyPop) < Q ):

to

if(PreyPop[i].age>=PreyAgeReprod):

Create a line plot from the results. Compare it to the previous line plot. How are the two plots different? What is the role of the variable "Q"? Do the Lotka-Volterra equations from the introduction have variable "Q"? Which model to you think is more realistic and why?

5) Models are great for figuring out what values are reasonable for variable you might be interested in knowing about if you trust your model. For instance, say you were going to allow hunting on foxes, how much mortality would you be able to tolerate from hunting mortality? To figure this out, we can use a simple model "parameterization" method. The basic process is to propose a random value for mortality and then test to see if the model is viable under this new parameter. You will notice there is a "Parameterization run" as a raw input switch in the code.

Change the model code back to what it was before you changed it in Part 4. Run the code and turn it on (answer 'Y' to 'Parameterization run?' question) and set number of iteration for the model to 10,000. This will take some time to run.

To parameterize this model for the hunting of foxes, you have changed the model to one that includes mortality due to hunting on the "fox" predators. It also changes the model so that it will only consider a value hunting mortality rate as viable if as the population stays above at least 20 individuals, which we will assume to be the minimum number of foxes to allow the population to persist.

This parameterization run will output a frequency histogram for viable values for hunting mortality that allow fox population to cycle for the 50 years of the model and have a final population greater than 20.

Describe precisely how the probability of foxes dying from hunting (i.e. HuntMortRate) is being generated and examine the output by generating a frequency histogram of the data. Examine the resulting histogram and report what is reasonable rate of harvesting for foxes that allows for population persistence and what ranges are likely to drive the species to extinction?

Attachment:- Assignment Files.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M92765701

Have any Question?


Related Questions in Python

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

Python programming assignment -you first need an abstract

Python Programming Assignment - You first need an abstract base class, called, Account which has the following attributes and methods: accountID: This attribute holds the ID assigned the account , if not provided set to ...

Learning outcomes lo3 - research develop and document a

Learning Outcomes LO3 - Research, develop, and document a basic security policy, and analyse, record, and resolve all security incidents LO4 - Identify and assess the threats to, and vulnerabilities of networks Assessmen ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As