pl

Description du projet 2024-25

2024-25 Project - General presentation
Predator-prey model simulation
Prey detection through vibration


But

Through this project, you will learn to create a complete program that is larger than those you have worked with until now. Your program will also include a graphical component. From a computer science perspective, this project aims to consolidate your programming knowledge and help you practice the essential concepts of object-oriented programming: abstraction and encapsulation, inheritance, virtual methods and polymorphism.


item item item
images from : https://fr.vecteezy.com/photo/48134543-une-lezard-est-seance-sur-le-le-sable-dans-le-desert-contexte and https://www.vecteezy.com/free-photos/scorpions

1. Introduction

The goal of this year's project is to give you a modest introduction to the worlds of:

  1. the simulation of animal population dynamics [1] in a "predator-prey" context;
  2. the simulation of neural models related to complex animal behaviors.

Your goal will be to simulate the coexistence of lizards and scorpions in an "ecosystem." Scorpions feed on lizards, which feed on cacti.

This will be done:

  1. at the population scale: you will simulate at this level the complete life cycles of animals (movements, food consumption, predation, reproduction, and death).
  2. at the individual scale: you will simulate the fact that the detection of lizards by scorpions follows a particular neural model [5]: the vibrations emanating from the movement of the lizards induce neural stimuli in the scorpion that condition its orientation towards its prey.

A more detailed description of the models and techniques used is provided below.

Learning objectives:

Beyond the scope of application, this project will allow you to explore many interesting facets of programming:

Below you will find a description of the assumptions and simulation techniques that will be implemented as part of this project, elements related to work organization, and a number of references on the subject.

2. Assumptions and Simulation Techniques

The goal here is to introduce the main elements to consider during the simulation. This is only a general description. The project statement will provide you with detailed specifications for each suggested step.

System to simulate at the population scale

The environment to be simulated is populated with "animals", in this case, lizards and scorpions.

These are automatons moving on a two-dimensional terrain in search of food. The terrain contains food sources for the lizards in certain places. The scorpions, on the other hand, feed on lizards2.

Life cycle

Animals move randomly in the environment. If a food source is present in their field of vision, they move towards it and consume it.

They have a limited lifespan and die if they run out of food.

They can also reproduce and are intelligent enough to try to escape from predators that hunt them (if they have any).

Population-scale simulation will allow, among other things, to visualize the evolution of the number of individuals of each type over time based on various adjustable parameters (initial number of predators and prey, amount of available food, characteristics of the field of vision, abilities related to reproduction and escape, etc.)

The environment will be visualized as a rectangular two-dimensional terrain. However, it will be managed as a toric world: animals exceeding the world's limits on one side will reappear on the opposite side.

The user will be able to interact with the window displaying population dynamics: by pressing a key, the simulation will switch to the individual scale. At this scale, your program will simulate predation mechanisms at a finer level.

System to simulate at individual level

To more accurately simulate the mechanisms related to predation in scorpions, we will adopt the following assumptions:

  1. lizards emit vibrations on the ground when moving;
  2. each of the eight legs of scorpions is equipped with a sensor capable of detecting vibrations emitted by lizards. To simplify, we will model these vibrations as a wave front moving along the ground surface.

According to the model of [5], each sensor is connected to a neuron:

item

When waves emitted by prey reach a sensor, it transmits a signal to the neuron to which it is connected. An inhibition signal is also sent to a neuron connected to a sensor on the other side of the animal. Thus, when the wavefronts propagating reach the scorpion's sensors that are furthest from the prey, the neurons linked to these will have a lower chance of being activated. The mathematical model calculates in this way the chances of activating a neuron based on when it received the signal. A calculation of the scorpion's rotation angle is then made based on the activation chances of all the neurons.

The population-scale simulation model and the individual-scale model will not be integrated within the framework of this project. In the presence of a large number of prey, the signals emitted are indeed too numerous to be intelligently interpreted by the scorpion. Since we are also interested in studying population dynamics, which requires the creation of a relatively large number of individuals, the choice here is to decouple the two levels of simulation.

Simulation techniques

The goal of the project is therefore to:

  1. simulate the temporal evolution of the population of lizards and scorpions;
  2. simulate more precisely the mechanism used by a scorpion for predation.

