Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

PermanentCropsHandler.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 //
00003 //  Thomas Berger (main author), Pepijn Schreinemachers, and Thorsten Arnold
00004 //
00005 //
00006 //  Hohenheim University (490d)
00007 //  Professorship for Land Use Economics in the Tropics and Subtropics
00008 //
00009 //  May not be distributed without permission by main author
00010 //
00011 //  File:       PermanentCropsHandler.h (formerly cultivo9.h)
00012 //
00013 //  Contents:   Manages perennial crop data such as life tables and computes
00014 //              related coefficients such as expected remaining fruit production
00015 //              per hectare
00016 //
00017 //------------------------------------------------------------------------------
00018 
00019 
00020 //Klasse fuer Dauerkulturen
00021 
00022 #ifndef _PermanentCropsHandler_h
00023 #define _PermanentCropsHandler_h
00024 
00025 #include "BasicEnums.h"
00026 #include "MatrixDouble.h"
00027 
00028 
00030 typedef struct
00031 {  int code;//object ID
00032    double purPrice;//purchase price
00033         int lifeSp;//lifespan
00034         MatrixDouble anbaudaten;//yearly factor demands
00035         MatrixDouble originalData;//original input data
00036 } dauerkultur;
00037 
00038 //---------------------------------------------------------------
00039 
00041 class PermCropCultivationPractices
00042 {       public:
00043 
00045 
00046 
00047         virtual int getNumManagementGroups();
00048 
00050         virtual void putPermCropIntoManagementGroup(int objID, int groupIdx);
00051 
00053         virtual int getGroupIdxForObject(int objID);
00054 
00056    virtual int getObjectIDsOfOthersInGroup(int objID, MatrixDouble& otherObjIDs);
00057 
00059         virtual int getLpColumnForSwitchingObjects(int objID, int switchObjID);
00060 
00062         virtual void readFromOpenStream(FILE* strm);
00063 
00065         virtual void writeToOpenStream(FILE* strm);
00066 
00068    virtual void deallocate();   
00070         
00072    PermCropCultivationPractices(int numGroups);
00073         
00075    virtual ~PermCropCultivationPractices()
00076         {       deallocate();
00077         }
00078 
00079         protected:
00081 
00082 
00083    int numManagementGroups;     
00084 
00086    MatrixDouble* objectIDsInGroup;      
00087 
00089         MatrixDouble* lpColumnsInGroup;
00091 };
00092 
00093 //---------------------------------------------------------------
00094 
00095 class cultivo
00096 {  protected:
00097         FILE* datenstrom;
00098         int cul_anzahl;//Anzahl der Dauerkulturen
00099         int numLaborConstraints;
00100         int numMachineryConstraints;
00101 
00102         //auxiliary data structure for switching of cultiviatin practices
00103         PermCropCultivationPractices* switchManagementInfo;
00104 
00105         public:
00106         cultivo(void)
00107         {  datenstrom = NULL;
00108                 cul_anzahl = 0;
00109                 numLaborConstraints = 0;
00110                 numMachineryConstraints = 0;
00111                 switchManagementInfo = NULL;
00112         }
00113 
00114    virtual ~cultivo()
00115         {       speicher_freigeben();
00116         }
00117 
00118    dauerkultur* d_kultur; //dynamisch allokiertes Array von Dauerkulturen
00119    virtual void readInputFromFile(const char* fileName);
00120    virtual void writeInputInFile(char* fileName);
00121 
00122         virtual void updateProductionCosts(MatrixDouble& lpIndicesAndRelativeCosts);
00123         virtual int getSwitchingCultivationOtherIDs(int objID, MatrixDouble& otherObjIDs);
00124         virtual int getSwitchingCultivationLpColumn(int objID, int switchObjID);
00125         
00126         virtual int getPermanentCropID(int objectID);
00127    virtual int checkIfObjectIsPermamentCrop(int objectID);
00128         virtual int getNumLaborConstraints();
00129         virtual int getNumMachineryConstraints();
00130 
00132         virtual double getFutureCropYields(int permCropID, int age, double rate);
00133         virtual double getFutureVariableCosts(int permCropID, int age, double rate);
00134         virtual double getFuturePreHarvestCosts(int permCropID, int age, double rate);
00135         virtual double getFutureHarvestCosts(int permCropID, int age, double rate);
00136 
00137         //virtual double get_durchs_AK(int objID, int age);//substitute ##
00138         //virtual double get_durchs_M4(int objID, int age);//substitute ##
00139         //virtual double get_durchs_M1(int objID, int age);//substitute ##
00140         //virtual double get_durchs_P1(int objID, int age);//substitute ##
00141         //virtual double get_durchs_P2(int objID, int age);//substitute ##
00142         virtual double getFutureLaborDemand(int permCropID, int age, double rate, int level);
00143         virtual double getFutureMachineryDemand(int permCropID, int age, double rate, int level);
00144 
00145         virtual double getCropYieldInYear(int permCropID, int age);
00146         virtual double getVariableCostsInYear(int permCropID, int age);
00147         virtual double getPreHarvestCostsInYear(int permCropID, int age);
00148         virtual double getHarvestCostsInYear(int permCropID, int age);
00149 
00150         //virtual double get_AK_bedarf(int objID, int age);//subsitute ##
00151         //virtual double get_M4_bedarf(int objID, int age);//subsitute ##
00152         //virtual double get_M1_bedarf(int objID, int age);//subsitute ##
00153         //virtual double get_P1_bedarf(int objID, int age);//subsitute ##
00154         //virtual double get_P2_bedarf(int objID, int age);//subsitute ##
00155         virtual double getLaborDemandInLevel(int permCropID, int age, int level);
00156         virtual double getMachineryDemandInLevel(int permCropID, int age, int level);
00157 
00158 
00159         virtual void printToScreen(void);
00160         virtual void speicher_freigeben(void);
00161 };
00162 
00163 
00164 #endif
00165 

Generated on Thu Aug 28 12:38:45 2008 for MPMAS by  doxygen 1.3.9.1