ALMaSS Vole ODDox
1.1
The vole model description following ODdox protocol
|
Go to the documentation of this file.
37 #include "../Landscape/ls.h"
38 #include "../BatchALMaSS/PopulationManager.h"
39 #include "../Vole/GeneticMaterial.h"
40 #include "../Vole/vole_all.h"
41 #include "../Vole/Predators.h"
42 #include "../BatchALMaSS/BinaryMapBase.h"
43 #include "../BatchALMaSS/MovementMap.h"
44 #include "../Vole/VolePopulationManager.h"
105 for (
int i=0; i<8; i++)
121 sp->
x = random(
SimW);
122 sp->
y = random(
SimH);
127 sp->
x = random(
SimW);
128 sp->
y = random(
SimH);
142 for (
int i=0; i<number; i++)
147 TheArray[ob_type].push_back(new_Weasel);
153 TheArray[ob_type].push_back(new_Owl);
170 FILE* pref=fopen(
"PredSampleData.txt",
"a");
172 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSampleFile",
"Could Not Open PredSampleData.txt File");
177 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
179 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
180 unsigned int TotalSize = SizeWeasel+SizeOwl;
184 fprintf(pref,
"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeWeasel, TotalSize);
186 for (
unsigned i=0; i<SizeWeasel; i++){
188 Wp=dynamic_cast<Weasel*>(
TheArray[0][i]);
201 fprintf(pref,
"%d\t",year);
202 fprintf(pref,
"%d\t",month);
203 fprintf(pref,
"%d\t",dayinMo);
204 fprintf(pref,
"%d\t",today);
206 fprintf(pref,
"%d\t",Wspecies);
207 fprintf(pref,
"%d\t",kill);
208 fprintf(pref,
"%d\t",KillEff);
209 fprintf(pref,
"%d\t",Terr);
210 fprintf(pref,
"%d\t",HomeR);
212 fprintf(pref,
"%d\t",Wx);
213 fprintf(pref,
"%d\t",Wy);
214 fprintf(pref,
"%d\t",Wpoly);
215 fprintf(pref,
"%d\t",Wele);
216 fprintf(pref,
"%d\t",Wveg);
220 fprintf(pref,
"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeOwl, TotalSize);
222 for (
unsigned i = 0; i < SizeOwl; i++){
223 Op=dynamic_cast<Owl*>(
TheArray[1][i]);
236 fprintf(pref,
"%d\t",year);
237 fprintf(pref,
"%d\t",month);
238 fprintf(pref,
"%d\t",dayinMo);
239 fprintf(pref,
"%d\t",today);
241 fprintf(pref,
"%d\t",species);
242 fprintf(pref,
"%d\t",kill);
243 fprintf(pref,
"%d\t",KillEff);
244 fprintf(pref,
"%d\t",Terr);
245 fprintf(pref,
"%d\t",HomeR);
247 fprintf(pref,
"%d\t",Ox);
248 fprintf(pref,
"%d\t",Oy);
249 fprintf(pref,
"%d\t",Opoly);
250 fprintf(pref,
"%d\t",Oele);
251 fprintf(pref,
"%d\t",Oveg);
259 FILE* pref=fopen(
"PredSampleData.txt",
"a");
261 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSampleFile",
"Could Not Open PredSampleData.txt File");
266 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
267 unsigned int TotalSize = (
unsigned int) SizeWeasel;
271 fprintf(pref,
"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeWeasel, TotalSize);
273 for (
unsigned i = 0; i < SizeWeasel; i++){
274 Wp=dynamic_cast<Weasel*>(
TheArray[0][i]);
288 fprintf(pref,
"%d\t",year);
289 fprintf(pref,
"%d\t",month);
290 fprintf(pref,
"%d\t",dayinMo);
291 fprintf(pref,
"%d\t",today);
293 fprintf(pref,
"%d\t",species);
294 fprintf(pref,
"%d\t",kill);
295 fprintf(pref,
"%d\t",KillEff);
296 fprintf(pref,
"%d\t",Terr);
297 fprintf(pref,
"%d\t",HomeR);
299 fprintf(pref,
"%d\t",Wx);
300 fprintf(pref,
"%d\t",Wy);
301 fprintf(pref,
"%d\t",Wpoly);
302 fprintf(pref,
"%d\t",Wele);
303 fprintf(pref,
"%d\t",Wveg);
311 FILE* pref=fopen(
"PredSampleData.txt",
"a");
313 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSampleFile",
"Could Not Open PredSampleData.txt File");
318 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
319 unsigned int TotalSize = SizeOwl;
322 fprintf(pref,
"%d\t %d\t %d\t %d\t %u\t %u\n", 0,w ,0, h, SizeOwl, TotalSize);
324 for (
unsigned i = 0; i < SizeOwl; i++){
325 Op=dynamic_cast<Owl*>(
TheArray[1][i]);
338 fprintf(pref,
"%d\t",year);
339 fprintf(pref,
"%d\t",month);
340 fprintf(pref,
"%d\t",dayinMo);
341 fprintf(pref,
"%d\t",today);
343 fprintf(pref,
"%d\t",Wspecies);
344 fprintf(pref,
"%d\t",Wkill);
345 fprintf(pref,
"%d\t",WKillEff);
346 fprintf(pref,
"%d\t",Terr);
347 fprintf(pref,
"%d\t",HomeR);
349 fprintf(pref,
"%d\t",Wx);
350 fprintf(pref,
"%d\t",Wy);
351 fprintf(pref,
"%d\t",Wpoly);
352 fprintf(pref,
"%d\t",Wele);
353 fprintf(pref,
"%d\t",Wveg);
366 FILE* pref=fopen(
"PredAutumnOutput.txt",
"a");
368 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredAutumnSample",
"Could Not Open PredAutumnOutput.txt File");
372 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
373 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
374 unsigned int TotalSize = SizeWeasel+SizeOwl;
376 fprintf(pref,
"%d\t", year);
377 fprintf(pref,
"%d\t", today);
378 fprintf(pref,
"%d\t", SizeWeasel);
379 fprintf(pref,
"%d\t", SizeOwl);
380 fprintf(pref,
"%d\t", TotalSize);
387 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
389 FILE* pref = fopen(
"PredAutumnOutput.txt",
"a");
391 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredAutumnSample",
"Could Not Open PredAutumnOutput.txt File");
394 fprintf(pref,
"%d\t", year);
395 fprintf(pref,
"%d\t", today);
396 fprintf(pref,
"%d\t", SizeWeasel);
397 fprintf(pref,
"%d\t", 0);
398 fprintf(pref,
"%d\t", SizeWeasel);
405 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
407 FILE* pref = fopen(
"PredAutumnOutput.txt",
"a");
409 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredAutumnSample",
"Could Not Open PredAutumnOutput.txt File");
412 fprintf(pref,
"%d\t", year);
413 fprintf(pref,
"%d\t", today);
414 fprintf(pref,
"%d\t", 0);
415 fprintf(pref,
"%d\t", SizeOwl);
416 fprintf(pref,
"%d\t", SizeOwl);
429 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
430 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
431 unsigned int TotalSize = SizeWeasel+SizeOwl;
433 FILE* pref=fopen(
"PredSpringOutput.txt",
"a");
435 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringSample",
"Could Not Open PredSpringOutput.txt File");
438 fprintf(pref,
"%d\t", year);
439 fprintf(pref,
"%d\t", today);
440 fprintf(pref,
"%d\t", SizeWeasel);
441 fprintf(pref,
"%d\t", SizeOwl);
442 fprintf(pref,
"%d\t", TotalSize);
449 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
451 FILE* pref=fopen(
"PredSpringOutput.txt",
"a");
453 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringSample",
"Could Not Open PredSpringOutput.txt File");
456 fprintf(pref,
"%d\t", year);
457 fprintf(pref,
"%d\t", today);
458 fprintf(pref,
"%d\t", SizeWeasel);
459 fprintf(pref,
"%d\t", 0);
460 fprintf(pref,
"%d\t", SizeWeasel);
467 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
469 FILE* pref=fopen(
"PredSpringOutput.txt",
"a");
471 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringSample",
"Could Not Open PredSpringOutput.txt File");
474 fprintf(pref,
"%d\t", year);
475 fprintf(pref,
"%d\t", today);
476 fprintf(pref,
"%d\t", 0);
477 fprintf(pref,
"%d\t", SizeOwl);
478 fprintf(pref,
"%d\t", SizeOwl);
492 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
493 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
494 unsigned int TotalSize = SizeWeasel+SizeOwl;
496 FILE* pref=fopen(
"PredSpringAutumnOutput.txt",
"a");
498 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringAutumnSample",
"Could Not Open PredSpringAutumnOutput.txt File");
502 fprintf(pref,
"%d\t", year);
503 fprintf(pref,
"%d\t", today);
504 fprintf(pref,
"%d\t", SizeWeasel);
505 fprintf(pref,
"%d\t", SizeOwl);
506 fprintf(pref,
"%d\t", TotalSize);
513 unsigned int SizeWeasel = (
unsigned int)
TheArray[0].size();
515 FILE* pref=fopen(
"PredSpringAutumnOutput.txt",
"a");
517 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringAutumnSample",
"Could Not Open PredSpringAutumnOutput.txt File");
520 fprintf(pref,
"%d\t", year);
521 fprintf(pref,
"%d\t", today);
522 fprintf(pref,
"%d\t", SizeWeasel);
523 fprintf(pref,
"%d\t", 0);
524 fprintf(pref,
"%d\t", SizeWeasel);
530 unsigned int SizeOwl = (
unsigned int)
TheArray[1].size();
532 FILE* pref=fopen(
"PredSpringAutumnOutput.txt",
"a");
534 m_TheLandscape->
Warn(
"TPredator_Population_Manager::PredSpringAutumnSample",
"Could Not Open PredSpringAutumnOutput.txt File");
537 fprintf(pref,
"%d\t", year);
538 fprintf(pref,
"%d\t", today);
539 fprintf(pref,
"%d\t", 0);
540 fprintf(pref,
"%d\t", SizeOwl);
541 fprintf(pref,
"%d\t", SizeOwl);
578 FILE* pref = fopen(
"PredProbe.txt",
"a");
580 m_TheLandscape->
Warn(
"Predator_Population_Manager Destructor",
"Could Not Open PredProbe.txt File");
584 unsigned int PredNo0 = (
unsigned int)
TheArray[0].size();
585 unsigned int PredNo1 = (
unsigned int)
TheArray[1].size();
586 fprintf(pref,
"%d\t%u\t%u\t%u\t%u\n", Y, 0, PredNo0, 1, PredNo1);
589 unsigned int PredNo0 = (
unsigned int)
TheArray[0].size();
590 fprintf(pref,
"%d\t%u\t%u\n", Y, 0, PredNo0);
593 unsigned int PredNo1 = (
unsigned int)
TheArray[1].size();
594 fprintf(pref,
"%d\t%u\t%u\n", Y, 1, PredNo1);
599 for (
unsigned listindex=0; listindex<
TheArray.size(); listindex++)
601 for (
unsigned j=0; j<
TheArray[listindex].size(); j++)
603 TheArray[listindex][j]->SetStepDone(
false);
607 for (
unsigned listindex=0; listindex<
TheArray.size();listindex++)
609 for (
unsigned j=0; j<
TheArray[listindex].size(); j++)
610 TheArray[listindex][j]->BeginStep();
616 for (
unsigned listindex=0; listindex<
TheArray.size();listindex++)
618 for (
unsigned j=0; j<
TheArray[listindex].size(); j++)
626 for (
unsigned listindex=0; listindex<
TheArray.size();listindex++)
628 for (
unsigned j=0; j<
TheArray[listindex].size(); j++)
637 for (
unsigned listindex=0; listindex<
TheArray.size();listindex++)
640 int TAend=(int)
TheArray[listindex].size()-1;
641 for (
int j=TAend; j>=0; j--)
643 if (
TheArray[listindex][j]->GetCurrentStateNo() == -1)
657 for (
unsigned listindex=0; listindex<
TheArray.size();listindex++)
659 for (
unsigned j=0; j<
TheArray[listindex].size(); j++)
661 if (
TheArray[listindex][j]->GetStepDone() ==
false)
676 for (
unsigned i=0; i<
TheArray[sp].size(); i++)
681 if (APredator!=p_Pred)
return true;
738 (*CurrentPrey)[i]->OnKilled();
795 while ((!found)&&(Count<100))
845 for (
int k=0; k<noToMake; k++)
939 for (
int k=0; k<noToMake; k++)
static CfgInt cfg_weasel_breed_threshold("WEASEL_BT", CFG_CUSTOM, 5)
The base class for predators encompsassing all their general behaviours.
static CfgInt cfg_owl_StartingNo("OWL_START_NO", CFG_CUSTOM, 0)
TTypesOfVegetation SupplyVegType(int a_x, int a_y)
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
static CfgInt cfg_weasel_kill_efficiency("WEASEL_KILL_EFF", CFG_CUSTOM, 250)
static CfgInt cfg_owl_breed_threshold("OWL_BT", CFG_CUSTOM, 5000000)
static CfgInt cfg_owl_breed_day("OWL_BD", CFG_CUSTOM, 120)
vector< TListOfAnimals > TheArray
TTypesOfPopulation m_population_type
bool OverlapMyTerritory(unsigned x, unsigned y)
The class to handle all predator population related matters.
FILE * ReallyBigOutputPrb
static CfgInt cfg_weasel_breed_day("WEASEL_BD", CFG_CUSTOM, 115)
Landscape * m_OurLandscape
unsigned supply_no_inds(unsigned list)
virtual void st_Movement()
TPredator_Population_Manager * PM
void inc_inds(unsigned list)
static CfgBool cfg_PredMortalityDataUsed("PRED_MORTALITY_DATA_USED", CFG_CUSTOM, false)
int Supply_m_Location_x()
Owl(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
unsigned m_no_individuals[2]
Used for creation of a new predator object.
virtual void BeginStep(void)
BeingStep behaviour - must be implemented in descendent classes.
virtual void Step(void)
Step behaviour - must be implemented in descendent classes.
unsigned SupplySpeciesID()
static CfgInt cfg_weasel_death_threshold("WEASEL_DT", CFG_CUSTOM, 10)
The Owl class is one of two current implementations of TPredator.
void dec_inds(unsigned list)
The Weasel class is one of two current implementations of TPredator.
void PredSpringAutumnSample()
The landscape class containing all environmental and topographical data.
virtual void Step(void)
Step behaviour - must be implemented in descendent classes.
int SupplyDayInMonth(void)
int SupplySimAreaHeight(void)
vector< Vole_Base * > * SupplyVoleList(unsigned x, unsigned y, unsigned range)
int SupplySimAreaWidth(void)
static CfgInt cfg_weasel_NoFailuresBeforeDispersal("WEASEL_FAILURES", CFG_CUSTOM, 10)
static CfgInt cfg_weasel_DispersalMax("WEASEL_DISPERSAL_MAX", CFG_CUSTOM, 200)
The base class for all ALMaSS animal classes.
static CfgInt cfg_weasel_search_area("WEASEL_SEARCH_AREA", CFG_CUSTOM, 100)
virtual void st_Dispersal()
Base class for all population managers.
int SupplyDayInYear(void)
int weasel_death_threshold
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
int SupplyYearNumber(void)
Vole_Population_Manager * m_Prey
The class to handle all vole population related matters.
static CfgInt cfg_owl_death_threshold("OWL_DT", CFG_CUSTOM,-1)
void CreateObjects(int ob_type, TAnimal *pvo, struct_Predator *data, int number)
TTypeOfPredatorState CurrentPState
Landscape * m_TheLandscape
virtual ~TPredator_Population_Manager(void)
TPredator_Population_Manager * m_OurPopulationManager
static CfgInt cfg_weasel_home_range("WEASEL_HOME_RANGE", CFG_CUSTOM, 250)
bool InOtherTerritory(unsigned sp, int p_x, int p_y, TPredator *p_Pred)
int Supply_m_Location_y()
TPredator(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
static CfgInt cfg_pred_second_sample_day("PRED_SAMPLE_FILE_DAY_TWO", CFG_CUSTOM, 287)
virtual bool StepFinished()
Overrides the population manager StepFinished - there is no chance that hunters do not finish a step ...
virtual void BeginStep(void)
BeingStep behaviour - must be implemented in descendent classes.
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
int weasel_breed_threshold
Weasel(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
TPredator_Population_Manager(Landscape *L, Vole_Population_Manager *VPM)
static CfgBool cfg_PredSampleDataUsed("PRED_SAMPLE_DATA_USED", CFG_CUSTOM, false)
unsigned m_NoFailuresBeforeDispersal
Vole_Population_Manager * m_Prey
static CfgInt cfg_weasel_StartingNo("WEASEL_START_NO", CFG_CUSTOM, 0)
void Warn(std::string a_msg1, std::string a_msg2)
int SupplyPolyRef(int a_x, int a_y)
vector< Vole_Base * > * CurrentPrey
static CfgInt cfg_pred_first_sample_day("PRED_SAMPLE_FILE_DAY_ONE", CFG_CUSTOM, 109)