pl
![]() |
![]() |
![]() |
The goal of this year's project is to give you a modest introduction to the worlds of:
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:
A more detailed description of the models and techniques used is provided below.
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.
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.
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.
To more accurately simulate the mechanisms related to predation in scorpions, we will adopt the following assumptions:
According to the model of [5], each sensor is connected to a neuron:

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 goal of the project is therefore to:
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.
And finally, here are some possible extension paths:
introduce new elements into the fauna or flora (scorpion predators for example);
introduce tracking elements for a specific individual (number of descendants, number of prey consumed, etc.);
allow "save points" (via a file): have a way, for example a mouse click or a key, to stop the simulation at a given point and save it in a file to be able to restart the simulation later;
etc ..
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:
A file REPONSES responding point by point to the questions asked for the different stages of the project. These responses are of course not unique but depend on how you interpret the statement. They will help the reviewers better understand your conception.
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.
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
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:
Setup and utility class
Simulation of abstract animals capable of moving randomly and heading towards targets
Animal life cycle simulation
Neural model simulation of the scorpion
Simulation statistics and free extensions
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 6+7 Random walks 8+9 Life cycles 10+11 Neural model of the scorpion
12 Statistics 13 Finalizing and preparing the rendering
Here are a few tips to make your life easier during the project
project: Familiarize yourself with the subject right away. Get started quickly! Think
before you start programming! Take time with your colleague to
how to code, what data structures to use,
etc. This will make programming much easier. Use the series of exercises and their answers to help you understand the basic
concepts. Modularize your code. Comment on
your code as you go along: it's a bit "thankless" to have to comment on
to comment on an "infinite" number of lines of code two days before rendering, while
not quite remembering what you wanted to do. Compile
regularly. It's easier to correct 2 or 3 syntax errors
in a few new lines of code than 100 errors in 400 lines of
of code! Test every little function in your code by writing little main
or commenting on other lines. This may seem
unnecessary, but you'll waste less time writing a test program
program than by searching for the causes of errors in numerous
functions. Use meaningful
identifiers in your code. They generally take longer to type
time-consuming to type, but when you return to parts of the code
weeks earlier, it will be easier to remember what variables
remember what the variables represent matrixOfRotation and quotient variables than r and q. Don't hesitate
feel free to ask questions during the practical sessions, on the forum
or during the
support session. And don't hesitate to discuss any difficulties you may have with your assistant
or your teacher. [1] Population dynamics
(Wikipedia)
[2] Multi-agent simulation J. Ferber, University of
Montpellier II
[4] Lotka-Volterra equations
Lotka-Volterra equations (Wikipedia)
[5] Theory of Arachnid Prey Localization,
Phys. Rev. Lett. 84, 2000, W. Stürzl, R. Kempter, and J. L. van Hemmen
[6] The time of sands,
Nature
[7] Vibration Sensitivity and a
Computational Theory for Prey-Localizing Behavior in Sand Scorpionsp.H Brownel and J.L. van Hemmen,
American Biologist, 41(5)
[8] Application of arachnid
prey localization theory for a robot sensorimotor controllerneurocomputing 74, S.V. Adams et al.
End of
project's registrations
free extensions
5. Advice
6. References
Notes