Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submissions-ptss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eturricelli
submissions-ptss
Commits
c9f165e3
Commit
c9f165e3
authored
Oct 13, 2020
by
Erick Turricelli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Headers for Penna model simulation
parent
db4280fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
exercises/ex04/my_solutions4/penna/animal.hpp
exercises/ex04/my_solutions4/penna/animal.hpp
+18
-0
exercises/ex04/my_solutions4/penna/genome.hpp
exercises/ex04/my_solutions4/penna/genome.hpp
+15
-0
No files found.
exercises/ex04/my_solutions4/penna/animal.hpp
0 → 100644
View file @
c9f165e3
#include "genome.hpp"
class
Animal
{
public:
Animal
()
{};
// constructor that initializes the genome sequence
static
int
counter
;
// count the animals alive ~ population
~
Animal
()
{};
// destructor when an animal dies
void
give_birth
();
// have a child (only one is allowed)
void
prob_life
();
// after the threshold, an individual is alive only with a certain probability
private:
Genome
sequence
();
int
mutation_rate
;
// mutation rate that determines how many bits are gonna change for the child
int
reproduction_age
;
// minimum age to have a child
int
life_threshold
;
// threshold for mutations allowed before death risks
int
max_population
;
// maximum numbers of individuals in the population
};
\ No newline at end of file
exercises/ex04/my_solutions4/penna/genome.hpp
0 → 100644
View file @
c9f165e3
#include <vector>
class
Genome
{
public:
Genome
()
{};
// generation of a random sequence (used for the first generation)
Genome
(
bool
child
)
{};
// creation of a child starting from a mother
void
mutation
(
int
position
);
// change a single bit in a particual position of a sequence
~
Genome
()
{};
// destructor when an animal dies
private:
int
B
;
// span of time considered in the simulation
std
::
vector
<
int
>
sequence
;
// vector containing the genes
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment