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: FinancialMathFunctions.h (formerly part of funktio9.h) 00012 // 00013 // Contents: Financial mathematics functions as used by agents 00014 // 00015 // 00016 // 00017 //------------------------------------------------------------------------------ 00018 00019 00020 00021 #ifndef _FinancialMathFunctions_h 00022 #define _FinancialMathFunctions_h 00023 class MatrixDouble; 00024 00025 00026 00027 double wigefa(double i,int t); 00028 double durchverz(double i,int t); 00029 double KW(double, MatrixDouble&);//Zins (z.B. 0.05), Nettozahlungsstrom (Spaltenvektor) 00030 double zeitwert(double ask, int n_dauer, int alter, double i); 00031 double zeitwert2(double ask, int n_dauer, int alter, double ekzins, 00032 double fkzins, double v); 00033 00034 00035 //neue Datentypen, um die Uebergabe von Parametern zu vereinfachen 00036 typedef struct 00037 { double w1; 00038 double w2; 00039 } double2; 00040 00041 00042 typedef struct 00043 { int w1; 00044 int w2; 00045 } int2; 00046 00047 00048 /*//Datentyp "Bewaesserungsjahr", bestehend aus monatevielen doubles 00049 typedef struct 00050 { double monat[MONATE]; //Monatswerte 00051 } w_jahr; */ 00052 00053 //Dynamic version //neu 2003 00054 //Auxiliary class with dynamic array 00055 class w_jahr 00056 { public: 00057 double* monat; //public pointer to monthly values 00058 00059 w_jahr(int m); 00060 00061 ~w_jahr(); 00062 }; 00063 00064 /*//Datentyp "Pachtgebote", bestehend aus 2 doubles und monatevielen doubles 00065 typedef struct 00066 { double q1; //Schattenpreis Parzelle 00067 double q2; //Schattenpreis WaterRights 00068 double m[MONATE];//Monatliche Schattenpreise fr je 1 Wassereinheit 00069 } p_gebot; */ 00070 00071 00072 //Dynamic version //neu 2003 00073 //Datentyp "Pachtgebote", bestehend aus 2 doubles und monatevielen doubles 00074 class p_gebot 00075 { public: 00076 double q1; //Schattenpreis Parzelle 00077 double q2; //Schattenpreis WaterRights 00078 double* m; //Monatliche Schattenpreise fr je 1 Wassereinheit 00079 00080 p_gebot(); 00081 00082 p_gebot(int mo); 00083 00084 p_gebot(const p_gebot& w); 00085 00086 virtual ~p_gebot(); 00087 }; 00088 00089 00090 /*//Datentyp "Pachtdaten", bestehend aus typenvielen und monatevielen doubles 00091 typedef struct 00092 { double B[TYPEN]; //Preise je Typ und Hektar 00093 double W[MONATE]; //Monatliche Preise fr je 1 Wassereinheit 00094 } p_daten; */ 00095 00096 //Dynamic version //neu 2003 00097 //Datentyp "Pachtdaten", bestehend aus typenvielen und monatevielen doubles 00098 class p_daten 00099 { public: 00100 double* B; //Preise je Typ und Hektar 00101 double* W; //Monatliche Preise fr je 1 Wassereinheit 00102 00103 p_daten(); 00104 p_daten(int ty, int mo); 00105 virtual ~p_daten(); 00106 }; 00107 00108 00109 //Datentyp "WaterRights", bestehend aus 2 Arrays mit zuflu�ielen Elementen 00110 //Auxiliary class with dynamic array //neu 2003 00111 class w_rechte 00112 { public: 00113 int* zuf; //Nummern der Sektorzuflsse 00114 double* watershares; //sectorale WaterRights-Anteile an diesen Zuflssen 00115 00116 w_rechte(); 00117 w_rechte(int zanz); 00118 w_rechte(const w_rechte& w); 00119 virtual ~w_rechte(); 00120 }; 00121 00122 00123 00124 #ifdef LP_OLD 00125 00126 //neu 2003 Dynamic version of typedef struct l_vector 00127 typedef struct 00128 { double* umf; //Pointer to 'Produktionsumfaenge' 00129 double* zrow; //Pointer to 'Zielfunktionskoeffizienten' 00130 double ziel; //Zielwert (Gesamt-Deckungsbeitrag) 00131 } l_vektor; 00132 00133 00134 struct mat // Charakteristika der LP-MatrixDouble 00135 { public: 00136 int lpanzahl; 00137 int lpfehler; 00138 int lpkritisch; 00139 int m1;//Anzahl der Restriktionen LE 00140 int m2;//Anzahl der Restriktionen GE 00141 int m3;//Anzahl der Restriktionen E 00142 }; 00143 #endif 00144 00145 00146 //Datentyp "Nutzerinformation" 00147 typedef struct 00148 { int nr; //Betriebsnr. des Nutzers (bzw. -1, wenn kein Nutzer) 00149 double ha; //genutzte Fl�he 00150 double db; //Deckungsbeitrag 00151 double ws; //Wertschpfung 00152 } nutz; 00153 00154 //double floor(double val); 00155 //double ceil(double val); 00156 00157 #endif 00158