83 class CloverGrassGrazed1;
84 class CloverGrassGrazed2;
86 class FieldPeasSilage;
92 class OBarleyPeaCloverGrass;
94 class OCloverGrassGrazed1;
95 class OCloverGrassGrazed2;
96 class OCloverGrassSilage1;
98 class OFieldPeasSilage;
99 class OFirstYearDanger;
105 class OPermanentGrassGrazed;
107 class OSBarleySilage;
111 class OSpringBarleyExt;
112 class OSpringBarleyPigs;
114 class OWinterBarleyExt;
117 class OWinterWheatUndersown;
118 class OWinterWheatUndersownExt;
119 class PermanentGrassGrazed;
120 class PermanentGrassLowYield;
121 class PermanentGrassTussocky;
122 class PermanentSetAside;
124 class PotatoesIndustry;
129 class SpringBarleySpr;
130 class SpringBarleyPTreatment;
131 class SpringBarleySKManagement;
132 class SpringBarleyCloverGrass;
133 class SpringBarleySeed;
134 class SpringBarleySilage;
143 class WWheatPControl;
144 class WWheatPTreatment;
145 class WWheatPToxicControl;
146 class AgroChemIndustryCereal;
147 class WinterWheatStrigling;
148 class WinterWheatStriglingSingle;
149 class WinterWheatStriglingCulm;
150 class SpringBarleyCloverGrassStrigling;
151 class SpringBarleyStrigling;
152 class SpringBarleyStriglingCulm;
153 class SpringBarleyStriglingSingle;
154 class MaizeStrigling;
155 class WinterRapeStrigling;
156 class WinterRyeStrigling;
157 class WinterBarleyStrigling;
158 class FieldPeasStrigling;
159 class SpringBarleyPeaCloverGrassStrigling;
160 class YoungForestCrop;
403 bool a_lock,
int a_start,
bool a_first_year,
411 m_startday = a_start;
412 m_first_year = a_first_year;
413 m_next_tov=a_nextcrop;
453 FarmHuntRef.resize( 0 );
454 CheckedFarms.resize( 0 );
477 void SimpleEvent(
long a_date,
int a_todo,
bool a_lock );
485 void ChooseNextCrop (
int a_no_dates);
540 void Set_alfa (
double a_value,
int i){m_alfa[i]=a_value;};
542 void Set_beta1 (
double a_value,
int i){m_beta1[i]=a_value;};
544 void Set_beta2 (
double a_value,
int i){m_beta2[i]=a_value;};
546 void Set_Nnorm (
double a_value,
int i){m_Nnorm[i]=a_value;};
551 if(a_value==
"yes" || a_value==
"YES" || a_value==
"Yes" || a_value==
"1"){m_fixed[i]=
true;}
552 else {m_fixed[i]=
false;}
556 if(a_value==
"yes" || a_value==
"YES" || a_value==
"Yes" || a_value==
"1"){m_fodder[i]=
true;}
557 else {m_fodder[i]=
false;}
560 void Set_FUKey (
double a_value,
int i){m_FUKey[i]=a_value;};
607 void InitializeVector(vector<double>&vector);
687 virtual void Management(
void );
691 virtual void InitiateManagement(
void );
693 void AddField(
LE* a_newfield );
694 void RemoveField(
LE* a_field );
696 virtual ~
Farm(
void );
703 void Assign_rotation(vector<TTypesOfVegetation>a_new_rotation);
706 polylist* ListOpenFields(
int a_openness );
712 int GetNoOpenFields(
int a_openness);
714 int GetAreaOpenFields(
int a_openness);
716 APoint
GetValidCoords() { APoint pt; pt.m_x = m_fields[0]->GetValidX(); pt.m_y = m_fields[0]->GetValidY();
return pt; }
721 for (
int i = 0; i < m_fields.size(); i++)
723 int openness = m_fields[i]->GetOpenness();
724 if (openness > op) op = openness;
730 virtual bool SleepAllDay(
LE *a_field,
double a_user,
int a_days );
731 virtual bool AutumnPlough(
LE *a_field,
double a_user,
int a_days );
732 virtual bool AutumnHarrow(
LE *a_field,
double a_user,
int a_days );
733 virtual bool AutumnRoll(
LE *a_field,
double a_user,
int a_days );
734 virtual bool AutumnSow(
LE *a_field,
double a_user,
int a_days );
735 virtual bool WinterPlough(
LE *a_field,
double a_user,
int a_days );
736 virtual bool DeepPlough(
LE *a_field,
double a_user,
int a_days );
737 virtual bool SpringPlough(
LE *a_field,
double a_user,
int a_days );
738 virtual bool SpringHarrow(
LE *a_field,
double a_user,
int a_days );
739 virtual bool SpringRoll(
LE *a_field,
double a_user,
int a_days );
740 virtual bool SpringSow(
LE *a_field,
double a_user,
int a_days );
741 virtual bool HerbicideTreat(
LE *a_field,
double a_user,
int a_days );
742 virtual bool GrowthRegulator(
LE *a_field,
double a_user,
int a_days );
743 virtual bool FungicideTreat(
LE *a_field,
double a_user,
int a_days );
744 virtual bool InsecticideTreat(
LE *a_field,
double a_user,
int a_days );
745 virtual bool SynInsecticideTreat(
LE *a_field,
double a_user,
int a_days );
746 virtual bool ProductApplication0(
LE *a_field,
double a_user,
int a_days );
747 virtual bool ProductApplication1(
LE *a_field,
double a_user,
int a_days );
748 virtual bool Molluscicide(
LE *a_field,
double a_user,
int a_days );
749 virtual bool RowCultivation(
LE *a_field,
double a_user,
int a_days );
750 virtual bool Strigling(
LE *a_field,
double a_user,
int a_days );
751 virtual bool StriglingSow(
LE *a_field,
double a_user,
int a_days );
752 virtual bool HillingUp(
LE *a_field,
double a_user,
int a_days );
753 virtual bool Water(
LE *a_field,
double a_user,
int a_days );
754 virtual bool Swathing(
LE *a_field,
double a_user,
int a_days );
755 virtual bool Harvest(
LE *a_field,
double a_user,
int a_days);
756 virtual bool HarvestLong(
LE *a_field,
double a_user,
int a_days);
757 virtual bool CattleOut(
LE *a_field,
double a_user,
int a_days);
758 virtual bool CattleOutLowGrazing(
LE *a_field,
double a_user,
int a_days );
759 virtual bool CattleIsOut(
LE *a_field,
double a_user,
int a_days,
int a_max );
760 virtual bool CattleIsOutLow(
LE *a_field,
double a_user,
int a_days,
int a_max );
761 virtual bool PigsOut(
LE *a_field,
double a_user,
int a_days );
762 virtual bool PigsAreOut(
LE *a_field,
double a_user,
int a_days );
763 virtual bool PigsAreOutForced(
LE *a_field,
double a_user,
int a_days );
764 virtual bool CutToHay(
LE *a_field,
double a_user,
int a_days );
765 virtual bool CutWeeds(
LE *a_field,
double a_user,
int a_days );
766 virtual bool CutToSilage(
LE *a_field,
double a_user,
int a_days );
767 virtual bool CutOrch(
LE *a_field,
double a_user,
int a_days );
768 virtual bool StrawChopping(
LE *a_field,
double a_user,
int a_days );
769 virtual bool HayTurning(
LE *a_field,
double a_user,
int a_days );
770 virtual bool HayBailing(
LE *a_field,
double a_user,
int a_days );
771 virtual bool BurnStrawStubble(
LE *a_field,
double a_user,
int a_days );
772 virtual bool StubbleHarrowing(
LE *a_field,
double a_user,
int a_days );
773 virtual bool FP_NPKS(
LE *a_field,
double a_user,
int a_days );
774 virtual bool FP_NPK(
LE *a_field,
double a_user,
int a_days );
775 virtual bool FP_PK(
LE *a_field,
double a_user,
int a_days );
776 virtual bool FP_LiquidNH3(
LE *a_field,
double a_user,
int a_days );
777 virtual bool FP_Slurry(
LE *a_field,
double a_user,
int a_days );
778 virtual bool FP_ManganeseSulphate(
LE *a_field,
double a_user,
int a_days );
779 virtual bool FP_Manure(
LE *a_field,
double a_user,
int a_days );
780 virtual bool FP_GreenManure(
LE *a_field,
double a_user,
int a_days );
781 virtual bool FP_Sludge(
LE *a_field,
double a_user,
int a_days );
782 virtual bool FA_NPK(
LE *a_field,
double a_user,
int a_days );
783 virtual bool FA_PK(
LE *a_field,
double a_user,
int a_days );
784 virtual bool FA_Slurry(
LE *a_field,
double a_user,
int a_days );
785 virtual bool FA_AmmoniumSulphate(
LE *a_field,
double a_user,
int a_days );
786 virtual bool FA_Manure(
LE *a_field,
double a_user,
int a_days );
787 virtual bool FA_GreenManure(
LE *a_field,
double a_user,
int a_days );
788 virtual bool FA_Sludge(
LE *a_field,
double a_user,
int a_days );
790 virtual bool Trial_PesticideTreat(
LE *a_field,
double a_user,
int a_days );
791 virtual bool Trial_PesticideTreat_DateLimited(
LE *a_field,
double ,
int );
792 virtual bool Trial_PesticideTreat_GS(
LE *a_field,
double a_user,
int a_days );
793 virtual bool Trial_ToxicControl(
LE *a_field,
double a_user,
int a_days );
794 virtual bool Trial_Control(
LE *a_field,
double a_user,
int a_days );
795 virtual bool Glyphosate(
LE *a_field,
double a_user,
int a_days );
799 LE *a_field,
int a_todo,
long a_num,
800 bool a_lock,
int a_start,
802 bool DoIt(
int a_probability );
805 int GetTotalArea(
void);
806 double GetAreaDouble(
void);
810 APoint
GetCentroids() { APoint pt; pt.m_x = m_farm_centroidx; pt.m_y = m_farm_centroidy;
return pt; }
812 int ind = a_index - 1;
813 if (ind < 0) ind = (int)m_rotation.size() - 1;
814 return m_rotation[ind];
817 return m_rotation[a_index];
820 int ind = a_index + 1;
821 if (ind >= (
int)m_rotation.size()) ind = ind - (
int)m_rotation.size();
822 return m_rotation[ind];
825 m_HuntersList.push_back( a_hunter );
828 for (
int h = 0; h < m_HuntersList.size(); h++) {
829 if (m_HuntersList[ h ] == a_hunter) {
830 m_HuntersList.erase( m_HuntersList.begin() + h );
852 virtual int GetNextCropIndex(
int a_rot_index );
853 virtual void HandleEvents(
void );
855 void CheckRotationManagementLoop(
FarmEvent *ev );
856 void ReadRotation(std::string fname);
859 int InvIntPartition(vector<tpct>* items,
int target);
1129 virtual void InitiateManagement(
void );
1571 void FarmManagement();
1572 void InitiateManagement(
void );
1573 void AddField(
int a_OwnerIndex,
LE* a_newland,
int a_Owner);
1574 void RemoveField(
int a_OwnerIndex,
LE* a_field);
1575 int ConnectFarm(
int a_owner);
1577 void DumpFarmAreas();
1579 void DumpFarmrefs();
1583 void Save_diff_farm_types_areas();
1587 return (GetFarmPtr(a_farmref)->GetTotalArea());
1592 return (GetFarmPtr(a_farmref)->GetArea());
1597 return (GetFarmPtr(a_farmref)->GetType());
1602 return (GetFarmPtr(a_farmref)->GetNoFields());
1607 return (GetFarmPtr(a_farmref)->GetValidCoords());
1613 return (GetFarmPtr(a_farmref)->GetNoOpenFields(a_openness));
1619 return (GetFarmPtr(a_farmref)->GetAreaOpenFields(a_openness));
1624 for (
unsigned int i = 0; i < m_farms.size( ); i++) {
1625 if (a_owner == m_farms[ i ]->GetFarmNumber( )) {
1626 return m_farms[ i ];
1629 g_msg->
Warn(
"FarmManager::GetFarmPtr - missing farm ref", a_owner );
1635 return m_farms[ a_index ];
1640 void CalcCentroids() {
for (
unsigned int i = 0; i < m_farms.size(); i++) m_farms[i]->Centroids(); }
1642 bool InIllegalList(
int a_farm_ref, vector<int> * a_farmlist );
1644 void AddToIllegalList(
int a_farm_ref, vector<int> * a_farmlist );
1646 int FindClosestFarm(
HunterInfo a_hinfo, vector<int> *a_farmlist);
1650 int FindClosestFarmOpenness(
HunterInfo a_hinfo, vector<int> * a_farmlist,
int a_openness );
1652 int FindClosestFarmOpennessProb(
HunterInfo a_hinfo, vector<int> * a_farmlist,
int a_openness );
1654 int FindClosestFarmOpennessProbSmallIsBest(
HunterInfo a_hinfo, vector<int> * a_farmlist,
int a_openness, vector<int> * a_farmsizelist );
1656 int FindClosestFarmOpennessProbNearRoostIsBest(
HunterInfo a_hinfo, vector<int> * a_farmlist,
int a_openness, vector<APoint> * a_farmsizelist );
1658 int FindFarmWithRandom(vector<int> * a_farmlist);
1660 int FindFarmWithOpenness(vector<int> * a_farmlist,
int a_openness);
1662 int FindOpennessFarm(
int a_openness);
1664 bool CheckOpenness(
int a_openness,
int a_ref );
1668 for (
unsigned int i = 0; i < m_farms.size(); i++)
1670 if (a_farmref == m_farms[i]->GetFarmNumber())
1672 return m_farms[i]->GetCentroids();
1675 g_msg->
Warn(
"FarmManager::GetFarmCentroid - missing farm ref", a_farmref);
1679 bool IsDuplicateRef(
int a_ref,
HunterInfo* a_hinfo);
1681 double GetSpilledGrain();
1683 double GetSpilledMaize();
1686 m_SpilledGrain = a_spilledgrain;
1690 void FindNeighbours();
1692 double GetDD (
void){
return daydegrees;};
1693 void SetDD (
double a_dd){daydegrees = a_dd;};
1699 void ActualProfit();
1701 void ChooseDecisionMode_for_farms();
1703 void Save_last_years_crops_for_farms();
1705 void PrintDecModes_counts();
1707 void PrintFinalResults();
1709 void Switch_rotation();
1747 for (
int i = 0; i < (int)m_farms.size(); i++)
1749 if (m_farmmapping_lookup[i * 2] == a_farmref)
1754 g_msg->
Warn(
"FarmManager::GetRenumberedFarmRef(int a_farmref) Farm reference number not found in m_farmmapping_lookup ", a_farmref );
1758 return (
int)m_farms.size();
1765 void CreateFarms(
const char *a_farmfile );
1819 void ReadFarmsData();
1821 void ReadLivestockNumbers();
1823 void ReadInitialCropAreas();
1827 void ReadFarmsData_perFarmType();
1831 void ReadLivestockData();
1835 void ReadCropsData();
1837 void ReadCropsData_perSoilType();
1839 void ReadCropsData_perFarmType();
1841 void ReadCropsData_perFarm_and_Soil();
1843 void ReadCropsData_perFarm_and_Soil_and_Size();
1847 void ReadInitialCropAreas_almass();
1849 void ReadCropsData_almass();
1851 void ReadCropsData_perSoilType_almass();
1853 void ReadCropsData_perFarmType_almass();
1855 void ReadCropsData_perFarm_and_Soil_almass();
1857 void ReadCropsData_perFarm_and_Soil_and_Size_almass();
1860 void ReadEnergyMaizePrice();
1865 void OptimisationOutput();
1869 void CropDistribution();
1871 void Create_Output_file_for_farms();
1873 void ReadLookupTable();
1875 void PrintNeighbours();
1877 void DistributeFarmerTypes();
1919 bool Harvest(
LE *a_field,
double a_user,
int a_days );
1921 void Match_crop_to_field(
LE* a_field);
1926 void ActualProfit();
1928 void Save_last_years_crops();
1930 void ChooseDecisionMode();
1936 virtual double Prob_multiplier ();
1941 void Init(ofstream * ap_output_file);
1945 virtual void InitiateManagement(
void );
1948 virtual void HandleEvents(
void );
1950 virtual bool FungicideTreat(
LE *a_field,
double ,
int a_days );
1952 virtual bool InsecticideTreat(
LE *a_field,
double ,
int a_days );
1954 virtual bool HerbicideTreat(
LE *a_field,
double ,
int a_days );
2129 virtual void createCropsLists(
int a_foobar);
2131 void createVariableCrops(
int a_foobar);
2133 void FarmLevelCalculation();
2135 void OptimiseFarm(
int a_foobar);
2138 void Check_SG_and_CGG();
2142 void findTotalArea();
2144 void findTotalNanim();
2148 virtual void findFodderDemand();
2155 void optimizeCrops(
int a_foobar);
2159 void findFertilizer(
CropOptimised * a_crop,
int a_foobar,
double benefit);
2171 void findGrossMargin(
CropOptimised * a_crop,
int a_foobar,
double benefit);
2179 virtual void determineAreas(
int a_foobar);
2181 void determineAreas_ha(vector<CropOptimised*>crops);
2185 virtual void checkRestrictions();
2191 void setRotationCropsAtMax();
2195 double crop_parameter(
int index,
string par_name);
2205 void sortCrops(vector<CropSort> &cropsToSort,
string sortingKey);
2207 void randomizeCropList(vector<CropSort> &listToRandomize,
string key);
2209 virtual void increaseCrops(vector<CropSort>cropsToIncrease,
double &howMuchToIncrease);
2211 virtual void decreaseCrops(vector<CropSort>cropsToDecrease,
double &howMuchToDecrease);
2213 void Print_FarmVariables (ofstream * ap_output_file);
2215 void Make_rotations();
2217 void Check_if_area_100();
2219 void Translate_crops_to_almass();
2221 void Make_almass_crops_vector();
2223 void Make_rotational_crops();
2225 void Print_rotations(ofstream * ap_output_file);
2257 virtual void createCropsLists(
int a_foobar);
2259 virtual void determineAreas(
int a_foobar);
2263 void createFodderCrops(
int a_foobar);
2265 void findFodderCropSavings();
2267 void correctFodderDemand(
int a_foobar);
2269 void determineFodderAreas(
int a_foobar);
2271 void determineMinFodder(
int a_foobar);
2275 virtual void checkWinterRotation1();
2277 virtual void checkWinterCrops();
2281 virtual void increaseCrops(vector<CropSort>cropsToIncrease,
double &howMuchToIncrease);
2283 virtual void decreaseCrops(vector<CropSort>cropsToDecrease,
double &howMuchToDecrease);
2297 virtual void checkRestrictions();
2299 void check_WRape_WBarley();
2312 vector<CropSort>m_cattleCrops;
2316 virtual void checkRestrictions();
2318 void checkCattleRotation();
2320 void checkCattleRotation_almass();
2322 void setCattleCropsAtMin();
2324 virtual void preventCashCrops();
2340 virtual void findFodderDemand();
2344 virtual void checkWinterRotation1();
2346 virtual void checkWinterCrops();
A farm that can have its rotation defined by the user at runtime.
TTypesOfFarmSize Get_farmSize(void)
PermanentGrassGrazed * m_permgrassgrazed
PotatoesIndustry * m_potatoesindustry
double m_rotationMin
Minimum area in percent of farm's arable area for a given crop (depends on a farm size...
void Set_cropArea(double a_area)
TTypeOfFarmerGoal Get_main_goal()
The base class for all crops.
void Set_biomass_factor(double a_value, int i)
TTypesOfLivestockParameters
A farm that can have its rotation defined by the user at runtime.
OGrazingPigs * m_ograzingpigs
int m_rotation_sync_index
vector< double > m_previous_satisfaction_levels
Vector of satisfaction levels in five previous years.
virtual bool Spraying_fungins(TTypesOfVegetation)
vector< int > m_crop_lookup_table
Specifies which crop order is allowed in a rotation (i.e. if a given crop can follow another crop)...
Population_Manager * m_population_manager
vector< CropSort > m_winterCrops
Vector of structs containing pointers to winter crops.
Subclass of the OptimisingFarm. Either pig or cattle farm.
OTriticale * m_otriticale
double m_FUdemand
Amount of fodder needed for a given type of livestock. [fodder units].
A farm that can have its rotation defined by the user at runtime.
Inbuilt special purpose farm type.
int GetRandomFarmRefnum()
Returns a random farm reference number.
bool m_SpilledGrain
Is it 2013 (true) or 2014 (false) as far as grain goes.
void Set_main_goal(TTypeOfFarmerGoal a_goal)
virtual ~OptimisingFarm()
vector< double > m_cropParameters
Vector storing parameters of all crop types.
FieldPeasStrigling * m_fieldpeasstrigling
vector< bool > m_fixed
Crop Boolean parameter - fixed/variable crop. Farm type specific.
int GetFarmNoFields(int a_farmref)
Returns the number of fields owned by a from the farm ref num.
SpringBarleySpr * m_springbarleyspr
A farm that can have its rotation defined by the user at runtime.
TTypesOfVegetation GetNextCrop(int a_index)
APoint GetFarmValidCoords(int a_farmref)
Returns the number of fields owned by a from the farm ref num.
TTypesOfFarmSize md_farmSize
vector< CropOptimised * > m_fixedCrops
Vector of pointers to fixed crops.
OCloverGrassGrazed1 * m_OCGG1
void Set_Crop(CropOptimised *p_crop)
TTypesOfFarm GetType(void)
void SetFarmNumber(int a_farm_num)
A farm that can have its rotation defined by the user at runtime.
TTypesOfOptFarms m_farmType
Farm's type (cattle, pig, plant, other).
int GetFarmTotalSize(int a_farmref)
Returns the total farm area from the farm ref num.
double m_totalFUgrown
Fodder grown, i.e. obtained from growing fodder crops. [fodder units].
OWinterWheatUndersown * m_owinterwheatundersown
Struct used for storing data on pesticide usage throughout the whole simulation (one instance...
vector< int > FarmHuntRef
The hunter's is the farm reference number to where he hunts.
OWinterBarley * m_owinterbarley
vector< double > m_previous_incomes
Vector of incomes from previous years.
double m_totalBIHerb
Total amount of herbicides which is planned to be applied at a farm. Expressed as a Treatment frequen...
A farm that can have its rotation defined by the user at runtime.
double Get_sellingPrice_lastyr(int i)
Inbuilt special purpose farm type.
vector< int > m_decision_mode_counters
Vector with counters for each decision mode. 0 - imitation, 1 - social comparison, 2 - repeat, 3 - deliberation.
void Set_emaize_price(double a_value)
Class storing farm information: farm's number used in ALMaSS system, farm's soil type, farm's size (business or private) and farm's real ID number.
double totalOptFarmsArea_cattle
A farm that can have its rotation defined by the user at runtime.
A farm that can have its rotation defined by the user at runtime.
void Set_winterMax(int a_value, int i)
vector< CropOptimised * > m_crops
Vector of pointers to all crops.
vector< TTypesOfCrops > m_cropTypes
Crop types saved as enumarator types (Bedriftsmodel i.e. original crop optimization model crop mode)...
SpringRape * m_springrape
vector< AlmassCrop > m_crops_almass
Vector of structs with almass type crops with positive areas in % (result of optimisation).
vector< double > m_beta2
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
double totalOptFarmsArea_other
SeedGrass2 * m_seedgrass2
void Set_crops_summary_BIs(int i, double BI)
vector< CropSort > m_variableCrops
Vector of structs containing pointers to crops which are not fixed.
OWinterWheat * m_owinterwheat
SpringBarley * m_springbarley
double totalOptFarmsArea_plant
A farm that can have its rotation defined by the user at runtime.
SpringBarleySeed * m_springbarleyseed
TTypeOfFarmerGoal m_main_goal
Farmer's main goal (determined by a farmer's type) .
Inbuilt special purpose farm type.
vector< int > m_livestockNumbers
Vector containing numbers of all livestock types at farms included in the simulation.
double m_exp_income
An expected farm's income at a farm in a given year.
OMaizeSilage * m_omaizesilage
double m_area_rot
Area assigned to rotational crops. [ha].
virtual void MakeStockFarmer(void)
double m_actual_profit
An actual profit realised at a farm in a given year.
virtual void preventCashCrops()
Prevents small cattle farms from growing cash crops and maize silage.
TTypesOfFarmSize m_farmSize
Scale of the farm - business (size above 10 ha) or private (size below 10 ha).
AgroChemIndustryCereal * m_agrochemindustrycereal
void Set_livestockNumber(int a_number)
A data structure to hold hunter information for distribution.
void Set_cropParameter(double a_value, int i)
double m_income_ha
Value of income per ha of a crop. Includes value of sales and subsidy [DKK/ha].
Subclass of the NonAnimalFarm.
A farm that can have its rotation defined by the user at runtime.
int GetFarmArableSize(int a_farmref)
Returns the arable area from the farm ref num.
TTypesOfAnimals m_animalType
Type of livestock.
vector< CropSort > m_rotationCrops
Vector of structs containing pointers to (winter) rotation crops.
double m_costs_ha
Costs of growing 1 ha of a crop. Include costs of labour and machine (constant), pesticides (herbicid...
TTypesOfVegetation GetCrop(int a_index)
bool operator()(CropSort a, CropSort b)
vector< Hunter * > HunterList
int homeY
Hunter home y-coord.
OWinterRape * m_owinterrape
A farm that can have its rotation defined by the user at runtime.
void Set_Nnorm(double a_value, int i)
double m_BIFi
Value of BI for fung- and insecticides [BI/ha].
virtual void MakeStockFarmer(void)
void Set_crops_summary_BIs_fi(int i, double BIfi)
CloverGrassGrazed1 * m_CGG1
void Set_cropTypes_almass_str(string crop_type)
A class for storing livestock parameters and variables for optimising farms.
A farm that can have its rotation defined by the user at runtime.
bool m_renumbered
A flag to show whether renumbering was already done.
void SetSpilledGrain(bool a_spilledgrain)
Set m_SpilledGrain which is the flag for either 2013 (true) or 2014 (false) spilled grain distributio...
void Set_fodder(string a_value, int i)
FodderGrass * m_foddergrass
int Get_decision_mode_counters(int index)
vector< int > m_winterMax
Maximal area taken by winter crops at a farm. [%].
virtual ~OptimisingPigFarm()
TTypesOfAnimals Get_livestockTypes(int i)
double Get_cropArea(int index)
OFodderbeet * m_ofodderbeet
vector< CropSort > m_cattleCrops_almass
Vector of crops used in checkCattleRotation_almass.
double m_Nanim
Amount of animal fertilizer available at a farm per hectar. [kg/ha].
bool m_fakeCropTest
Set to true if the fake crop is present after determineAreas function.
double m_totalNanim
Total animal fertilizer at a farm. A sum of Livestock::m_NanimUsable (from all types of livestock)...
void Set_beta1(double a_value, int i)
int GetFarmNoOpenFields(int a_farmref, int a_openness)
Returns the number of fields with openness more than a_openness.
double Get_actual_profit()
CloverGrassGrazed2 * m_CGG2
double m_lossFi
Value of the yield loss due to the limited use of fung- and insecticides [%].
Struct redefining operator < - used for sorting crops.
double m_actual_aggregated_yield
Actual aggregated yield at a farm in a given year.
TTypesOfOptFarms Get_farmType(void)
WinterRapeStrigling * m_winterrapestrigling
int GetFarmTypeLookup(int a_ref)
Get a farm type from the lookup table.
vector< AlmassCrop > m_rotational_crops_copy
A copy of m_rotational_crops used when matching crops to fields.
vector< double > m_crops_fertilizer_trade
Stores information on aggregate (all farms) fertilizer trade (Nt) usage for each crop.
double m_totalWeeding
Total manual weeding planned at a farm.
double m_totalFUdemandBefore
Farm's total demand for fodder. [fodder units]
double m_areaPercent
Area of a crop in percent of a farm's total area [%].
vector< int > CheckedFarms
A list of farms that has been tested for duplicates.
Subclass of the NonAnimalFarm.
virtual void MakeStockFarmer(void)
A farm that carries out crop, pesticide and fertilizer planning using simplified optimisation or othe...
Base class for all population managers.
vector< PesticideData > m_crops_summary_BIs
Stores information on aggregate (all farms)pesticide usage for each crop.
double m_resp
Response - yield of a crop per ha [hkg/ha].
A farm that can have its rotation defined by the user at runtime.
TTypesOfVegetation m_event
virtual ~OptimisingPlantFarm()
Struct for storing ALMaSS crop type (TTypesOfVegetation) with a corresponding value (mainly crop area...
void Set_animals_no(int a_number)
double m_totalFUt
Fodder from trade (has to be purchased). [fodder units].
void Set_Livestock(Livestock *p_lvs)
double m_totalArea
Total area of a farm. A sum of initial crop areas (if in bedriftsmodel, i.e. original farm optimizati...
A farm that can have its rotation defined by the user at runtime.
Inbuilt special purpose farm type.
double m_areaVariable
Area of a crop that can be changed when checking for restrictions (=m_areaPercent - m_rotationMin) [%...
vector< CropSort > m_variableCrops2
Vector of structs containing pointers to crops which are not fixed and: in case of the winter rotatio...
double m_actual_costs
Actual costs at a farm in a given year.
vector< TTypesOfVegetation > m_rotation
int Get_livestockNumber(int index)
A farm that can have its rotation defined by the user at runtime.
WinterRape * m_winterrape
TTypesOfSoils Get_soilType(void)
double m_grooming
Value of mechanical weed control for a crop - grooming [DKK/ha].
Used during saving farm/hunter information.
Inbuilt special purpose farm type.
A farm that can have its rotation defined by the user at runtime.
double m_GM
Value of gross margin for a crop (m_income_ha - m_costs_ha) [DKK/ha].
double m_totalLoss
Summary value of the yield loss due to the limited use of herbicides and fung- and insecticides [%]...
double m_exp_aggregated_yield
Expected aggregated yield at a farm in a given year.
double Get_sellingPrice(int i)
MaizeStrigling * m_maizestrigling
OWinterWheatUndersownExt * m_owinterwheatundersownext
int Get_soilSubType(void)
double m_totalArea_original
Total area of a farm as in bedriftsmodel, i.e. original farm optimization model. [ha].
int m_number
Number of animals of a given type at a farm.
OSeedGrass2 * m_oseedgrass2
APoint GetFarmCentroid(int a_farmref)
Gets the farm centroid as an APoint.
int m_soilSubType
Farm's soil subtype. Defined only for cattle farms on sandy soil (0-bad, 1-good, 2-undefined).
SpringBarleyStriglingCulm * m_springbarleystriglingculm
WinterBarleyStrigling * m_winterbarleystrigling
Inbuilt special purpose farm type.
double m_nt
Amount of purchased (and applied) fertilizer per ha of a crop [kg N/ha].
double Get_livestockParameter(int i)
void Set_Neighbour(OptimisingFarm *farm)
int refID
Unique reference number.
void Set_cropTypes_str(string crop_type)
Inbuilt special purpose farm type.
double m_totalCosts
Planned total costs of growing crops at a farm. [DKK].
TTypesOfOptFarms md_farmType
PermanentSetAside * m_permanentsetaside
A farm that can have its rotation defined by the user at runtime.
int m_farm_centroidy
Farm's centroid, value y. Equal to the average of the y centroid values of all farm's fields...
Farm * GetFarmPtrIndex(int a_index)
Returns the pointer to a farm with a specific index.
class MapErrorMsg * g_msg
SpringBarleyCloverGrassStrigling * m_springbarleyclovergrassstrigling
Inbuilt special purpose farm type.
Class for storing data for optimisation.
vector< CropOptimised * > m_grownVariableCrops
Vector of pointers to variable crops that are grown on area larger than areaMin (after determineAreas...
int m_farm_centroidx
Farm's centroid, value x. Equal to the average of the x centroid values of all farm's fields...
The base class for all farm types.
double Get_rotationMax(int i)
vector< double > m_cropAreas
Vector containing values of initial (i.e. in year the data is taken for) crop areas at farms included...
WinterWheatStriglingCulm * m_winterwheatstriglingculm
vector< TTypesOfVegetation > m_cropTypes_almass
Crop types saved as enumarator types (ALMaSS crop mode).
void Set_fixed(string a_value, int i)
string Get_cropTypes_almass_str(int i)
virtual void checkWinterRotation1()
Checks if the restriction on a winter rotation is fulfilled.
OSpringBarley * m_ospringbarley
vector< AlmassCrop > m_rotational_crops
Vector of structs with almass type crops with positive areas in % (result of optimisation): includes ...
int m_farmRealID
Farm's real ID number.
void Set_rotationMin(double a_value, int i)
double Get_cropParameter(int i)
bool cash_crops_allowed
Sets to true if cash crops are allowed. True by default.
A farm that can have its rotation defined by the user at runtime.
FarmEvent(TTypesOfVegetation a_event, LE *a_field, int a_todo, long a_run, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_nextcrop)
double m_totalBIFi
Total amount of fung- and insecticides which is planned to be applied at a farm. Expressed as a Treat...
vector< double > m_previous_profits
Vector of profits from previous years.
A farm that can have its rotation defined by the user at runtime.
A farm that can have its rotation defined by the user at runtime.
Subclass of the AnimalFarm.
vector< double > m_cropTotals_other_sum
Stores the sums of crops areas on other farms within one simulation at the landscape level...
SpringBarleySKManagement * m_springbarleyskmanagement
Struct used for sorting crops.
CropOptimised * Get_crop(int i)
ofstream * pm_output_file
double Get_emaize_price(int i)
vector< Livestock * > m_livestock
Vector of pointers to animals belonging to a farm.
double m_area_ha
Area of a crop in ha at a farm [ha].
double m_totalProfit
Planned total profit (= income - costs) at a farm. In case of animal farms costs of purchased fodder ...
double m_actual_income
An actual income at a farm in a given year.
WinterRyeStrigling * m_winterryestrigling
Fodderbeet * m_fodderbeet
vector< double > m_beta1
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
A farm that can have its rotation defined by the user at runtime.
void Set_beta2(double a_value, int i)
virtual void MakeStockFarmer(void)
virtual void MakeStockFarmer(void)
vector< bool > m_fodder
Crop Boolean parameter - fodder/non-fodder crop. Farm type specific.
FieldPeasSilage * m_fieldpeassilage
A farm that can have its rotation defined by the user at runtime.
A struct to hold the information required to trigger a farm event.
TTypesOfCrops Get_cropTypes(int i)
double m_exp_costs
Expected costs at a farm in a given year.
int GetNoFields()
Returns the number of the fields owned.
A farm that can have its rotation defined by the user at runtime.
Inbuilt special purpose farm type.
vector< double > m_cropTotals_pig_sum
Stores the sums of crops areas on pig farms within one simulation at the landscape level...
virtual double Prob_multiplier()
TTypesOfVegetation m_cropType_almass
Type/name of a crop (ALMaSS crops).
vector< double > m_previous_costs
Vector of costs from previous years.
A class for storing all parameters and results of crop optimisation.
int Get_NeighboursSize(void)
A farm that can have its rotation defined by the user at runtime.
int GetFarmNoLookup(int a_ref)
Get a farm reference from the lookup table.
double totalOptFarmsArea_pig
int GetMaxOpenness()
Returns the maximum openness score of the fields.
vector< double > m_rotationMin
Minimum acreage of a crop at a farm [%]. Farm type, soil type and farm size specific.
LowPriority< FarmEvent * > m_queue
PermanentGrassTussocky * m_permgrasstussocky
A farm that can have its rotation defined by the user at runtime.
WinterBarley * m_winterbarley
double m_assigned
Variable holding a value of area already reserved for certain crops at a farm. [0-100%].
vector< double > m_energy_maize_price
Vector with energy maize prices for each year of simulation.
vector< double > m_FUKey
Crop parameter: Fodder unit key, i.e. a number of fodder units obtained from a given crop [FU/hkg]...
double m_certainty_level
Farmer's certainty level.
FarmManager * m_OurManager
Pointer to the FarmManager.
vector< double > m_rotationMax
Maximum acreage of a crop at a farm [%]. Farm type, soil type and farm size specific.
void Set_sellingPrice(double a_value, int i)
double m_initialArea
Initial area of a crop on a farm [ha].
int GetFarmAreaOpenFields(int a_farmref, int a_openness)
Returns the area of fields with openness more than a_openness.
vector< PermCropData > m_PermCrops
WinterWheatStriglingSingle * m_winterwheatstriglingsingle
SpringBarleySilage * m_springbarleysilage
void Set_cropTotals(int i, double value)
A farm that can have its rotation defined by the user at runtime.
void Set_rotationMax(double a_value, int i)
double Get_biomass_factor(int i)
virtual bool Spraying_herbicides(TTypesOfVegetation)
OCloverGrassGrazed2 * m_OCGG2
double m_n
Total amount of fertilizer applied per ha of a crop [kg N/ha].
DataForOptimisation * pm_data
Pointer to the DataForOptimisation.
Struct used only in Bedriftsmodel crop type mode for creating m_rotation vector. Bool member used for...
void Set_cropTotals_plant_sum(int i, double crop_area)
vector< unsigned > polylist
int Get_livestockNumbersSize()
OFieldPeas * m_ofieldpeas
double m_fodderToProduce
Fodder that has to be produced to fulfill the min. fodder production restriction at the end of a year...
double m_fodderToProduceBefore
Fodder that has to be produced to fulfill the min. fodder production restriction at the beginning of ...
vector< AlmassCrop > Get_rotational_crops_visible()
double m_savings
Value of savings resulting from growing a fodder crop and not purchasing amount of fodder correspondi...
Used for storing permanent crop data for the farm rotation.
OSeedGrass1 * m_oseedgrass1
void Set_cropTotals_other_sum(int i, double crop_area)
APoint GetValidCoords()
Returns the valid coordinates of the first field owned by a farm.
vector< OptimisingFarm * > m_neighbours
Vector of pointers to the farms considered neighbours (fulfilling the neighbourship condition) of a g...
double m_area_scaling_factor
Factor used to scale areas of fixed crops and livestock numbers. Used to adjust these values to the f...
void CalcCentroids()
calculate all farm centroids
double m_totalGrooming
Total grooming planned at a farm.
double m_optimalN
Optimal amount of fertilizer per ha of a crop supposing ferilizer price equals zero [kg N/ha]...
vector< double > m_crop_areas_stages
Stores information on crop areas calculated in different stages of model development: for comparison ...
double Get_actual_aggregated_yield()
double m_GM_Savings
Holds the value of m_GM in case of non-fodder crops and a value of m_savings in case of fodder crops ...
OPermanentGrassGrazed * m_opermgrassgrazed
void Set_alfa(double a_value, int i)
TTypesOfVegetation Get_cropTypes_almass(int i)
Subclass of the OptimisingFarm. Either plant or other farm.
double m_totalNt
Total amount of fertilizer purchased at a farm. [kg].
double Get_cropTotals(int i)
WWheatPControl * m_wwheatpcontrol
SpringBarleyStriglingSingle * m_springbarleystriglingsingle
void Set_cropTypes_almass(TTypesOfVegetation crop_type)
A farm that can have its rotation defined by the user at runtime.
void Set_crops_fertilizer(int i, double fert)
SeedGrass1 * m_seedgrass1
double m_totalIncome
Planned total income from growing crops at a farm. [DKK].
TTypesOfVegetation GetPreviousCrop(int a_index)
bool force_deliberation
If set to true, a farm must use deliberation as a decision strategy.
double m_lossHerb
Value of the yield loss due to the limited use of herbicides [%].
vector< double > m_crops_fertilizer
Stores information on aggregate (all farms) fertilizer usage for each crop.
WWheatPTreatment * m_wwheatptreatment
void AddHunter(Hunter *a_hunter)
MaizeSilage * m_maizesilage
double m_totalHoeing
Total hoeing planned at a farm.
OWinterRye * m_owinterrye
OFirstYearDanger * m_ofirstyeardanger
virtual ~OptimisingCattleFarm()
vector< double > m_animals_numbers
Vector for storing numbers of animals at a farm in previous years (3).
OSpringBarleyPigs * m_ospringbarleypigs
double m_hoeing
Value of mechanical weed control for a crop - hoeing [DKK/ha].
vector< CropSort > m_fodderCrops
List of pointers to variable (non-fixed) fodder crops.
SpringBarleyCloverGrass * m_sbarleyclovergrass
double GetDD(void)
Returnes day degrees for the period March 1st - November 1st. Used for determining yields of crops th...
vector< string > m_str_cropTypes_almass
Crop types saved in string format (ALMaSS crop mode).
virtual void checkWinterCrops()
Checks if the restriction on a max. share of winter crops is fulfilled.
OptimisingFarm * m_previously_imitated_neighbour
The neighbouring farmer whose crops might be copied in imitation and social comparison decision modes...
OWinterBarleyExt * m_owinterbarleyext
void Set_cropTotals_sum(int i, double crop_area)
bool RemoveHunter(Hunter *a_hunter)
A farm that can have its rotation defined by the user at runtime.
double m_BI
Summary value of BI for herbicides and fung- and insecticides [BI/ha].
vector< double > m_biomass_factors
Factor used to determine actual response (yield per ha) based on crop biomass at a harvest...
A farm that can have its rotation defined by the user at runtime.
OSBarleySilage * m_osbarleysilage
double daydegrees
Daydegress for period March 1st - November 1st. Used to determine yield of crops that are not harvest...
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
OBarleyPeaCloverGrass * m_OBarleyPCG
YoungForestCrop * m_youngforest
SpringBarleyPTreatment * m_springbarleyptreatment
int * m_farmmapping_lookup
Used for a dynamic array of lookups converting farm references to internal renumbering.
vector< AlmassCrop > Get_rotational_crops()
A farm that can have its rotation defined by the user at runtime.
Used for storing farmers field size vectors.
double m_exp_profit
An expected farm's profit for a given year.
int GetRenumberedFarmRef(int a_farmref)
Returns the farm ref index for a farmref.
void Set_livestockParameter(double a_value, int i)
A farm that can have its rotation defined by the user at runtime.
vector< double > m_Nnorm
Maximum amount of fertilizer (N) that can be applied for a given crop [kg N/ha]. Soil specific...
vector< double > m_previous_aggregated_yields
Vector of aggregated yields from previous years.
SpringBarleyPeaCloverGrassStrigling * m_springbarleypeaclovergrassstrigling
vector< double > m_livestockParameters
Vector storing parameters of all livestock types.
A farm that can have its rotation defined by the user at runtime.
vector< FarmData * > m_farm_data
int Get_cropTypes_almass_size()
WWheatPToxicControl * m_wwheatptoxiccontrol
void Add_to_cropTotals(int i, double value)
BroadBeans * m_broadbeans
int animals_no
Holds the number of animals in a farm at a particular day in a year (depends on a species)...
A farm that can have its rotation defined by the user at runtime.
double m_need_satisfaction_level
Farmer's actual satisfaction level.
double m_rotationMax
Maximum area in percent of farm's arable area for a given crop (depends on a farm size...
vector< double > m_cropTotals_sum
Stores the sums of crops areas within one simulation at the landscape level.
int homeX
Hunter home x-coord.
int m_noCrops
Number of crops used in the simulation.
void Set_livestockTypes(TTypesOfAnimals livestock_type)
vector< string > m_str_cropTypes
Crop types saved in string format (Bedriftsmodel i.e. original crop optimization model crop mode)...
double m_BIHerb
Value of BI for herbicides [BI/ha].
double m_totalFodderToProduce
Fodder that has to be produced by a farm to fulfill the min. fodder production restriction. [fodder units].
virtual void MakeStockFarmer(void)
void Set_sellingPrice_lastyr(double a_value, int i)
bool GetIsRenumbered()
Returns the flag for renumbering.
vector< double > m_cropTotals_cattle_sum
Stores the sums of crops areas on cattle farms within one simulation at the landscape level...
TTypesOfCrops m_cropType
Type/name of a crop (original farm optimization model crop types).
OFieldPeasSilage * m_ofieldpeassilage
int m_almass_no
Farm's almass number.
vector< double > m_sellingPrice_lastyr
Selling price of a crop in a previous year [DKK/hkg]. Farm type specific and soil type specific...
Subclass of the AnimalFarm.
vector< TTypesOfAnimals > m_livestockTypes
Livestock types saved as enumarator types.
double m_weeding
Value of mechanical weed control for a crop - manual weeding [DKK/ha].
vector< double > m_alfa
Crop parameter for response (growth) function (resp = alfa + beta1*N + beta2*N^2; defines relationshi...
void Set_cropTotals_pig_sum(int i, double crop_area)
SpringBarleyStrigling * m_springbarleystrigling
double m_totalFUdemand
Farm's total demand for fodder (it is covered by growing fodder crops and/or purchasing fodder and th...
A farm that can have its rotation defined by the user at runtime.
TTypesOfVegetation Get_crops_summary_BIs_tov(int i)
void Set_cropTypes(TTypesOfCrops crop_type)
void Set_crops_summary_BIs_herb(int i, double BIherb)
HunterList m_HuntersList
A list of hunters allocated to this farm.
PermanentGrassLowYield * m_permgrasslowyield
WinterWheat * m_winterwheat
Farm * GetFarmPtr(int a_owner)
Returns the pointer to a farm with a specific number.
A farm that can have its rotation defined by the user at runtime.
WinterWheatStrigling * m_winterwheatstrigling
OCloverGrassSilage1 * m_OCGS1
TTypesOfSoils md_soilType
vector< double > m_cropTotals_plant_sum
Stores the sums of crops areas on plant farms within one simulation at the landscape level...
OrchardCrop * m_orchardcrop
virtual ~OptimisingOtherFarm()
OSpringBarleyExt * m_ospringbarleyext
TTypesOfVegetation m_next_tov
A farm that can have its rotation defined by the user at runtime.
TTypesOfFarm GetFarmType(int a_farmref)
Returns the farm type from the farm ref num.
string Get_cropTypes_str(int i)
int Get_cropTotals_size()
void Set_cropTotals_cattle_sum(int i, double crop_area)
double Get_rotationMin(int i)
double m_NanimUsable
Amount of usable animal fertilizer from a given type of livestock. [kg].
vector< double > m_cropTotals
Stores crops areas at the landscape level per year.
vector< AlmassCrop > m_rotational_crops_visible
Stores a copy of m_rotational_crops from a previous year and is accessible to farmers who want to cop...
double m_totalBI
Total amount of pesticides (sum of m_totalBIHerb and m_totalBIFi) which is planned to be applied at a...
TTypesOfSoils m_soilType
Farm's soil type (sandy, clay, other).
A farm that can have its rotation defined by the user at runtime.
int Get_lookup_table(int index)
OptimisingFarm * Get_Neighbour(int i)
A farm that can have its rotation defined by the user at runtime.
double m_benefit
A value of selling price for non-fodder crops or a value of fodder units obtained from a hkg of a fod...
vector< double > m_sellingPrice
Selling price of a crop [DKK/hkg]. Farm type specific and soil type specific.
double m_totalN
Total amount of fertilizer used at a farm. [kg].
void Set_crops_fertilizer_trade(int i, double fert_trade)
void Set_FUKey(double a_value, int i)