ALMaSS Partridge ODdox
1.1
The partridge model description following ODdox protocol
|
Partridge_Covey.cpp This file contains the code for the partridge covey class
More...
#include <cmath>
#include <assert.h>
#include <iostream>
#include <fstream>
#include "../Landscape/ls.h"
#include "../BatchALMaSS/PopulationManager.h"
#include "../Partridge/Partridge_Communication.h"
#include "../Partridge/Partridge_All.h"
#include "../Partridge/Partridge_Population_Manager.h"
#include "../Partridge/Partridge_Covey.h"
#include "../BatchALMaSS/BoostRandomGenerators.h"
Go to the source code of this file.
Macros | |
#define | TRIG_TABLE_LENGTH 8000 |
#define | TRIG_TABLE_LENGTH_INV 0.00025 |
Variables | |
CfgInt | cfg_par_mature_threshold |
Age at maturing in days. More... | |
double | g_FoodNeed [200] |
int | g_MaxWalk [200] |
CfgInt | cfg_IndividualEmigration |
Emigration rate of alone individuals (of 10000) More... | |
CfgFloat | cfg_NOT1950sinsects ("PAR_NOTFIFTIESINSECTSSCALER", CFG_CUSTOM, 0.1) |
Default for 2000s, 1950s=1.0. More... | |
CfgFloat | cfg_parinsectScaler ("PAR_INSECTSCALER", CFG_CUSTOM, 0.5) |
Default for 2000s, 1950s=1.0. More... | |
CfgFloat | cfg_terr_qual_good ("PAR_TERR_QUAL_GOOD", CFG_CUSTOM, 4.0) |
Nesting quality for OK areas. More... | |
CfgInt | cfg_nest_field ("PAR_NEST_FIELD", CFG_CUSTOM, 1) |
Nesting quality for fields. More... | |
CfgInt | cfg_nest_roadside ("PAR_NEST_ROADSIDE", CFG_CUSTOM, 100) |
Nesting quality for roadsize verges. More... | |
CfgInt | cfg_nest_railway ("PAR_NEST_RAILWAY", CFG_CUSTOM, 100) |
Nesting quality for railway ebankments. More... | |
CfgInt | cfg_nest_fieldboundary ("PAR_NEST_FIELDBOUNDARY", CFG_CUSTOM, 200) |
Nesting quality for field boundaries. More... | |
CfgInt | cfg_nest_permpastlowyield ("PAR_NEST_PERMPASTLOWYIELD", CFG_CUSTOM, 1) |
Nesting quality for low yield pasture. More... | |
CfgInt | cfg_nest_permpasttussocky ("PAR_NEST_PERMPASTTUSSOCKY", CFG_CUSTOM, 1) |
Nesting quality for very low grazed pasture. More... | |
CfgInt | cfg_nest_permsetaside ("PAR_NEST_PERMSETASIDE", CFG_CUSTOM, 100) |
Nesting quality for setaside. More... | |
CfgInt | cfg_nest_naturalgrass ("PAR_NEST_NATURALGRASS", CFG_CUSTOM, 100) |
Nesting quality for natural grass. More... | |
CfgInt | cfg_nest_hedgebank0 ("PAR_NEST_HEDGEBANKZERO", CFG_CUSTOM, 1) |
Nesting quality for hedgebank type 0. More... | |
CfgInt | cfg_nest_hedgebank1 ("PAR_NEST_HEDGEBANKONE", CFG_CUSTOM, 100) |
Nesting quality for hedgebank type 1. More... | |
CfgInt | cfg_nest_hedgebank2 ("PAR_NEST_HEDGEBANKTWO", CFG_CUSTOM, 200) |
Nesting quality for hedgebank type 2. More... | |
CfgInt | g_par_terr_max_width ("PAR_TERR_MAX_WIDTH", CFG_CUSTOM, 500) |
Limit to homerange radius. More... | |
CfgInt | g_par_nest_min_dist_bad_areas ("PAR_NEST_MIN_DIST_BAD_AREAS", CFG_CUSTOM, 25) |
Minimum nest distance to 'bad' areas. More... | |
CfgInt | g_par_nest_min_dist_other_nest ("PAR_NEST_MIN_DIST_OTHER_NEST", CFG_CUSTOM, 50) |
Minimum nest distance to other nests. More... | |
CfgInt | cfg_par_parentdead_age1 ("PAR_PARENTDEAD_AGEONE", CFG_CUSTOM, 35) |
Mortalty chance on parent death, young. More... | |
CfgInt | cfg_par_parentdead_age2 ("PAR_PARENTDEAD_AGETWO", CFG_CUSTOM, 63) |
Mortalty chance on parent death, older. More... | |
CfgInt | cfg_par_parentdead_mort ("PAR_PARENTDEAD_MORT", CFG_CUSTOM, 100) |
Mortalty chance on parent death. More... | |
CfgInt | cfg_par_highqualthreshold ("PAR_HIGHQUALTHRESHOLD", CFG_CUSTOM, 18) |
An arbitrary value for determine movement quality. More... | |
CfgInt | cfg_par_chick_extra_mort ("PAR_CHICK_EXTRA_MORT", CFG_CUSTOM, 200) |
Extra mortality applied to chicks on death of parents. More... | |
CfgInt | cfg_par_movequal_histlimit ("PAR_MOVEQUAL_HISTLIMIT", CFG_CUSTOM, 3) |
The length of memory for backtracking. More... | |
CfgInt | cfg_par_move_fuzzy_chance ("PAR_MOVE_FUZZY_CHANCE", CFG_CUSTOM, 50) |
Chance of imperfect movement decisions. More... | |
CfgFloat | cfg_par_bio_hindrance_inv ("PAR_BIO_HINDRANCE", CFG_CUSTOM, 0.00667) |
CfgFloat | cfg_par_hei_hindrance_inv ("PAR_HEI_HINDRANCE", CFG_CUSTOM, 0.04) |
CfgInt | cfg_par_flyto_stepsize ("PAR_FLYTO_STEPSIZE", CFG_CUSTOM, 1) |
CfgBool | cfg_par_force_enable ("PAR_COVEY_FORCE_ENABLE", CFG_CUSTOM, true) |
Enable the calculation of the repulsive inter-covey 'force'. More... | |
CfgFloat | cfg_par_force_ignore_dist_sq ("PAR_COVEY_FORCE_IGNORE_DIST_SQ", CFG_CUSTOM, 250000.0) |
CfgFloat | cfg_par_force_ignore_below ("PAR_COVEY_FORCE_IGNORE_BELOW", CFG_CUSTOM, 0.0) |
CfgFloat | cfg_par_force_speed ("PAR_COVEY_FORCE_SPEED", CFG_CUSTOM, 2.0) |
CfgFloat | cfg_par_force_below ("PAR_COVEY_FORCE_BELOW", CFG_CUSTOM, 0.1) |
CfgFloat | cfg_par_force_abs_limit ("PAR_COVEY_FORCE_ABS_LIMIT", CFG_CUSTOM, 100.0) |
CfgBool | cfg_par_covey_drift_enable ("PAR_COVEY_DRIFT_ENABLE", CFG_CUSTOM, true) |
CfgFloat | cfg_par_covey_drift_speed ("PAR_COVEY_DRIFT_SPEED", CFG_CUSTOM, 2.0) |
Drift force on the peg. More... | |
double | m_move_veg_const [] |
CfgFloat | cfg_min_merge_dist ("PAR_MIN_MERGE_DIST", CFG_CUSTOM, 50.0) |
The minimum merging distance. More... | |
CfgInt | cfg_par_merging_chance ("PAR_MERGE_CHANCE", CFG_CUSTOM, 5) |
The merging probability. More... | |
CfgInt | cfg_par_firstmerge ("PAR_FIRSTMERGE", CFG_CUSTOM, 150) |
The Earliest merging date. More... | |
CfgInt | cfg_par_lastmerge ("PAR_LASTMERGE", CFG_CUSTOM, 59) |
The latest merging date. More... | |
int | m_move_list [8] |
double | m_move_dir_qual [8] |
bool | m_move_allowed [8] |
static int | m_move_select_list [8] |
static int | m_move_select_size |
static unsigned int | g_covey_id_counter = 0 |
static double * | g_trig_sin |
static double * | g_trig_cos |
class CoveyManager * | g_covey_manager |
static bool | m_move_veg_const_init_done = false |
Partridge_Covey.cpp This file contains the code for the partridge covey class
by Chris J. Topping
Original version 15th October 2008
Doxygen formatted comments in October 2008
Code by Frank Nikolaisen & Chris Topping
Definition in file Partridge_Covey.cpp.
#define TRIG_TABLE_LENGTH 8000 |
Definition at line 233 of file Partridge_Covey.cpp.
#define TRIG_TABLE_LENGTH_INV 0.00025 |
Definition at line 234 of file Partridge_Covey.cpp.
CfgInt cfg_IndividualEmigration |
Emigration rate of alone individuals (of 10000)
Referenced by Partridge_Covey::CoveyIndividualEmigrate().
CfgFloat cfg_min_merge_dist("PAR_MIN_MERGE_DIST", CFG_CUSTOM, 50.0) |
The minimum merging distance.
Referenced by Partridge_Covey::ManagerCheckMerge().
CfgInt cfg_nest_field("PAR_NEST_FIELD", CFG_CUSTOM, 1) |
Nesting quality for fields.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_fieldboundary("PAR_NEST_FIELDBOUNDARY", CFG_CUSTOM, 200) |
Nesting quality for field boundaries.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_hedgebank0("PAR_NEST_HEDGEBANKZERO", CFG_CUSTOM, 1) |
Nesting quality for hedgebank type 0.
Referenced by Partridge_Population_Manager::EvalHabitatQual(), Partridge_Covey::HabitatEvalPoly(), and Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_hedgebank1("PAR_NEST_HEDGEBANKONE", CFG_CUSTOM, 100) |
Nesting quality for hedgebank type 1.
Referenced by Partridge_Population_Manager::EvalHabitatQual(), Partridge_Covey::HabitatEvalPoly(), and Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_hedgebank2("PAR_NEST_HEDGEBANKTWO", CFG_CUSTOM, 200) |
Nesting quality for hedgebank type 2.
Referenced by Partridge_Population_Manager::EvalHabitatQual(), Partridge_Covey::HabitatEvalPoly(), and Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_naturalgrass("PAR_NEST_NATURALGRASS", CFG_CUSTOM, 100) |
Nesting quality for natural grass.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_permpastlowyield("PAR_NEST_PERMPASTLOWYIELD", CFG_CUSTOM, 1) |
Nesting quality for low yield pasture.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_permpasttussocky("PAR_NEST_PERMPASTTUSSOCKY", CFG_CUSTOM, 1) |
Nesting quality for very low grazed pasture.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_permsetaside("PAR_NEST_PERMSETASIDE", CFG_CUSTOM, 100) |
Nesting quality for setaside.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_railway("PAR_NEST_RAILWAY", CFG_CUSTOM, 100) |
Nesting quality for railway ebankments.
Referenced by Partridge_Covey::NestGoodSpot().
CfgInt cfg_nest_roadside("PAR_NEST_ROADSIDE", CFG_CUSTOM, 100) |
Nesting quality for roadsize verges.
Referenced by Partridge_Covey::NestGoodSpot().
CfgFloat cfg_NOT1950sinsects("PAR_NOTFIFTIESINSECTSSCALER", CFG_CUSTOM, 0.1) |
Default for 2000s, 1950s=1.0.
Referenced by Partridge_Covey::MoveMagicVegToFood().
CfgFloat cfg_par_bio_hindrance_inv("PAR_BIO_HINDRANCE", CFG_CUSTOM, 0.00667) |
Referenced by Partridge_Covey::MoveMagicVegToFood().
CfgInt cfg_par_chick_extra_mort("PAR_CHICK_EXTRA_MORT", CFG_CUSTOM, 200) |
Extra mortality applied to chicks on death of parents.
Referenced by Partridge_Covey::ChickExtraMortality().
CfgBool cfg_par_covey_drift_enable("PAR_COVEY_DRIFT_ENABLE", CFG_CUSTOM, true) |
Enable peg 'drift' towards the covey's actual, physical position. Not done for fixed pegs.
Referenced by Partridge_Covey::ManagerDriftPos().
CfgFloat cfg_par_covey_drift_speed("PAR_COVEY_DRIFT_SPEED", CFG_CUSTOM, 2.0) |
Drift force on the peg.
Daily speed in meters of the covey peg drift. Carefull! It is easy to exceed the daily force incluence by adjusting cfg_par_force_speed and cfg_par_covey_drift_speed.
Referenced by Partridge_Covey::ManagerDriftPos().
CfgInt cfg_par_firstmerge("PAR_FIRSTMERGE", CFG_CUSTOM, 150) |
The Earliest merging date.
Referenced by CoveyManager::Tick().
CfgInt cfg_par_flyto_stepsize("PAR_FLYTO_STEPSIZE", CFG_CUSTOM, 1) |
Number of meters (approximately) that we will have between points around the perimeter of our scanning circle during FlyTo(). Notice that if one flies out to a 1000 meter radius, then at 1 meter we will in a worst case scenario have to look at a total of 6283 locations of the map for a single call to FlyTo()! However if we raise this value to more than 1, then we risk stepping over thin hedges etc...
Cannot be zero or negative.
Referenced by Partridge_Covey::FlyToFast(), and Partridge_Covey::FlyToSlow().
CfgFloat cfg_par_force_abs_limit("PAR_COVEY_FORCE_ABS_LIMIT", CFG_CUSTOM, 100.0) |
If the total sum of forces on a covey is above this value, then the m_essence_low flag is set. This flag is read via the LifeEssenceLow() and is supposed to signal a condition, where an area is overcrowded for some reason.
Referenced by Partridge_Covey::PressureLimitExceeded().
CfgFloat cfg_par_force_below("PAR_COVEY_FORCE_BELOW", CFG_CUSTOM, 0.1) |
If the total absolute length of the vector force induced on a covey from the surrounding ones is below this value, then the m_force_low flag is set. The value of this flag can be read at any time via the covey ForceLow( void ) method. Not used at present.
Referenced by Partridge_Covey::ManagerRethinkPos().
CfgBool cfg_par_force_enable("PAR_COVEY_FORCE_ENABLE", CFG_CUSTOM, true) |
Enable the calculation of the repulsive inter-covey 'force'.
Referenced by Partridge_Covey::ManagerRethinkPos().
CfgFloat cfg_par_force_ignore_below("PAR_COVEY_FORCE_IGNORE_BELOW", CFG_CUSTOM, 0.0) |
Force a daily update of the territory size for non-fixed coveys. CfgBool cfg_par_force_terr_size( "PAR_COVEY_FORCE_TERR_SIZE", CFG_CUSTOM, true ); If the absolute length of the vector force of all the other coveys within a distance of PAR_COVEY_FORCE_IGNORE_DIST_SQ is below PAR_COVEY_FORCE_IGNORE_BELOW as specified here, then the covey peg will not move, even though the total force on it isn't zero. This can used to introduce a certain 'sluggishness' in the peg position, so it is prevented from 'flittering' back and forth at the slightest influence. Note: Values needed here are small, as the forces on a given day are small unless covey pegs are really close together.
Referenced by CoveyManager::CoveyManager().
CfgFloat cfg_par_force_ignore_dist_sq("PAR_COVEY_FORCE_IGNORE_DIST_SQ", CFG_CUSTOM, 250000.0) |
The distance beyond which the influence of a particular other covey is ignored, say, 1KM or so. This is the distance in meters SQUARED!, ie 1000000.0 for 1KM.
Referenced by Partridge_Covey::ManagerRethinkPos().
CfgFloat cfg_par_force_speed("PAR_COVEY_FORCE_SPEED", CFG_CUSTOM, 2.0) |
Which proportion of the daily speed delta provided by the force vector that is actually added to the peg position.
Referenced by Partridge_Covey::ManagerRethinkPos().
CfgFloat cfg_par_hei_hindrance_inv("PAR_HEI_HINDRANCE", CFG_CUSTOM, 0.04) |
Referenced by Partridge_Covey::MoveMagicVegToFood().
CfgInt cfg_par_highqualthreshold("PAR_HIGHQUALTHRESHOLD", CFG_CUSTOM, 18) |
An arbitrary value for determine movement quality.
Referenced by Partridge_Covey::MoveEvalEdgesAndQual().
CfgInt cfg_par_lastmerge("PAR_LASTMERGE", CFG_CUSTOM, 59) |
The latest merging date.
Referenced by CoveyManager::Tick().
CfgInt cfg_par_mature_threshold |
Age at maturing in days.
Referenced by Partridge_Covey::BeginStep().
CfgInt cfg_par_merging_chance("PAR_MERGE_CHANCE", CFG_CUSTOM, 5) |
The merging probability.
Referenced by Partridge_Covey::ManagerCheckMerge().
CfgInt cfg_par_move_fuzzy_chance("PAR_MOVE_FUZZY_CHANCE", CFG_CUSTOM, 50) |
Chance of imperfect movement decisions.
This parameter heavily influences 'non-sensical' moves. As parts per 10.000. 100 is one percent.
Referenced by Partridge_Covey::MoveSelectFuzzy().
CfgInt cfg_par_movequal_histlimit("PAR_MOVEQUAL_HISTLIMIT", CFG_CUSTOM, 3) |
The length of memory for backtracking.
Referenced by Partridge_Covey::MoveSelectLimit().
CfgInt cfg_par_parentdead_age1("PAR_PARENTDEAD_AGEONE", CFG_CUSTOM, 35) |
Mortalty chance on parent death, young.
Referenced by Partridge_Covey::ActOnParentDeath().
CfgInt cfg_par_parentdead_age2("PAR_PARENTDEAD_AGETWO", CFG_CUSTOM, 63) |
Mortalty chance on parent death, older.
Referenced by Partridge_Covey::ActOnParentDeath().
CfgInt cfg_par_parentdead_mort("PAR_PARENTDEAD_MORT", CFG_CUSTOM, 100) |
Mortalty chance on parent death.
Referenced by Partridge_Covey::ActOnParentDeath().
CfgFloat cfg_parinsectScaler("PAR_INSECTSCALER", CFG_CUSTOM, 0.5) |
Default for 2000s, 1950s=1.0.
Referenced by Partridge_Covey::MoveMagicVegToFood().
CfgFloat cfg_terr_qual_good("PAR_TERR_QUAL_GOOD", CFG_CUSTOM, 4.0) |
Nesting quality for OK areas.
Referenced by Partridge_Covey::HabitatEvalPoly().
|
static |
Definition at line 231 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::Partridge_Covey().
class CoveyManager* g_covey_manager |
Definition at line 2070 of file Partridge_Covey.cpp.
Referenced by Partridge_Population_Manager::DoFirst(), Partridge_Covey::ManagerRethinkPos(), Partridge_Covey::Partridge_Covey(), Partridge_Covey::RemoveMember(), and Partridge_Covey::~Partridge_Covey().
double g_FoodNeed[200] |
Definition at line 65 of file Partridge_Population_Manager.cpp.
Referenced by Partridge_Covey::BeginStep(), and Partridge_Population_Manager::FillInFoodArray().
int g_MaxWalk[200] |
Definition at line 66 of file Partridge_Population_Manager.cpp.
Referenced by Partridge_Population_Manager::FillInFoodArray().
CfgInt g_par_nest_min_dist_bad_areas("PAR_NEST_MIN_DIST_BAD_AREAS", CFG_CUSTOM, 25) |
Minimum nest distance to 'bad' areas.
Referenced by Partridge_Covey::NestNearBadAreas().
CfgInt g_par_nest_min_dist_other_nest("PAR_NEST_MIN_DIST_OTHER_NEST", CFG_CUSTOM, 50) |
Minimum nest distance to other nests.
Referenced by Partridge_Covey::NestFindFast(), and Partridge_Covey::NestFindSlow().
CfgInt g_par_terr_max_width("PAR_TERR_MAX_WIDTH", CFG_CUSTOM, 500) |
Limit to homerange radius.
The territory maximum radius (width is not the right name for this) heavily influences the movements of the covey. If a covey suddenly decides to stray of an obvious path, it is most often due to the distance to the peg starting to gain importance.
Referenced by Partridge_Covey::HabitatEvaluate(), Partridge_Covey::NestFindLocation(), and Partridge_Covey::Partridge_Covey().
|
static |
Definition at line 236 of file Partridge_Covey.cpp.
Referenced by CoveyManager::CoveyManager(), Partridge_Covey::FlyToFast(), Partridge_Covey::FlyToSlow(), and CoveyManager::~CoveyManager().
|
static |
Definition at line 235 of file Partridge_Covey.cpp.
Referenced by CoveyManager::CoveyManager(), Partridge_Covey::FlyToFast(), Partridge_Covey::FlyToSlow(), and CoveyManager::~CoveyManager().
bool m_move_allowed[8] |
Definition at line 228 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveDirectionsAllowed(), Partridge_Covey::MoveDistance(), Partridge_Covey::MoveOptimalDirectionFast(), Partridge_Covey::MoveOptimalDirectionSlow(), and Partridge_Covey::MoveTo().
double m_move_dir_qual[8] |
Definition at line 227 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveDistance(), Partridge_Covey::MoveOptimalDirectionFast(), Partridge_Covey::MoveOptimalDirectionSlow(), and Partridge_Covey::MoveTo().
int m_move_list[8] |
Definition at line 226 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveDistance(), Partridge_Covey::MoveOptimalDirectionFast(), Partridge_Covey::MoveOptimalDirectionSlow(), Partridge_Covey::MoveSelectLimit(), Partridge_Covey::MoveTo(), Partridge_Covey::MoveWeighDirection(), and Partridge_Covey::SanityCheck3().
|
static |
Definition at line 229 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveSelect(), Partridge_Covey::MoveSelectLimit(), and Partridge_Covey::MoveWeighDirection().
|
static |
Definition at line 230 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveSelect(), Partridge_Covey::MoveSelectLimit(), and Partridge_Covey::MoveWeighDirection().
double m_move_veg_const |
Definition at line 223 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveVegConstInit().
|
static |
Definition at line 3299 of file Partridge_Covey.cpp.
Referenced by Partridge_Covey::MoveVegConstInit().