ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
OptimisingPigFarm Class Reference

Subclass of the AnimalFarm. More...

#include <farm.h>

Inheritance diagram for OptimisingPigFarm:
AnimalFarm OptimisingFarm Farm

Public Member Functions

 OptimisingPigFarm (FarmManager *a_myfarmmanager, int a_No)
 
virtual ~OptimisingPigFarm ()
 
- Public Member Functions inherited from AnimalFarm
 AnimalFarm (FarmManager *a_myfarmmanager, int a_No)
 
virtual ~AnimalFarm ()
 
- Public Member Functions inherited from OptimisingFarm
 OptimisingFarm (FarmManager *a_myfarmmanager, int a_No)
 The constructor. More...
 
virtual ~OptimisingFarm ()
 
TTypesOfOptFarms Get_farmType (void)
 
TTypesOfSoils Get_soilType (void)
 
TTypesOfFarmSize Get_farmSize (void)
 
int Get_farmRealID (void)
 
int Get_soilSubType (void)
 
int Get_almass_no (void)
 
CropOptimisedGet_crop (int i)
 
int Get_cropsSize (void)
 
void Set_Livestock (Livestock *p_lvs)
 
void Set_Crop (CropOptimised *p_crop)
 
void Set_Neighbour (OptimisingFarm *farm)
 
int Get_NeighboursSize (void)
 
OptimisingFarmGet_Neighbour (int i)
 
vector< AlmassCropGet_rotational_crops ()
 
vector< AlmassCropGet_rotational_crops_visible ()
 
double Get_actual_profit ()
 
double Get_actual_aggregated_yield ()
 
int GetFarmCentroidX ()
 
int GetFarmCentroidY ()
 
void Set_main_goal (TTypeOfFarmerGoal a_goal)
 
TTypeOfFarmerGoal Get_main_goal ()
 
void Set_animals_no (int a_number)
 
int Get_decision_mode_counters (int index)
 
bool Harvest (LE *a_field, double a_user, int a_days)
 OptimisingFarm's virtual version of Farm::Harvest(). Saves information on biomass of a crop at harvest. More...
 
void Match_crop_to_field (LE *a_field)
 Finds a crop to be grown on a given field next year. More...
 
OptimisingFarmFind_neighbour_to_imitate ()
 Picks randomly a farmer to imitate/compare with. It chooses among neighbouring farmers with similar farms. More...
 
void ActualProfit ()
 Function that determines actual crop yields and profit in a given year. More...
 
void Save_last_years_crops ()
 It saves the OptimisingFarm::m_rotational_crops in a vector m_rotational_crops_visible which is accessible for other farmers if they decide to copy it in the following year. More...
 
void ChooseDecisionMode ()
 Function determines which decision mode to use. The choice depends on the values of need satisfaction and uncertainty. More...
 
virtual bool Spraying_herbicides (TTypesOfVegetation a_tov_type)
 Returns true if a farmer decided to treat a given crop with herbicides. More...
 
virtual bool Spraying_fungins (TTypesOfVegetation a_tov_type)
 Returns true if a farmer decided to treat a given crop with fung- and insecticides. More...
 
virtual double Prob_multiplier ()
 Used when determining whether there should be a spraying event (i.e. pesticides application) or not. For yield maximizer it increases the chance of spraying event to account for his 'just in case' spraying. More...
 
void Init (ofstream *ap_output_file)
 Function carrying out the initial calculations at a farm level (including the initial optimisation). More...
 
- Public Member Functions inherited from Farm
virtual void Management (void)
 Starts the main management loop for the farm and performs some error checking. More...
 
void AddField (LE *a_newfield)
 Adds a field to a farm. More...
 
void RemoveField (LE *a_field)
 Removes a field from a farm. More...
 
 Farm (FarmManager *a_manager)
 Farm constructor - creates an instance of each possible crop type. More...
 
virtual ~Farm (void)
 Farm destructor - deletes all crop instances and empties event queues. More...
 
void SetFarmNumber (int a_farm_num)
 
int GetFarmNumber (void)
 
void Assign_rotation (vector< TTypesOfVegetation >a_new_rotation)
 
polylistListOpenFields (int a_openness)
 Returns a list of fields with openness above a_openness. More...
 
void Centroids ()
 Finds farm's centroids - x and y. More...
 
int GetNoFields ()
 Returns the number of the fields owned. More...
 
int GetNoOpenFields (int a_openness)
 Returns the number of the fields above an openness of a_openness. More...
 
int GetAreaOpenFields (int a_openness)
 Returns the area of the fields above an openness of a_openness. More...
 
APoint GetValidCoords ()
 Returns the valid coordinates of the first field owned by a farm. More...
 
int GetMaxOpenness ()
 Returns the maximum openness score of the fields. More...
 
virtual bool SleepAllDay (LE *a_field, double a_user, int a_days)
 Nothing to to today on a_field. More...
 
virtual bool AutumnPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the autumn on a_field. More...
 
virtual bool StubblePlough (LE *a_field, double a_user, int a_days)
 Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normally 6-8cm, is special cases up to 12-15cm). Done as a part of after-harvest treatments (instead of stubble cultivation) More...
 
virtual bool StubbleCultivatorHeavy (LE *a_field, double a_user, int a_days)
 Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can be done instead of autumn plough (on a depth up to 40 cm even, if necessary) More...
 
virtual bool AutumnHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the autumn on a_field. More...
 
virtual bool AutumnRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the autumn on a_field. More...
 
virtual bool PreseedingCultivator (LE *a_field, double a_user, int a_days)
 Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to compact soil) More...
 
virtual bool PreseedingCultivatorSow (LE *a_field, double a_user, int a_days)
 Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including cultivator and string roller to compact soil) More...
 
virtual bool AutumnSow (LE *a_field, double a_user, int a_days)
 Carry out a sowing event in the autumn on a_field. More...
 
virtual bool WinterPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the winter on a_field. More...
 
virtual bool DeepPlough (LE *a_field, double a_user, int a_days)
 Carry out a deep ploughing event on a_field. More...
 
virtual bool SpringPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the spring on a_field. More...
 
virtual bool SpringHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the spring on a_field. More...
 
virtual bool SpringRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the spring on a_field. More...
 
virtual bool SpringSow (LE *a_field, double a_user, int a_days)
 Carry out a sowing event in the spring on a_field. More...
 
virtual bool SpringSowWithFerti (LE *a_field, double a_user, int a_days)
 Carry out a sowing event with start fertilizer in the spring on a_field. More...
 
