ALMaSS Partridge ODdox  1.1
The partridge model description following ODdox protocol
Partridge_Covey.cpp File Reference

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 CoveyManagerg_covey_manager
 
static bool m_move_veg_const_init_done = false
 

Detailed Description

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.

Macro Definition Documentation

◆ TRIG_TABLE_LENGTH

#define TRIG_TABLE_LENGTH   8000

Definition at line 233 of file Partridge_Covey.cpp.

◆ TRIG_TABLE_LENGTH_INV

#define TRIG_TABLE_LENGTH_INV   0.00025

Definition at line 234 of file Partridge_Covey.cpp.

Variable Documentation

◆ cfg_IndividualEmigration

CfgInt cfg_IndividualEmigration

Emigration rate of alone individuals (of 10000)

Referenced by Partridge_Covey::CoveyIndividualEmigrate().

◆ cfg_min_merge_dist

CfgFloat cfg_min_merge_dist("PAR_MIN_MERGE_DIST", CFG_CUSTOM, 50.0)

The minimum merging distance.

Referenced by Partridge_Covey::ManagerCheckMerge().

◆ cfg_nest_field

CfgInt cfg_nest_field("PAR_NEST_FIELD", CFG_CUSTOM, 1)

Nesting quality for fields.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_fieldboundary

CfgInt cfg_nest_fieldboundary("PAR_NEST_FIELDBOUNDARY", CFG_CUSTOM, 200)

Nesting quality for field boundaries.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_hedgebank0

CfgInt cfg_nest_hedgebank0("PAR_NEST_HEDGEBANKZERO", CFG_CUSTOM, 1)

◆ cfg_nest_hedgebank1

CfgInt cfg_nest_hedgebank1("PAR_NEST_HEDGEBANKONE", CFG_CUSTOM, 100)

◆ cfg_nest_hedgebank2

CfgInt cfg_nest_hedgebank2("PAR_NEST_HEDGEBANKTWO", CFG_CUSTOM, 200)

◆ cfg_nest_naturalgrass

CfgInt cfg_nest_naturalgrass("PAR_NEST_NATURALGRASS", CFG_CUSTOM, 100)

Nesting quality for natural grass.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_permpastlowyield

CfgInt cfg_nest_permpastlowyield("PAR_NEST_PERMPASTLOWYIELD", CFG_CUSTOM, 1)

Nesting quality for low yield pasture.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_permpasttussocky

CfgInt cfg_nest_permpasttussocky("PAR_NEST_PERMPASTTUSSOCKY", CFG_CUSTOM, 1)

Nesting quality for very low grazed pasture.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_permsetaside

CfgInt cfg_nest_permsetaside("PAR_NEST_PERMSETASIDE", CFG_CUSTOM, 100)

Nesting quality for setaside.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_railway

CfgInt cfg_nest_railway("PAR_NEST_RAILWAY", CFG_CUSTOM, 100)

Nesting quality for railway ebankments.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_nest_roadside

CfgInt cfg_nest_roadside("PAR_NEST_ROADSIDE", CFG_CUSTOM, 100)

Nesting quality for roadsize verges.

Referenced by Partridge_Covey::NestGoodSpot().

◆ cfg_NOT1950sinsects

CfgFloat cfg_NOT1950sinsects("PAR_NOTFIFTIESINSECTSSCALER", CFG_CUSTOM, 0.1)

Default for 2000s, 1950s=1.0.

Referenced by Partridge_Covey::MoveMagicVegToFood().

◆ cfg_par_bio_hindrance_inv

CfgFloat cfg_par_bio_hindrance_inv("PAR_BIO_HINDRANCE", CFG_CUSTOM, 0.00667)

◆ cfg_par_chick_extra_mort

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().

◆ cfg_par_covey_drift_enable

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().

◆ cfg_par_covey_drift_speed

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().

◆ cfg_par_firstmerge

CfgInt cfg_par_firstmerge("PAR_FIRSTMERGE", CFG_CUSTOM, 150)

The Earliest merging date.

Referenced by CoveyManager::Tick().

◆ cfg_par_flyto_stepsize

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().

◆ cfg_par_force_abs_limit

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().

◆ cfg_par_force_below

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().

