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

PopulationCluster.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:       PopulationCluster.h (formerly cluster.h)
00012 //
00013 //  Contents:   Population cluster class, containing the information for
00014 //              Monte Carlo assignment of assets
00015 //
00016 //
00017 //------------------------------------------------------------------------------
00018 
00019 
00020 
00021 #ifndef _PopulationCluster_h
00022 #define _PopulationCluster_h
00023 
00024 
00025 #include "AgentFarmHousehold.h"
00026 #include "PopulationNetworkSegment.h"
00027 #include "MatrixDouble.h"
00028 
00029 typedef struct
00030 {  int career; //career path (i.e. object ID)
00031    int sex;
00032    int ageLow;
00033    int ageUpp;
00034 } sexAgeGroup;
00035 
00036 
00037 class cluster
00038 {  protected:
00039    int popID;        //Population ID
00040    int cluID;        //Cluster ID
00041    int cluNumAg;     //Number of agents in cluster
00042    int actNumAg;     //Number of actually generated agents
00043 
00044    int numGroups;    //number of sex age groups in cluster
00045    sexAgeGroup* SAgroups;//pointer to sex and age groups
00046    MatrixDouble SAlotto;   //Matrix for random assignment of household members
00047    MatrixDouble lotto;     //info for random assignments of investment goods
00048    int startC;       //first column containing lottery information
00049 
00050    MatrixDouble fCosts;    //Matrix of size-specific fix costs ("Gemeinkosten")
00051 
00052    MatrixDouble distrib;   //Matrix containing results of random data generation
00053    int addInfoR;     //additional rows in MatrixDouble
00054    int addInfoC;     //additional rows in MatrixDouble
00055    int lastRow;      //last row entry in 'distrib'
00056 
00057    char filename[MXLENGTH];//Inputfile
00058    FILE* stream;     //Datenstrom
00059 
00060         public:
00061         cluster(int, int, char*);//Parameter: Pop, Cluster ID, Name of inputfile
00062 
00063    /* TODO 5 -oBerger -cQuestion */
00064    //Warning from pedantic: virtual functions but not a virtual destructor, so why
00065    //did you erase virtual?
00066    
00067         //ARNOLD: virtual erased
00068         virtual ~cluster()
00069         {  lotto.deallokieren();//previously freed by c_liste::lotto_deallokieren()
00070            distrib.deallokieren();
00071       SAlotto.deallokieren();
00072       fCosts.deallokieren();
00073       delete [] SAgroups;
00074         }
00075 
00076    cluster* nextCluster;
00077    virtual void setNextPtr (cluster*);
00078    virtual cluster* getNext();
00079 
00080    virtual void readClusterInput();
00081    virtual void writeClusterInput(char*);
00082 
00083    virtual int getCluNum();
00084    virtual int getNumAgents();
00085    virtual int getActAgents();
00086    virtual void incrNumAgents();
00087    virtual void makeConsistent();
00088 
00089    //returns farm fix costs
00090    virtual double getFarmFixCosts(double totHa, double irrHa);
00091 
00092    //member functions being called from "betrieb_ausstatten()"
00093    virtual int getRowInLotto(int);
00094 
00095    //Parameters: lotto MatrixDouble, row index, column index, number of stages
00096         virtual double makeLottery(const MatrixDouble& lotto, int row, int = 0, int = STAGES);
00097 
00098         virtual void adjustAssetStructure(agentF*);//"Verm�ensstruktur"
00099         virtual void adjustVintage(agentF*, segment*, int, int, double, int,
00100                                  double, double);
00101    virtual void adjustAsynchr(agentF*, segment*, double);
00102 
00103    virtual void deallocateLotto();
00104         virtual void printToScreen();
00105    virtual void writeLottoInFile(char*);
00106 };
00107 
00108 
00109 #endif
00110 

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