virtual bool GrowthRegulator (LE *a_field, double a_user, int a_days)
 Apply growth regulator to a_field. More...
 
virtual bool ProductApplication (LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp)
 Apply test pesticide to a_field. More...
 
virtual bool ProductApplication_DateLimited (LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp)
 Special pesticide trial functionality. More...
 
virtual bool Molluscicide (LE *a_field, double a_user, int a_days)
 Apply molluscidie to a_field. More...
 
virtual bool RowCultivation (LE *a_field, double a_user, int a_days)
 Carry out a harrowing between crop rows on a_field. More...
 
virtual bool Strigling (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding on a_field. More...
 
virtual bool StriglingSow (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding followed by sowing on a_field. More...
 
virtual bool StriglingHill (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding on a_field followed by hilling up (probably on potatoes) More...
 
virtual bool HillingUp (LE *a_field, double a_user, int a_days)
 Do hilling up on a_field, probably of potatoes. More...
 
virtual bool Water (LE *a_field, double a_user, int a_days)
 Carry out a watering on a_field. More...
 
virtual bool Swathing (LE *a_field, double a_user, int a_days)
 Cut the crop on a_field and leave it lying (probably rape) More...
 
virtual bool HarvestLong (LE *a_field, double a_user, int a_days)
 Carry out a harvest on a_field. More...
 
virtual bool CattleOut (LE *a_field, double a_user, int a_days)
 Start a grazing event on a_field today. More...
 
virtual bool CattleOutLowGrazing (LE *a_field, double a_user, int a_days)
 Start a extensive grazing event on a_field today. More...
 
virtual bool CattleIsOut (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out' event for every day the cattle are on a_field. More...
 
virtual bool CattleIsOutLow (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out_low' event for every day the cattle are on a_field. More...
 
virtual bool PigsOut (LE *a_field, double a_user, int a_days)
 Generate a 'pigs_out' event for every day the cattle are on a_field. More...
 
virtual bool PigsAreOut (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today or soon. More...
 
virtual bool PigsAreOutForced (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today - no exceptions. More...
 
virtual bool CutToHay (LE *a_field, double a_user, int a_days)
 Carry out hay cutting on a_field. More...
 
virtual bool CutWeeds (LE *a_field, double a_user, int a_days)
 Carry out weed topping on a_field. More...
 
virtual bool CutToSilage (LE *a_field, double a_user, int a_days)
 Cut vegetation for silage on a_field. More...
 
virtual bool CutOrch (LE *a_field, double a_user, int a_days)
 Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard. More...
 
virtual bool StrawChopping (LE *a_field, double a_user, int a_days)
 Carry out straw chopping on a_field. More...
 
virtual bool HayTurning (LE *a_field, double a_user, int a_days)
 Carry out hay turning on a_field. More...
 
virtual bool HayBailing (LE *a_field, double a_user, int a_days)
 Carry out hay bailing on a_field. More...
 
virtual bool BurnStrawStubble (LE *a_field, double a_user, int a_days)
 Burn stubble on a_field. More...
 
virtual bool StubbleHarrowing (LE *a_field, double a_user, int a_days)
 Carry out stubble harrowing on a_field. More...
 
virtual bool FP_NPKS (LE *a_field, double a_user, int a_days)
 Apply NPKS fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer, on a_field owned by an arable farmer. More...
 
virtual bool FP_LiquidNH3 (LE *a_field, double a_user, int a_days)
 Apply liquid ammonia fertilizer to a_field owned by an arable farmer. More...
 
virtual bool FP_Slurry (LE *a_field, double a_user, int a_days)
 Apply slurry to a_field owned by an arable farmer. More...
 
virtual bool FP_ManganeseSulphate (LE *a_field, double a_user, int a_days)
 Apply Manganse Sulphate to a_field owned by an arable farmer. More...
 
virtual bool FP_AmmoniumSulphate (LE *a_field, double a_user, int a_days)
 Apply Ammonium Sulphate to a_field owned by an arable farmer. More...
 
virtual bool FP_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an arable farmer. More...
 
virtual bool FP_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an arable farmer. More...
 
virtual bool FP_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege on a_field owned by an arable farmer. More...
 
virtual bool FP_RSM (LE *a_field, double a_user, int a_days)
 RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer. More...
 
virtual bool FP_Calcium (LE *a_field, double a_user, int a_days)
 Calcium applied on a_field owned by an arable farmer. More...
 
virtual bool FA_NPKS (LE *a_field, double a_user, int a_days)
 Apply NPKS fertilizer, on a_field owned by a stock farmer. More...
 
virtual bool FA_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer to a_field owned by an stock farmer. More...
 
virtual bool FA_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer to a_field owned by an stock farmer. More...
 
virtual bool FA_Slurry (LE *a_field, double a_user, int a_days)
 Spready slurry on a_field owned by an stock farmer. More...
 
virtual bool FA_ManganeseSulphate (LE *a_field, double a_user, int a_days)
 Apply manganese sulphate to a_field owned by an stock farmer. More...
 
virtual bool FA_AmmoniumSulphate (LE *a_field, double a_user, int a_days)
 Apply ammonium sulphate to a_field owned by an stock farmer. More...
 
virtual bool FA_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an stock farmer. More...
 
virtual bool FA_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an stock farmer. More...
 
virtual bool FA_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege sludge on a_field owned by an stock farmer. More...
 
virtual bool FA_RSM (LE *a_field, double a_user, int a_days)
 RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer. More...
 
virtual bool FA_Calcium (LE *a_field, double a_user, int a_days)
 Calcium applied on a_field owned by a stock farmer. More...
 
virtual bool Biocide (LE *a_field, double a_user, int a_days)
 Biocide applied on a_field. More...
 
virtual bool BedForming (LE *a_field, double a_user, int a_days)
 Do bed forming up on a_field, probably of carrots. More...
 
virtual bool ShallowHarrow (LE *a_field, double a_user, int a_days)
 Carry out a shallow harrow event on a_field, e.g., after grass cutting event. More...
 
virtual bool HeavyCultivatorAggregate (LE *a_field, double a_user, int a_days)
 Carry out a heavy cultivation event on a_field. This is non-inversion type of cultivation which can be done after fertilizers application on spring for a spring crop. More...
 
virtual bool FlowerCutting (LE *a_field, double a_user, int a_days)
 Flower cutting applied on a_field. More...
 
virtual bool BulbHarvest (LE *a_field, double a_user, int a_days)
 Carry out a bulb harvest on a_field. More...
 
virtual bool StrawCovering (LE *a_field, double a_user, int a_days)
 Straw covering applied on a_field. More...
 
virtual bool StrawRemoval (LE *a_field, double a_user, int a_days)
 Straw covering applied on a_field. More...
 
void AddNewEvent (TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop)
 Adds an event to the event queue for a farm. More...
 
bool DoIt (double a_probability)
 Return chance out of 0 to 100. More...
 
bool DoIt_prob (double a_probability)
 Return chance out of 0 to 1. More...
 
TTypesOfFarm GetType (void)
 
int GetArea (void)
 Returns the area of arable fields owned by that farm. More...
 
int GetTotalArea (void)
 Returns the area of all fields owned by that farm. More...
 
double GetAreaDouble (void)
 Returns the area of arable fields owned by that farm. More...
 
bool IsStockFarmer (void)
 
virtual void MakeStockFarmer (void)
 
int GetIntensity (void)
 
APoint GetCentroids ()
 
TTypesOfVegetation GetPreviousCrop (int a_index)
 
TTypesOfVegetation GetCrop (int a_index)
 
TTypesOfVegetation GetNextCrop (int a_index)
 
void AddHunter (Hunter *a_hunter)
 
void RemoveHunter (Hunter *a_hunter)
 

Protected Member Functions

virtual void checkRestrictions ()
 Checks if the restrictions are fulfilled and corrects crops' areas if necessary. More...
 
void check_WRape_WBarley ()
 Checks if the restriction on winter rape and winter barley attachment is fulfilled and corrects crops' areas if necessary. More...
 
- Protected Member Functions inherited from AnimalFarm
virtual void createCropsLists (int a_foobar)
 Creates lists of crops. More...
 
virtual void determineAreas (int a_foobar)
 Determines areas of variable crops. More...
 
void createFodderCrops (int a_foobar)
 Creates a list of pointers to all fodder crops. More...
 
void findFodderCropSavings ()
 Determines the savings resulting from growing a fodder crop relative to purchasing fodder. More...
 
void correctFodderDemand (int a_foobar)
 Determines how much fodder is produced from fixed crops and min. areas of variable crops. More...
 
void determineFodderAreas (int a_foobar)
 Determines areas of fodder crops and corrects areas of non-fodder crops. More...
 
void determineMinFodder (int a_foobar)
 Covers the min. required fodder production for animal farms. More...
 
virtual void checkWinterRotation1 ()
 Animal farm version of the OptimisingFarm::checkWinterRotation1() function (accounts for fodder changes). More...
 
virtual void checkWinterCrops ()
 Animal farm version of the checkWinterCrops() function (accounts for fodder changes). More...
 
virtual void increaseCrops (vector< CropSort >cropsToIncrease, double &howMuchToIncrease)
 Increases area of cropsToIncrease by howMuchToIncrease. More...
 
virtual void decreaseCrops (vector< CropSort >cropsToDecrease, double &howMuchToDecrease)
 Decreases area of cropsToDecrease by howMuchToDecrease. More...
 
- Protected Member Functions inherited from OptimisingFarm
virtual void InitiateManagement (void)
 Kicks off the farm's management. More...
 
void Initialize (FarmManager *a_pfm)
 Assigns to each farm its farm type, farm size, farm's real ID number, and soil type. It creates livestock and crops. More...
 
virtual void HandleEvents (void)
 If there are events to carry out do this, and perhaps start a new crop. More...
 
virtual bool FungicideTreat (LE *a_field, double, int a_days)
 Carries out fungicide application. Saves information on each application for a given crop. More...
 
virtual bool InsecticideTreat (LE *a_field, double, int a_days)
 Carries out insecticide application. Saves information on each application for a given crop. More...
 
virtual bool HerbicideTreat (LE *a_field, double, int a_days)
 Carries out herbicide application. Saves information on each application for a given crop. More...
 
void createVariableCrops (int a_foobar)
 Creates a list of pointers to all variable crops included in the optimisation and a list of pointers to fixed crops. More...
 
void FarmLevelCalculation ()
 Calls functions determining farm level values before the initial optimisation. More...
 
void OptimiseFarm (int a_foobar)
 Carries out the whole farm optimisation. More...
 
void Check_SG_and_CGG ()
 Modifies areas of SeedGrass1 and SeedGrass2, CloverGrassGrazed1 and CloverGrassGrazed2 to be even. Used only in ALMaSS crops mode (in Bedriftsmodel (original farm optimization model) crops mode this is taken care of in Translate_crops_to_almass()). More...
 
void findTotalArea ()
 Determines m_totalArea of a farm. More...
 
void findTotalNanim ()
 Determines total animal fertilizer (m_totalNanim) available at a farm. More...
 
void findNanim ()
 Determines amount of animal fertilizer per ha (m_Nanim) at a farm. More...
 
virtual void findFodderDemand ()
 Determines farm's total demand for fodder (m_totalFUdemand). More...
 
virtual void preventCashCrops ()
 Prevents small cattle farms from growing cash crops and maize silage. More...
 
void optimizeCrops (int a_foobar)
 Carries out crop optimisation at a farm. More...
 
void findFertilizer (CropOptimised *a_crop, int a_foobar, double benefit)
 Determines the optimal amounts of: total fertilizer (CropOptimised::m_n) and purchased fertilizer (CropOptimised::m_nt) for a given crop at a farm. More...
 
void findResponse (CropOptimised *a_crop, int a_foobar)
 Determines the response (CropOptimised::m_resp) of a crop at a farm. More...
 
void findBIs (CropOptimised *a_crop, double benefit)
 Determines the optimal Treatment frequency indices (behandling index, BI in Danish) (CropOptimised::m_BIHerb, CropOptimised::m_BIFi, CropOptimised::m_BI) for a given crop at a farm. More...
 
void fixBI ()
 Sets values of Treatment frequency indices (BI) for crops with fixed amount of pesticides (CropOptimised::m_BIHerb for FodderBeet and both CropOptimised::m_BIHerb and CropOptimised::m_BIFi for PotatoesIndustry and Potatoes). More...
 
void findMWeedControl (CropOptimised *a_crop)
 Determines the optimal mechanical weed control means (CropOptimised::m_grooming, CropOptimised::m_hoeing, CropOptimised::m_weeding) for a given crop at a farm. More...
 
void findYieldLoss (CropOptimised *a_crop)
 Determines the yield losses (CropOptimised::m_lossHerb, CropOptimised::m_lossFi, CropOptimised::m_totalLoss) for a given crop at a farm. More...
 
void findGrossMargin (CropOptimised *a_crop, int a_foobar, double benefit)
 Determines the gross margin (CropOptimised::m_GM) for a given crop at a farm. More...
 
void assignFixed ()
 Adds areas of fixed crops to the variable m_assigned. For each fixed crop it saves its area under variable CropOptimised::m_areaPercent. More...
 
void sumMinAreas ()
 Adds minimum required areas of variable crops to the variable m_assigned. More...
 
void determineAreas_ha (vector< CropOptimised * >crops)
 Determines areas of crops in ha. More...
 
void setRotationCropsAtMax ()
 Increases area of winter rotation crops to their max. allowed area. More...
 
double crop_parameter (int index, string par_name)
 Reads in crop parameters that do NOT vary with any farm level parameters. More...
 
CropOptimisedfindCropByName (string crop_name)
 Returns a pointer to a crop whose name is specified as the argument (bedriftsmodel, i.e. original farm optimization model, crops mode). More...
 
CropOptimisedfindCropByName_almass (string crop_name)
 Returns a pointer to almass crop whose name is specified as the argument (ALMaSS crops mode). More...
 
CropOptimisedfindCropByName_almass (TTypesOfVegetation a_tov_type)
 Returns a pointer to almass crop whose tov type is specified as the argument. More...
 
double total (TTypesOfCropVariables variable_name)
 Function for determining total values per farm after initial optimisation. More...
 
void sortCrops (vector< CropSort > &cropsToSort, string sortingKey)
 Sorts structs of type CropSort. More...
 
void randomizeCropList (vector< CropSort > &listToRandomize, string key)
 Swaps randomly elements of the list holding same values of the key (according to which the list was previosuly sorted). More...
 
void Print_FarmVariables (ofstream *ap_output_file)
 Prints farm-level variables to a text file (one file for all farms). More...
 
void Make_rotations ()
 Creates m_rotation. Not used in ALMaSS crop mode. More...
 
void Check_if_area_100 ()
 Checks if the sum of crops' areaPercent is 100%. More...
 
void Translate_crops_to_almass ()
 Translates crops from Bedriftsmodel (original farm optimization model) to Almass crops. Used in Bedriftsmodel crop mode. More...
 
void Make_almass_crops_vector ()
 Creates a vector storing crops with positive area. Used in ALMaSS crop mode. More...
 
void Make_rotational_crops ()
 Creates a vector m_rotational_crops using the results of optimisation. More...
 
void Print_rotations (ofstream *ap_output_file)
 Prints the content of a farm's m_rotation. Not used in ALMaSS crop mode. More...
 
- Protected Member Functions inherited from Farm
int GetFirstDate (TTypesOfVegetation a_tov)
 Gets the start date for a crop type. More...
 
int GetNextCropStartDate (LE *a_field, TTypesOfVegetation &a_curr_veg)
 Returns the start date of the next crop in the rotation. More...
 
virtual int GetFirstCropIndex (TTypesOfLandscapeElement a_type)
 Gets the first crop for the farm. More...
 
virtual int GetNextCropIndex (int a_rot_index)
 Returns the next crop in the rotation. More...
 
bool LeSwitch (FarmEvent *ev)
 Call do function for any crop with an outstanding event. Signal if the crop has terminated. More...
 
void CheckRotationManagementLoop (FarmEvent *ev)
 
void ReadRotation (std::string fname)
 Reads a rotation file into the rotation. More...
 
void AssignPermanentCrop (TTypesOfVegetation tov, int pct)
 Used to assign a permanent crop to an otherwise rotational field polygon. More...
 
int InvIntPartition (vector< tpct > *items, int target)
 Finds all possible sums of the integers in the items array. More...
 

Additional Inherited Members

- Protected Attributes inherited from AnimalFarm
CropOptimisedm_fakeCrop
 Crop used to fill up area of a farm up to 100% in case its non-fodder crops do not sum to 100% in determineAreas. Later this crop is removed in the function determineFodderAreas. More...
 
bool m_fakeCropTest
 Set to true if the fake crop is present after determineAreas function. More...
 
vector< CropSortm_fodderCrops
 List of pointers to variable (non-fixed) fodder crops. More...
 
double m_totalFodderToProduce
 Fodder that has to be produced by a farm to fulfill the min. fodder production restriction. [fodder units]. More...
 
double m_fodderToProduce
 Fodder that has to be produced to fulfill the min. fodder production restriction at the end of a year (should be zero). Accounts for fodder from fixed crops and from min. areas of variable crops. [fodder units]. More...
 
double m_fodderToProduceBefore
 Fodder that has to be produced to fulfill the min. fodder production restriction at the beginning of a year. Accounts for fodder from fixed crops and from min. areas of variable crops. Should be zero at the end of a year. [fodder units]. More...
 
bool cash_crops_allowed
 Sets to true if cash crops are allowed. True by default. More...
 
- Protected Attributes inherited from OptimisingFarm
TTypeOfFarmerGoal m_main_goal
 Farmer's main goal (determined by a farmer's type) . More...
 
vector< OptimisingFarm * > m_neighbours
 Vector of pointers to the farms considered neighbours (fulfilling the neighbourship condition) of a given farm. More...
 
double m_need_satisfaction_level
 Farmer's actual satisfaction level. More...
 
double m_certainty_level
 Farmer's certainty level. More...
 
vector< int > m_decision_mode_counters
 Vector with counters for each decision mode. 0 - imitation, 1 - social comparison, 2 - repeat, 3 - deliberation. More...
 
double m_actual_profit
 An actual profit realised at a farm in a given year. More...
 
double m_exp_profit
 An expected farm's profit for a given year. More...
 
double m_actual_income
 An actual income at a farm in a given year. More...
 
double m_exp_income
 An expected farm's income at a farm in a given year. More...
 
double m_actual_costs
 Actual costs at a farm in a given year. More...
 
double m_exp_costs
 Expected costs at a farm in a given year. More...
 
double m_actual_aggregated_yield
 Actual aggregated yield at a farm in a given year. More...
 
double m_exp_aggregated_yield
 Expected aggregated yield at a farm in a given year. More...
 
vector< double > m_previous_profits
 Vector of profits from previous years. More...
 
vector< double > m_previous_incomes
 Vector of incomes from previous years. More...
 
vector< double > m_previous_costs
 Vector of costs from previous years. More...
 
vector< double > m_previous_aggregated_yields
 Vector of aggregated yields from previous years. More...
 
vector< double > m_previous_satisfaction_levels
 Vector of satisfaction levels in five previous years. More...
 
OptimisingFarmm_previously_imitated_neighbour
 The neighbouring farmer whose crops might be copied in imitation and social comparison decision modes. More...
 
vector< double > m_animals_numbers
 Vector for storing numbers of animals at a farm in previous years (3). More...
 
bool force_deliberation
 If set to true, a farm must use deliberation as a decision strategy. More...
 
int animals_no
 Holds the number of animals in a farm at a particular day in a year (depends on a species). More...
 
vector< Livestock * > m_livestock
 Vector of pointers to animals belonging to a farm. More...
 
vector< CropOptimised * > m_crops
 Vector of pointers to all crops. More...
 
vector< CropSortm_variableCrops
 Vector of structs containing pointers to crops which are not fixed. More...
 
vector< CropSortm_variableCrops2
 Vector of structs containing pointers to crops which are not fixed and: in case of the winter rotation restriction - exclude winter rotation crops, in case of the cattle rotation restriction - exclude the three crops that form the condition of the restriction and winter wheat. More...
 
vector< CropOptimised * > m_grownVariableCrops
 Vector of pointers to variable crops that are grown on area larger than areaMin (after determineAreas function was called). More...
 
vector< CropOptimised * > m_fixedCrops
 Vector of pointers to fixed crops. More...
 
vector< CropSortm_rotationCrops
 Vector of structs containing pointers to (winter) rotation crops. More...
 
vector< CropSortm_winterCrops
 Vector of structs containing pointers to winter crops. More...
 
vector< AlmassCropm_crops_almass
 Vector of structs with almass type crops with positive areas in % (result of optimisation). More...
 
vector< AlmassCropm_rotational_crops
 Vector of structs with almass type crops with positive areas in % (result of optimisation): includes only rotational crops. More...
 
vector< AlmassCropm_rotational_crops_copy
 A copy of m_rotational_crops used when matching crops to fields. More...
 
vector< AlmassCropm_rotational_crops_visible
 Stores a copy of m_rotational_crops from a previous year and is accessible to farmers who want to copy this farm's crops (in imitation or social comparison decision mode). More...
 
TTypesOfOptFarms m_farmType
 Farm's type (cattle, pig, plant, other). More...
 
TTypesOfSoils m_soilType
 Farm's soil type (sandy, clay, other). More...
 
TTypesOfFarmSize m_farmSize
 Scale of the farm - business (size above 10 ha) or private (size below 10 ha). More...
 
int m_farmRealID
 Farm's real ID number. More...
 
int m_soilSubType
 Farm's soil subtype. Defined only for cattle farms on sandy soil (0-bad, 1-good, 2-undefined). More...
 
int m_almass_no
 Farm's almass number. More...
 
double m_totalArea
 Total area of a farm. A sum of initial crop areas (if in bedriftsmodel, i.e. original farm optimization model, crops mode) or a sum of farm's fields area (if in ALMaSS crops mode). [ha]. More...
 
double m_totalArea_original
 Total area of a farm as in bedriftsmodel, i.e. original farm optimization model. [ha]. More...
 
double m_area_scaling_factor
 Factor used to scale areas of fixed crops and livestock numbers. Used to adjust these values to the farm's area used in ALMaSS crops mode. More...
 
double m_totalNanim
 Total animal fertilizer at a farm. A sum of Livestock::m_NanimUsable (from all types of livestock). [kg]. More...
 
double m_Nanim
 Amount of animal fertilizer available at a farm per hectar. [kg/ha]. More...
 
double m_totalFUdemandBefore
 Farm's total demand for fodder. [fodder units] More...
 
double m_totalFUdemand
 Farm's total demand for fodder (it is covered by growing fodder crops and/or purchasing fodder and thus, at the end of a year it should not be positive). [fodder units] More...
 
double m_totalFUt
 Fodder from trade (has to be purchased). [fodder units]. More...
 
double m_totalFUgrown
 Fodder grown, i.e. obtained from growing fodder crops. [fodder units]. More...
 
double m_assigned
 Variable holding a value of area already reserved for certain crops at a farm. [0-100%]. More...
 
double m_totalN
 Total amount of fertilizer used at a farm. [kg]. More...
 
double m_totalNt
 Total amount of fertilizer purchased at a farm. [kg]. More...
 
double m_totalBIHerb
 Total amount of herbicides which is planned to be applied at a farm. Expressed as a Treatment frequency index (behandling indeks, BI in Danish). More...
 
double m_totalBIFi
 Total amount of fung- and insecticides which is planned to be applied at a farm. Expressed as a Treatment frequency index (behandling indeks, BI in Danish). More...
 
double m_totalBI
 Total amount of pesticides (sum of m_totalBIHerb and m_totalBIFi) which is planned to be applied at a farm. Expressed as a Treatment frequency index (behandling indeks, BI in Danish). More...
 
double m_totalGrooming
 Total grooming planned at a farm. More...
 
double m_totalHoeing
 Total hoeing planned at a farm. More...
 
double m_totalWeeding
 Total manual weeding planned at a farm. More...
 
double m_totalCosts
 Planned total costs of growing crops at a farm. [DKK]. More...
 
double m_totalIncome
 Planned total income from growing crops at a farm. [DKK]. More...
 
double m_totalProfit
 Planned total profit (= income - costs) at a farm. In case of animal farms costs of purchased fodder is subtracted from the profit. [DKK]. More...
 
double m_area_rot
 Area assigned to rotational crops. [ha]. More...
 
- Protected Attributes inherited from Farm
FarmManagerm_OurManager
 Pointer to the FarmManager. More...
 
LowPriority< FarmEvent * > m_queue
 
vector< LE * > m_fields
 
vector< TTypesOfVegetationm_rotation
 
vector< PermCropDatam_PermCrops
 
TTypesOfFarm m_farmtype
 
HunterList m_HuntersList
 A list of hunters allocated to this farm. More...
 
bool m_stockfarmer
 
int m_farm_num
 
int m_rotation_sync_index
 
int m_intensity
 
int m_farm_centroidx
 Farm's centroid, value x. Equal to the average of the x centroid values of all farm's fields. More...
 
int m_farm_centroidy
 Farm's centroid, value y. Equal to the average of the y centroid values of all farm's fields. More...
 
Carrots * m_carrots
 
BroadBeans * m_broadbeans
 
FodderGrass * m_foddergrass
 
CloverGrassGrazed1 * m_CGG1
 
CloverGrassGrazed2 * m_CGG2
 
FieldPeas * m_fieldpeas
 
FieldPeasSilage * m_fieldpeassilage
 
Fodderbeet * m_fodderbeet
 
Sugarbeet * m_sugarbeet
 
OFodderbeet * m_ofodderbeet
 
Maize * m_maize
 
MaizeSilage * m_maizesilage
 
OMaizeSilage * m_omaizesilage
 
OBarleyPeaCloverGrass * m_OBarleyPCG
 
OCarrots * m_ocarrots
 
OCloverGrassGrazed1 * m_OCGG1
 
OCloverGrassGrazed2 * m_OCGG2
 
OCloverGrassSilage1 * m_OCGS1
 
OFieldPeas * m_ofieldpeas
 
OFieldPeasSilage * m_ofieldpeassilage
 
OFirstYearDanger * m_ofirstyeardanger
 
OGrazingPigs * m_ograzingpigs
 
OrchardCrop * m_orchardcrop
 
Oats * m_oats
 
OOats * m_ooats
 
OPermanentGrassGrazed * m_opermgrassgrazed
 
OPotatoes * m_opotatoes
 
OSeedGrass1 * m_oseedgrass1
 
OSeedGrass2 * m_oseedgrass2
 
OSpringBarley * m_ospringbarley
 
OSpringBarleyExt * m_ospringbarleyext
 
OSpringBarleyPigs * m_ospringbarleypigs
 
OSBarleySilage * m_osbarleysilage
 
OTriticale * m_otriticale
 
OWinterBarley * m_owinterbarley
 
OWinterBarleyExt * m_owinterbarleyext
 
OWinterRape * m_owinterrape
 
OWinterRye * m_owinterrye
 
OWinterWheatUndersown * m_owinterwheatundersown
 
OWinterWheat * m_owinterwheat
 
OWinterWheatUndersownExt * m_owinterwheatundersownext
 
PermanentGrassGrazed * m_permgrassgrazed
 
PermanentGrassLowYield * m_permgrasslowyield
 
PermanentGrassTussocky * m_permgrasstussocky
 
PermanentSetAside * m_permanentsetaside
 
Potatoes * m_potatoes
 
PotatoesIndustry * m_potatoesindustry
 
SeedGrass1 * m_seedgrass1
 
SeedGrass2 * m_seedgrass2
 
SetAside * m_setaside
 
SpringBarley * m_springbarley
 
SpringBarleySpr * m_springbarleyspr
 
SpringBarleySKManagement * m_springbarleyskmanagement
 
SpringBarleyPTreatment * m_springbarleyptreatment
 
SpringBarleyCloverGrass * m_sbarleyclovergrass
 
SpringBarleySeed * m_springbarleyseed
 
SpringBarleySilage * m_springbarleysilage
 
SpringRape * m_springrape
 
Triticale * m_triticale
 
WinterBarley * m_winterbarley
 
WinterRape * m_winterrape
 
WinterRye * m_winterrye
 
WinterWheat * m_winterwheat
 
WWheatPControl * m_wwheatpcontrol
 
WWheatPToxicControl * m_wwheatptoxiccontrol
 
WWheatPTreatment * m_wwheatptreatment
 
AgroChemIndustryCereal * m_agrochemindustrycereal
 
WinterWheatStrigling * m_winterwheatstrigling
 
WinterWheatStriglingCulm * m_winterwheatstriglingculm
 
WinterWheatStriglingSingle * m_winterwheatstriglingsingle
 
SpringBarleyCloverGrassStrigling * m_springbarleyclovergrassstrigling
 
SpringBarleyStrigling * m_springbarleystrigling
 
SpringBarleyStriglingCulm * m_springbarleystriglingculm
 
SpringBarleyStriglingSingle * m_springbarleystriglingsingle
 
MaizeStrigling * m_maizestrigling
 
WinterRapeStrigling * m_winterrapestrigling
 
WinterRyeStrigling * m_winterryestrigling
 
WinterBarleyStrigling * m_winterbarleystrigling
 
FieldPeasStrigling * m_fieldpeasstrigling
 
SpringBarleyPeaCloverGrassStrigling * m_springbarleypeaclovergrassstrigling
 
YoungForestCrop * m_youngforest
 
NorwegianPotatoes * m_norwegianpotatoes
 
NorwegianOats * m_norwegianoats
 
NorwegianSpringBarley * m_norwegianspringbarley
 
PLWinterWheat * m_plwinterwheat
 
PLWinterRape * m_plwinterrape
 
PLWinterBarley * m_plwinterbarley
 
PLWinterTriticale * m_plwintertriticale
 
PLWinterRye * m_plwinterrye
 
PLSpringWheat * m_plspringwheat
 
PLSpringBarley * m_plspringbarley
 
PLMaize * m_plmaize
 
PLMaizeSilage * m_plmaizesilage
 
PLPotatoes * m_plpotatoes
 
PLBeet * m_plbeet
 
PLFodderLucerne1 * m_plfodderlucerne1
 
PLFodderLucerne2 * m_plfodderlucerne2
 
PLCarrots * m_plcarrots
 
PLSpringBarleySpr * m_plspringbarleyspr
 
PLWinterWheatLate * m_plwinterwheatlate
 
PLBeetSpr * m_plbeetspr
 
PLBeans * m_plbeans
 
NLBeet * m_nlbeet
 
NLCarrots * m_nlcarrots
 
NLMaize * m_nlmaize
 
NLPotatoes * m_nlpotatoes
 
NLSpringBarley * m_nlspringbarley
 
NLWinterWheat * m_nlwinterwheat
 
NLCabbage * m_nlcabbage
 
NLTulips * m_nltulips
 
NLGrassGrazed1 * m_nlgrassgrazed1
 
NLGrassGrazed1Spring * m_nlgrassgrazed1spring
 
NLGrassGrazed2 * m_nlgrassgrazed2
 
NLGrassGrazedLast * m_nlgrassgrazedlast
 
NLPermanentGrassGrazed * m_nlpermanentgrassgrazed
 
NLBeetSpring * m_nlbeetspring
 
NLCarrotsSpring * m_nlcarrotsspring
 
NLMaizeSpring * m_nlmaizespring
 
NLPotatoesSpring * m_nlpotatoesspring
 
NLSpringBarleySpring * m_nlspringbarleyspring
 
NLCabbageSpring * m_nlcabbagespring
 
NLCatchPeaCrop * m_nlcatchpeacrop
 
DummyCropPestTesting * m_dummycroppesttesting
 

Detailed Description

Subclass of the AnimalFarm.

Definition at line 2433 of file farm.h.

Constructor & Destructor Documentation

◆ OptimisingPigFarm()

OptimisingPigFarm::OptimisingPigFarm ( FarmManager a_myfarmmanager,
int  a_No 
)

Definition at line 5280 of file farm.cpp.

5280  :AnimalFarm(a_myfarmmanager, a_No){
5281 
5282 }

◆ ~OptimisingPigFarm()

virtual OptimisingPigFarm::~OptimisingPigFarm ( )
inlinevirtual

Definition at line 2436 of file farm.h.

2436 {};

Member Function Documentation

◆ check_WRape_WBarley()

void OptimisingPigFarm::check_WRape_WBarley ( )
protected

Checks if the restriction on winter rape and winter barley attachment is fulfilled and corrects crops' areas if necessary.

Used in ALMaSS crop mode, when crop assignemnt is based on GM distribution. 90% of pig farms grow winter barley if they have winter rape, since winter barley is usually grown before winter rape. Function checks if there is enough Winter Barley relative to Winter Rape. If not, it modifies these crops areas aiming at keeping as much as possibel of Winter Rape. There is also a check if after the changes the winter crops restricitons is not broken, in case it is, the areas of winter barley and winter rape are decreased.

Definition at line 7380 of file farm.cpp.

7380  {
7387  CropOptimised *wBarley;
7388  CropOptimised *wRape;
7389  wBarley = findCropByName_almass("WinterBarley");
7390  wRape = findCropByName_almass("WinterRape");
7391  double area_WB = wBarley->m_areaPercent;
7392  double area_WR = wRape->m_areaPercent;
7393 
7394  if(area_WB < area_WR){ //then need to make changes!
7395 
7396  //1. need to make new variableCrops2 - without wrape and wbarley
7397  m_variableCrops2 = m_variableCrops; //initiate the new list and remove crops:
7398  for(int s=(int)m_variableCrops2.size()-1; s>=0; s--){
7399  if(m_variableCrops2[s].crop==wBarley || m_variableCrops2[s].crop==wRape){
7400  m_variableCrops2.erase(m_variableCrops2.begin() + s);
7401  }
7402  }
7403 
7404  //check how much area available is there:
7405  double available=0;
7406  for(int i=0; i<(int)m_variableCrops2.size(); i++){ //can't use m_grownVariableCrops - it doesn't include fodder crops!
7407  double areaVariableCrop = m_variableCrops2[i].crop->m_areaPercent - m_variableCrops2[i].crop->m_rotationMin;
7408  available += areaVariableCrop;
7409  }
7410 
7411  double new_area_wbarley = area_WB;
7412  double new_area_wrape = area_WR;
7413 
7414  if(2 * area_WR <= available){ //then WBarley can get area equal to the current WRape's area; WRape's area doesn't change
7415  new_area_wbarley = area_WR;
7416  double area_to_decrease = new_area_wbarley - area_WB; // must be > 0 if this code is executed
7417  decreaseCrops(m_variableCrops2, area_to_decrease); //increased the WBarley's area, so need to cut the same amount in other crops
7418  }
7419  else{ //need to cut wrape, not just increase wbarley
7420  new_area_wrape = available/2; // these 2 crops take the whole available area
7421  new_area_wbarley = available/2;
7422  double current_wbarley_and_wrape = area_WB + area_WR; // so other crops area (variable area) = 100 - current_wbarley_and_wrape
7423  double other_crops_area = available - current_wbarley_and_wrape;
7424  if(current_wbarley_and_wrape < available){ //there are other crops - and we're now substituting them with wbarley
7425  decreaseCrops(m_variableCrops2, other_crops_area);
7426  }
7427  //else nothing
7428  }
7429 
7430  //check how much winter crops is there now - before changes:
7431  double winter_crops=0;
7432  for(unsigned j=0; j<m_crops.size(); j++){
7433  if(m_crops[j]->m_cropType_almass == tov_WinterRape || m_crops[j]->m_cropType_almass == tov_WinterBarley ||
7434  m_crops[j]->m_cropType_almass == tov_WinterWheat || m_crops[j]->m_cropType_almass == tov_WinterRye){
7435  winter_crops += m_crops[j]->m_areaPercent;
7436  }
7437  }
7438  int winterMax = m_OurManager->pm_data->Get_winterMax(m_farmType);
7439 
7440  //now save the changes in the areas
7441  wRape->m_areaPercent = new_area_wrape;
7442  wBarley->m_areaPercent = new_area_wbarley;
7443 
7444  //check how much winter crops there is now:
7445  winter_crops=0;
7446  for(unsigned j=0; j<m_crops.size(); j++){
7447  if(m_crops[j]->m_cropType_almass == tov_WinterRape || m_crops[j]->m_cropType_almass == tov_WinterBarley ||
7448  m_crops[j]->m_cropType_almass == tov_WinterWheat || m_crops[j]->m_cropType_almass == tov_WinterRye){
7449  winter_crops += m_crops[j]->m_areaPercent;
7450  }
7451  }
7452 
7453  //need to check if the winter crops restriction is still fine:
7454  if(winter_crops > winterMax){ //problem
7455  double diff = winter_crops - winterMax;
7456  //need to make new variableCrops2 - without all winter crops!
7457  m_variableCrops2 = m_variableCrops; //initiate the new list and remove crops:
7458  for(int s=(int)m_variableCrops2.size()-1; s>=0; s--){
7459  if(m_variableCrops2[s].crop==wBarley || m_variableCrops2[s].crop==wRape || m_variableCrops2[s].crop->m_cropType_almass==tov_WinterWheat || m_variableCrops2[s].crop->m_cropType_almass == tov_WinterRye){
7460  m_variableCrops2.erase(m_variableCrops2.begin() + s);
7461  }
7462  }
7463  new_area_wrape -= diff/2;
7464  new_area_wbarley -= diff/2;
7466 
7467  //and change the areas again
7468  wRape->m_areaPercent = new_area_wrape;
7469  wBarley->m_areaPercent = new_area_wbarley;
7470  }
7471 
7472  //correct fodder. only winter barley is a fodder crop for pig farms
7473  double resp = wBarley->m_resp;
7474  double loss = wBarley->m_totalLoss;
7476  double FUKey = m_OurManager->pm_data->Get_FUKey(index);
7477  double FUha = resp * (1-loss/100) * FUKey; //[ha * hkg/ha * FU/hkg = FU]
7478  double changeFU = (new_area_wbarley - area_WB) * m_totalArea/100 * FUha; //positive
7479  m_totalFUt -= changeFU;
7480  m_totalFUgrown += changeFU;
7481  }
7482 }

References AnimalFarm::decreaseCrops(), OptimisingFarm::findCropByName_almass(), DataForOptimisation::Get_FUKey(), DataForOptimisation::Get_winterMax(), AnimalFarm::increaseCrops(), CropOptimised::m_areaPercent, OptimisingFarm::m_crops, OptimisingFarm::m_farmType, Farm::m_OurManager, CropOptimised::m_resp, OptimisingFarm::m_totalArea, OptimisingFarm::m_totalFUgrown, OptimisingFarm::m_totalFUt, CropOptimised::m_totalLoss, OptimisingFarm::m_variableCrops, OptimisingFarm::m_variableCrops2, FarmManager::pm_data, tov_Undefined, tov_WinterBarley, tov_WinterRape, tov_WinterRye, and tov_WinterWheat.

Referenced by checkRestrictions().

◆ checkRestrictions()

void OptimisingPigFarm::checkRestrictions ( )
protectedvirtual

Checks if the restrictions are fulfilled and corrects crops' areas if necessary.

Includes additionally the function dealing with the winter rape - winter barley restriction.

Reimplemented from OptimisingFarm.

Definition at line 6457 of file farm.cpp.

6457  {
6461 
6462  //restriction - grow winter barley if you have winter rape. Just in Almass crops mode when crops assignement is based on GM distribution:
6465  }
6466 
6467 }

References cfg_Areas_Based_on_Distribution, cfg_OptimiseBedriftsmodelCrops, check_WRape_WBarley(), OptimisingFarm::checkRestrictions(), and CfgBool::value().


The documentation for this class was generated from the following files:
OptimisingFarm::m_totalArea
double m_totalArea
Total area of a farm. A sum of initial crop areas (if in bedriftsmodel, i.e. original farm optimizati...
Definition: farm.h:2224
AnimalFarm::increaseCrops
virtual void increaseCrops(vector< CropSort >cropsToIncrease, double &howMuchToIncrease)
Increases area of cropsToIncrease by howMuchToIncrease.
Definition: farm.cpp:7874
tov_Undefined
Definition: tov_declaration.h:114
OptimisingFarm::checkRestrictions
virtual void checkRestrictions()
Checks if the restrictions are fulfilled and corrects crops' areas if necessary.
Definition: farm.cpp:6410
tov_WinterWheat
Definition: tov_declaration.h:55
DataForOptimisation::Get_winterMax
int Get_winterMax(int i)
Definition: farm.h:614
DataForOptimisation::Get_FUKey
double Get_FUKey(int i)
Definition: farm.h:645
CropOptimised::m_totalLoss
double m_totalLoss
Summary value of the yield loss due to the limited use of herbicides and fung- and insecticides [%].
Definition: farm.h:1683
cfg_Areas_Based_on_Distribution
CfgBool cfg_Areas_Based_on_Distribution("AREAS_BASED_ON_DISTRIBUTION", CFG_CUSTOM, false)
If set to true, crops are assigned area based on their gross margin proportion in the total GM for al...
CropOptimised
A class for storing all parameters and results of crop optimisation.
Definition: farm.h:1634
OptimisingFarm::m_totalFUgrown
double m_totalFUgrown
Fodder grown, i.e. obtained from growing fodder crops. [fodder units].
Definition: farm.h:2240
OptimisingFarm::m_crops
vector< CropOptimised * > m_crops
Vector of pointers to all crops.
Definition: farm.h:2183
tov_WinterRape
Definition: tov_declaration.h:53
CropOptimised::m_resp
double m_resp
Response - yield of a crop per ha [hkg/ha].
Definition: farm.h:1665
AnimalFarm::AnimalFarm
AnimalFarm(FarmManager *a_myfarmmanager, int a_No)
Definition: farm.cpp:5270
CropOptimised::m_areaPercent
double m_areaPercent
Area of a crop in percent of a farm's total area [%].
Definition: farm.h:1695
OptimisingFarm::m_variableCrops2
vector< CropSort > m_variableCrops2
Vector of structs containing pointers to crops which are not fixed and: in case of the winter rotatio...
Definition: farm.h:2190
Farm::m_OurManager
FarmManager * m_OurManager
Pointer to the FarmManager.
Definition: farm.h:935
tov_WinterBarley
Definition: tov_declaration.h:53
OptimisingFarm::m_variableCrops
vector< CropSort > m_variableCrops
Vector of structs containing pointers to crops which are not fixed.
Definition: farm.h:2185
OptimisingPigFarm::check_WRape_WBarley
void check_WRape_WBarley()
Checks if the restriction on winter rape and winter barley attachment is fulfilled and corrects crops...
Definition: farm.cpp:7380
FarmManager::pm_data
DataForOptimisation * pm_data
Pointer to the DataForOptimisation.
Definition: farm.h:1876
OptimisingFarm::m_farmType
TTypesOfOptFarms m_farmType
Farm's type (cattle, pig, plant, other).
Definition: farm.h:2210
tov_WinterRye
Definition: tov_declaration.h:55
OptimisingFarm::findCropByName_almass
CropOptimised * findCropByName_almass(string crop_name)
Returns a pointer to almass crop whose name is specified as the argument (ALMaSS crops mode).
Definition: farm.cpp:7770
cfg_OptimiseBedriftsmodelCrops
CfgBool cfg_OptimiseBedriftsmodelCrops("OPTIMISE_BEDRIFTSMODEL_CROPS", CFG_CUSTOM, false)
If set to true, the original farm optimisation model's crop set is used in the farmer decision making...
CfgBool::value
bool value(void)
Definition: configurator.h:135
OptimisingFarm::m_totalFUt
double m_totalFUt
Fodder from trade (has to be purchased). [fodder units].
Definition: farm.h:2238
AnimalFarm::decreaseCrops
virtual void decreaseCrops(vector< CropSort >cropsToDecrease, double &howMuchToDecrease)
Decreases area of cropsToDecrease by howMuchToDecrease.
Definition: farm.cpp:7931