◆ cfg_par_force_enable

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().

◆ cfg_par_force_ignore_below

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().

◆ cfg_par_force_ignore_dist_sq

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().

◆ cfg_par_force_speed

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().

◆ cfg_par_hei_hindrance_inv

CfgFloat cfg_par_hei_hindrance_inv("PAR_HEI_HINDRANCE", CFG_CUSTOM, 0.04)

◆ cfg_par_highqualthreshold

CfgInt cfg_par_highqualthreshold("PAR_HIGHQUALTHRESHOLD", CFG_CUSTOM, 18)

An arbitrary value for determine movement quality.

Referenced by Partridge_Covey::MoveEvalEdgesAndQual().

◆ cfg_par_lastmerge

CfgInt cfg_par_lastmerge("PAR_LASTMERGE", CFG_CUSTOM, 59)

The latest merging date.

Referenced by CoveyManager::Tick().

◆ cfg_par_mature_threshold

CfgInt cfg_par_mature_threshold

Age at maturing in days.

Referenced by Partridge_Covey::BeginStep().

◆ cfg_par_merging_chance

CfgInt cfg_par_merging_chance("PAR_MERGE_CHANCE", CFG_CUSTOM, 5)

The merging probability.

Referenced by Partridge_Covey::ManagerCheckMerge().

◆ cfg_par_move_fuzzy_chance

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().

◆ cfg_par_movequal_histlimit

CfgInt cfg_par_movequal_histlimit("PAR_MOVEQUAL_HISTLIMIT", CFG_CUSTOM, 3)

The length of memory for backtracking.

Referenced by Partridge_Covey::MoveSelectLimit().

◆ cfg_par_parentdead_age1

CfgInt cfg_par_parentdead_age1("PAR_PARENTDEAD_AGEONE", CFG_CUSTOM, 35)

Mortalty chance on parent death, young.

Referenced by Partridge_Covey::ActOnParentDeath().

◆ cfg_par_parentdead_age2

CfgInt cfg_par_parentdead_age2("PAR_PARENTDEAD_AGETWO", CFG_CUSTOM, 63)

Mortalty chance on parent death, older.

Referenced by Partridge_Covey::ActOnParentDeath().

◆ cfg_par_parentdead_mort

CfgInt cfg_par_parentdead_mort("PAR_PARENTDEAD_MORT", CFG_CUSTOM, 100)

Mortalty chance on parent death.

Referenced by Partridge_Covey::ActOnParentDeath().

◆ cfg_parinsectScaler

CfgFloat cfg_parinsectScaler("PAR_INSECTSCALER", CFG_CUSTOM, 0.5)

Default for 2000s, 1950s=1.0.

Referenced by Partridge_Covey::MoveMagicVegToFood().

◆ cfg_terr_qual_good

CfgFloat cfg_terr_qual_good("PAR_TERR_QUAL_GOOD", CFG_CUSTOM, 4.0)

Nesting quality for OK areas.

Referenced by Partridge_Covey::HabitatEvalPoly().

◆ g_covey_id_counter

unsigned int g_covey_id_counter = 0
static

Definition at line 231 of file Partridge_Covey.cpp.

Referenced by Partridge_Covey::Partridge_Covey().

◆ g_covey_manager

◆ g_FoodNeed

double g_FoodNeed[200]

◆ g_MaxWalk

int g_MaxWalk[200]

◆ g_par_nest_min_dist_bad_areas

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().

◆ g_par_nest_min_dist_other_nest

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().

◆ g_par_terr_max_width

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().

◆ g_trig_cos

◆ g_trig_sin

◆ m_move_allowed

◆ m_move_dir_qual

◆ m_move_list

◆ m_move_select_list

int m_move_select_list[8]
static

◆ m_move_select_size

int m_move_select_size
static

◆ m_move_veg_const

double m_move_veg_const

Definition at line 223 of file Partridge_Covey.cpp.

Referenced by Partridge_Covey::MoveVegConstInit().

◆ m_move_veg_const_init_done

bool m_move_veg_const_init_done = false
static

Definition at line 3299 of file Partridge_Covey.cpp.

Referenced by Partridge_Covey::MoveVegConstInit().