Of course, for this you will need to design the necessary classes/objects and organize them (inheritance, encapsulation) in a relevant way (which the project statement will help you do).

The minimal program should allow for the visualization of the complete life cycle of animals and the mechanism enabling scorpions to locate their prey through the neuronal model described above.

A simple way to simulate the system's evolution at the population level is to loop through the fauna in order to update its elements. Each iteration will correspond to a simulation cycle.

The main loop of the population-scale simulation involves iterating through all present animals to manage the actions required at each cycle (movement, reproduction, food consumption etc..).

A potential drawback in this type of simulation is the order of event management. In the basic version suggested by the statement, the animals will be managed one after the other in the order of the list, which (more or less) is always the same. This actually induces an unintentional synchronization between the system to be simulated and the "simulation clock" which in more realistic cases can be harmful2. To avoid this kind of problem, in an improved version, one could choose to traverse the list of events to be managed in a random order. This can be done, for example, by randomly inserting any new entrant and/or by adding a "shuffle the animals to be managed" task to each simulation cycle.

For individual-scale simulation, each simulation cycle invokes the update of the scorpion's movement. This will be done based on the activation state of its neurons, which depends on the perceived vibrations.

Extension tracks

And finally, here are some possible extension paths:

The project is to be carried out in groups of up to 2 people.

No report (document) needs to be provided for the project. However, we ask you to comment extensively and intelligently on the source code that you will submit (the comments will replace the report and will therefore be taken into account in the project grade). Additionally, the code cleanliness (indentation, spaces, variable names, braces, class member variables, etc.) will be also taken into account in the grading (the provided code is considered acceptable).

We will also ask you to provide three additional files:

In particular, in addition to the usual comments on the code itself, you are free to critically examine the problem modeling, identify the weaknesses and shortcomings of this model, and naturally propose solutions to overcome these weaknesses.

The final submission deadline is Monday, May 26 at noon

The lab session on Tuesday, May 27 will be dedicated to project presentations.

4. Implementation

4.1. Working Directory

Create a subdirectory projet in the directory ~/Desktop/myfiles/Programmation/cpp.

All files related to this project must be located in the directory ~/Desktop/myfiles/Programmation/cpp/projet

4.2. Work Organization

Since the complete programming of our project, however simplified it may be, is not feasible within the time allotted to you, you will not have to implement the entire program. The parts related to graphical programming will be provided. We will also provide you throughout the weeks, in the project description, a number of utility files. These files will allow you to test each stage of your project.

The lab sessions will mainly be dedicated to the project (the exercise solutions can be used as additional information sources for the course). Your work during the lab sessions will need to be supplemented by personal contributions outside of these sessions. It will primarily involve collaborative reflection with your partner on the decisions to be made regarding the design of your program and the resulting coding (what to code? how to code? which data structures to use? etc...).

We ask you to carefully save your work at each step, even if incomplete, in order to regularly show your progress. 

The course team is, of course, at your disposal to assist you throughout this project: during the practical sessions, during the support sessions (catch-up), and via the forum.

Coaches: A responsible assistant ("coach") will be assigned to each pair. The role of you coaches will be to help you in a more dedicated way. You will need to show them your JOURNAL approximately every two weeks. It is with your coach that you will primarily discuss any potential difficulties you may encounter. However, it is to another assistant that you will make the final presentation of your project.

The IT implementation of the project includes the following main steps:

4.3. Work plan

A detailed statement of the complete project will be delivered, along with the graphics library, enabling you to work work at at your own pace. The work schedule suggested in the table below coincides with the course flow, and gives you an indication of the time you should devote to each task.

Very importantdon't fall too far behind this plan to avoid being overtaken at the end of the semester.

Week(s)

Recommended tasks

2

Registration for the project begins

4

Reading the project description

5

Reading the statement | first utility class
End of project's registrations

6+7

Random walks

8+9

Life cycles

10+11

Neural model of the scorpion

12

Statistics
free extensions

13

Finalizing and preparing the rendering

5. Advice

Here are a few tips to make your life easier during the project project:

6. References



Notes

... feed on lizards2
no live animals will be mistreated in this project :-)
... harmful2
just an illustration here: the order in which animals are treated can influence the precedence of certain behaviour (flight or predation).