From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../Aufgabenblatt2/Aufgabe2und3/.cproject | 942 ++++++++++++++++++++ .../Aufgabenblatt2/Aufgabe2und3/.project | 70 ++ .../Aufgabenblatt2/Aufgabe2und3/VaR.plt | 25 + .../Aufgabe2und3/src/CholeskyDecomposition.cpp | 100 +++ .../Aufgabe2und3/src/CholeskyDecomposition.h | 40 + .../Aufgabe2und3/src/HistoricSimulation.cpp | 82 ++ .../Aufgabe2und3/src/HistoricSimulation.h | 26 + .../Aufgabe2und3/src/MonteCarloSimulation.cpp | 195 +++++ .../Aufgabe2und3/src/MonteCarloSimulation.h | 28 + .../Aufgabe2und3/src/Normaldistribution.cpp | 64 ++ .../Aufgabe2und3/src/Normaldistribution.h | 24 + .../Aufgabe2und3/src/Parametrisation.cpp | 299 +++++++ .../Aufgabe2und3/src/Parametrisation.h | 160 ++++ .../Aufgabenblatt2/Aufgabe2und3/src/main.cpp | 35 + .../Aufgabenblatt2/DiceSim/.cproject | 946 +++++++++++++++++++++ .../Aufgabenblatt2/DiceSim/.project | 82 ++ .../Aufgabenblatt2/DiceSim/dicesim.plt | 12 + .../Aufgabenblatt2/DiceSim/src/DiceSim.cpp | 47 + .../Aufgabenblatt2/DiceSim/src/DiceSim.h | 29 + .../DiceSim/src/DiceSimController.cpp | 127 +++ .../Aufgabenblatt2/DiceSim/src/DiceSimController.h | 49 ++ .../Aufgabenblatt2/DiceSim/src/Util.h | 78 ++ .../Aufgabenblatt2/DiceSim/src/main.cpp | 23 + .../Aufgabenblatt2/DiceSim/ui/dicesim.glade | 131 +++ .../Aufgabenblatt2/Kurse_110418.csv | 6 + .../Aufgabenblatt2/Kurse_110418_lsg.csv | 15 + .../Aufgabenblatt2/Kurse_110503.csv | 6 + .../Aufgabenblatt2/Kurse_110503_lsg.csv | 15 + .../Aufgabenblatt2/Kurse_SS11.csv | 261 ++++++ .../Aufgabenblatt2/MuS_Aufgabenblatt_2_SS_11.pdf | Bin 0 -> 63606 bytes .../Aufgabenblatt2/mus-eisenhauer-abgabe2.zip | Bin 0 -> 24569 bytes 31 files changed, 3917 insertions(+) create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.cproject create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.project create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/VaR.plt create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/main.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.cproject create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.project create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/dicesim.plt create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSim.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSim.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/Util.h create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/main.cpp create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/ui/dicesim.glade create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418.csv create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418_lsg.csv create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503.csv create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503_lsg.csv create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_SS11.csv create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/MuS_Aufgabenblatt_2_SS_11.pdf create mode 100644 Master/Modellbildung_und_Simulation/Aufgabenblatt2/mus-eisenhauer-abgabe2.zip (limited to 'Master/Modellbildung_und_Simulation/Aufgabenblatt2') diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.cproject b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.cproject new file mode 100644 index 0000000..f191819 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.cproject @@ -0,0 +1,942 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.project b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.project new file mode 100644 index 0000000..33315d3 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/.project @@ -0,0 +1,70 @@ + + + Aufgabe2und3 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/Aufgabe2und3/Debug} + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/VaR.plt b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/VaR.plt new file mode 100644 index 0000000..5d9213f --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/VaR.plt @@ -0,0 +1,25 @@ +set terminal wxt +set terminal wxt font "/Library/Fonts/Sans Serif, 11" +set multiplot +set size 1.0,0.5 +set datafile separator ";" +set xlabel "index" +set ylabel "EUR" +set origin 0.0,0.0 +plot "VaR.csv" using 1:2 title "one day" with steps +set origin 0.0,0.5 +plot "VaR.csv" using 1:3 lt 3 title "ten days" with steps +unset multiplot + +set output "VaR.png" +set terminal png font "/Library/Fonts/Sans Serif, 11" +set multiplot +set size 1.0,0.5 +set datafile separator ";" +set xlabel "index" +set ylabel "EUR" +set origin 0.0,0.0 +plot "VaR.csv" using 1:2 title "one day" with steps +set origin 0.0,0.5 +plot "VaR.csv" using 1:3 lt 3 title "ten days" with steps +replot diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.cpp new file mode 100644 index 0000000..f74c99c --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.cpp @@ -0,0 +1,100 @@ +/* + * CholeskyDecomposition.cpp + * + * Created on: 20.05.2011 + * Author: sven + */ +#ifndef PARAMETRISATION_H_ + #include "Parametrisation.h" +#endif + +#include +#include +#include + +#include "CholeskyDecomposition.h" + +CholeskyDecomposition::CholeskyDecomposition() +{ + for (UInt32 c = nenDaimler; c < nenEndOfCompanies ; c++) + { + mCholeskyMatrixOneDay.push_back(std::vector(nenEndOfCompanies)); + mCholeskyMatrixTenDays.push_back(std::vector(nenEndOfCompanies)); + } +} + +CholeskyDecomposition::~CholeskyDecomposition() { +} + +void CholeskyDecomposition::dumpCholeskyMatrices() +{ + std::cout << "Cholesky Matrix for one day" << std::endl; + int width = 12; + int prec = 6; + for(UInt32 i = 0; i < nenEndOfCompanies ; i++) + { + for (UInt32 j = 0; j < nenEndOfCompanies ; j++) + { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCholeskyMatrixOneDay.at(i).at(j); + } + std::cout << std::endl; + } + std::cout << "Cholesky Matrix for ten days" << std::endl; + for(UInt32 i = 0; i < nenEndOfCompanies ; i++) + { + for (UInt32 j = 0; j < nenEndOfCompanies ; j++) + { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCholeskyMatrixTenDays.at(i).at(j); + } + std::cout << std::endl; + } +} + +void CholeskyDecomposition::calcCholeskyMatrix(CholeskyMatrix& d, const CovarianceMatrix& b) +{ + double sum,dp,diff; + for(int i = 0; i < nenEndOfCompanies ; i++) + { + for (int j = 0; j < nenEndOfCompanies ; j++) + { + if ( i < j) + { + d.at(i).at(j) = 0.0; + } + else if (i == j) + { + sum = 0.0; + int k=0; + while ( k < (i-1) ) + { + dp = d.at(i).at(k); + sum += dp*dp; + k++; + } + diff = b.at(i).at(i) - sum; + d.at(i).at(j) = std::sqrt(diff); + } + else if (i > j) + { + sum = 0.0; + int k=0; + while (k < (i-1) ) + { + sum += d.at(i).at(k) * d.at(j).at(k); + k++; + } + diff = b.at(i).at(j) - sum; + d.at(i).at(j) = (1.0 / d.at(j).at(j) ) * diff; + } + } + } +} + +void CholeskyDecomposition::calcCholeskyDecompostions(const Parametrisation& params) +{ + calcCholeskyMatrix(mCholeskyMatrixOneDay,params.getCovarianceMatrix(nenOneDay)); + calcCholeskyMatrix(mCholeskyMatrixTenDays,params.getCovarianceMatrix(nenTenDays)); + dumpCholeskyMatrices(); +} + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.h new file mode 100644 index 0000000..b7bdb6c --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/CholeskyDecomposition.h @@ -0,0 +1,40 @@ +/* + * CholeskyDecomposition.h + * + * Created on: 20.05.2011 + * Author: sven + */ + +#ifndef CHOLESKYDECOMPOSITION_H_ +#define CHOLESKYDECOMPOSITION_H_ + +#include + +typedef unsigned int UInt32; +typedef std::vector< std::vector > CholeskyMatrix; + +class CholeskyDecomposition { +public: + CholeskyDecomposition(); + virtual ~CholeskyDecomposition(); + void calcCholeskyDecompostions(const Parametrisation& params); + const CholeskyMatrix& getMatrix(const enHoldingTime& holdingTime) const + { + switch(holdingTime) + { + case nenOneDay: + return mCholeskyMatrixOneDay; + case nenTenDays: + return mCholeskyMatrixTenDays; + default: + throw 17; + } + } +private: + CholeskyMatrix mCholeskyMatrixOneDay; + CholeskyMatrix mCholeskyMatrixTenDays; + void dumpCholeskyMatrices(); + void calcCholeskyMatrix(CholeskyMatrix& d, const CovarianceMatrix& b); +}; + +#endif /* CHOLESKYDECOMPOSITION_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.cpp new file mode 100644 index 0000000..412eac1 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.cpp @@ -0,0 +1,82 @@ +/* + * HistoricSimulation.cpp + * + * Created on: 27.05.2011 + * Author: eisenhauer + */ + +#include "HistoricSimulation.h" +#include +#include +#include +#include + +const double PORTFOLIO[] = {200000.0,150000.0,250000.0,300000.0,200000.0}; + +HistoricSimulation::HistoricSimulation() +{ +} + +HistoricSimulation::~HistoricSimulation() { +} + +void HistoricSimulation::doSimulation(const Parametrisation& param, const enHoldingTime& nenHoldingTime) +{ + const std::vector& stockPrices = param.getStockPrices(); + uint8_t u8HoldingTime = static_cast(nenHoldingTime); + uint32_t N = stockPrices.size() - u8HoldingTime; + uint32_t n = 0; + mData.clear(); + std::vector portfolio(static_cast(nenEndOfCompanies)); + double portfolioValue = 0.0; + + for (uint8_t c=0; c < nenEndOfCompanies; c++) + { + mData.push_back(std::vector(N)); + portfolio.at(c) = param.getLastValue(static_cast(c) ) * PORTFOLIO[c]; + portfolioValue += portfolio.at(c); + } + + for(uint32_t counter = u8HoldingTime; counter < stockPrices.size() ; counter++) + { + for (uint8_t c=0; c < nenEndOfCompanies; c++) + { + double compRelChange = 0.0; + switch(nenHoldingTime) + { + case nenOneDay: + compRelChange = stockPrices.at(counter).mStock.at(c).mValueRelChangeOne; + break; + case nenTenDays: + compRelChange = stockPrices.at(counter).mStock.at(c).mValueRelChangeTen; + break; + } + double actCompValue = portfolio.at(c) + (portfolio.at(c) * compRelChange / 100); + mData.at(c).at(n) = actCompValue; + } + n++; + } + + std::vector simulatedPortfolioValues(N); + for (n = 0; n < N; n++) { + double sum = 0.0; + for (uint8_t c=0; c < nenEndOfCompanies; c++) + { + sum += mData.at(c).at(n); + } + simulatedPortfolioValues.at(n) = sum; + } + std::vector simulatedPortfolioChanges(N); + for (n = 0; n < N; n++) { + simulatedPortfolioChanges.at(n) = portfolioValue - simulatedPortfolioValues.at(n); + } + std::sort(simulatedPortfolioChanges.begin(),simulatedPortfolioChanges.end()); + uint32_t quantilIdx = (N / 100) - 1; + double VaR = simulatedPortfolioChanges.at(quantilIdx); + std::string strHoldTime = (nenHoldingTime==nenOneDay)?"one day: ":"ten days: "; + std::cout << "Historic simulation VaR for " + strHoldTime << VaR << " EUR" << std::endl; +// printf("%u\n",quantilIdx); +// for (n = 0; n < N; n++) { +// std::cout << simulatedPortfolioChanges.at(n) << std::endl; +// } +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.h new file mode 100644 index 0000000..ac71c3f --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/HistoricSimulation.h @@ -0,0 +1,26 @@ +/* + * HistoricSimulation.h + * + * Created on: 27.05.2011 + * Author: eisenhauer + */ + +#ifndef HISTORICSIMULATION_H_ +#define HISTORICSIMULATION_H_ + +#include "Parametrisation.h" +#include + +typedef unsigned char uint8_t; +typedef unsigned uint32_t; + +class HistoricSimulation { +public: + HistoricSimulation(); + virtual ~HistoricSimulation(); + void doSimulation(const Parametrisation& param, const enHoldingTime& nenHoldingTime); +private: + std::vector< std::vector > mData; +}; + +#endif /* HISTORICSIMULATION_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.cpp new file mode 100644 index 0000000..3ca5beb --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.cpp @@ -0,0 +1,195 @@ +/* + * MonteCarloSimulation.cpp + * + * Created on: 20.05.2011 + * Author: sven + */ + +#include "Normaldistribution.h" +#include "MonteCarloSimulation.h" +#include +#include +#include +#include +#include + +static const unsigned NUMBER_OF_SIMULATIONS = 10000; + +const double PORTFOLIO[] = {200000.0,150000.0,250000.0,300000.0,200000.0}; + +MonteCarloSimulation::MonteCarloSimulation() +{ + for (unsigned i=0; i(nenEndOfCompanies)); + mTenDaySimulatedCourseChanges.push_back(std::vector(nenEndOfCompanies)); + } +} + +MonteCarloSimulation::~MonteCarloSimulation() { +} + +void MonteCarloSimulation::doSimulations(const Parametrisation& param, const CholeskyDecomposition& cholDecomp) +{ + std::vector y(nenEndOfCompanies); + std::vector mu(nenEndOfCompanies); + Normaldistribution norm; + + for (int i=0; i<2; i++) { + enHoldingTime d = (i==0)?nenOneDay:nenTenDays; + const CholeskyMatrix& D = cholDecomp.getMatrix(d); + param.getArithAverages(mu,d); + for (unsigned i=0; i< NUMBER_OF_SIMULATIONS; i++) { + norm.calcRandomVector(D,mu,y); + if (d == nenOneDay) { + for (unsigned j=0; j portfolio(nenEndOfCompanies); + double portfolioValue = 0.0; + for (unsigned c=0; c < nenEndOfCompanies; c++) + { + portfolio.at(c) = param.getLastValue(static_cast(c) ) * PORTFOLIO[c]; + portfolioValue += portfolio.at(c); + } + + std::vector< std::vector > simulatedPortfolioOneDay; + std::vector< std::vector > simulatedPortfolioTenDays; + std::vector simulatedPortfolioValuesOneDay(NUMBER_OF_SIMULATIONS); + std::vector simulatedPortfolioValuesTenDays(NUMBER_OF_SIMULATIONS); + + for (unsigned i=0; i(nenEndOfCompanies)); + simulatedPortfolioTenDays.push_back(std::vector(nenEndOfCompanies)); + simulatedPortfolioValuesOneDay.at(i) = 0.0; + simulatedPortfolioValuesTenDays.at(i) = 0.0; + } + + for (unsigned i=0; i portfolioValueChangesOneDay(NUMBER_OF_SIMULATIONS); + std::vector portfolioValueChangesTenDays(NUMBER_OF_SIMULATIONS); + std::ofstream of; + of.open("VaR.csv",std::ios::out); + for (unsigned i=0; i simAverOneDay(nenEndOfCompanies); + std::vector simAverTenDays(nenEndOfCompanies); + + for (unsigned n=0; n < NUMBER_OF_SIMULATIONS ; n++) + { + for (unsigned c = 0; c < nenEndOfCompanies; c++) + { + simAverOneDay.at(c) += mOneDaySimulatedCourseChanges.at(n).at(c); + simAverTenDays.at(c) += mTenDaySimulatedCourseChanges.at(n).at(c); + } + } + for (unsigned c = 0; c < nenEndOfCompanies; c++) + { + simAverOneDay.at(c) /= NUMBER_OF_SIMULATIONS; + simAverTenDays.at(c) /= NUMBER_OF_SIMULATIONS; + } + int width = 20; + int prec = 6; + std::cout << std::setw(width) << "Comp." << std::setw(width) << "sim. one day aver." + << std::setw(width) << "sim. ten days aver." << std::endl; + for (unsigned c = 0; c < nenEndOfCompanies; c++) + { + std::cout << std::setw(width) << c << std::setw(width) << std::setprecision(prec) << simAverOneDay.at(c) + << std::setw(width) << simAverTenDays.at(c) << std::endl; + } + + // covariance matrices of simulation + CovarianceMatrix simOneDayCovMatrix; + CovarianceMatrix simTenDaysCovMatrix; + double sum,diffI,diffJ; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + simOneDayCovMatrix.push_back(std::vector(nenEndOfCompanies)); + simTenDaysCovMatrix.push_back(std::vector(nenEndOfCompanies)); + } + + //one day + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + if (i <= j) { + sum = 0.0; + for (unsigned n=0 ; n < NUMBER_OF_SIMULATIONS ; n++) { + diffI = mOneDaySimulatedCourseChanges.at(n).at(i) - simAverOneDay.at(i); + diffJ = mOneDaySimulatedCourseChanges.at(n).at(j) - simAverOneDay.at(j); + sum += (diffI * diffJ) / (NUMBER_OF_SIMULATIONS - 1); + } + simOneDayCovMatrix.at(i).at(j) = sum; + } else { + simOneDayCovMatrix.at(i).at(j) = simOneDayCovMatrix.at(j).at(i); + } + } + } + + // ten days + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + if (i <= j) { + sum = 0.0; + for (unsigned n=0 ; n < NUMBER_OF_SIMULATIONS ; n++) { + diffI = mTenDaySimulatedCourseChanges.at(n).at(i) - simAverTenDays.at(i); + diffJ = mTenDaySimulatedCourseChanges.at(n).at(j) - simAverTenDays.at(j); + sum += (diffI * diffJ) / (NUMBER_OF_SIMULATIONS - 1); + } + simTenDaysCovMatrix.at(i).at(j) = sum; + } else { + simTenDaysCovMatrix.at(i).at(j) = simTenDaysCovMatrix.at(j).at(i); + } + } + } + + // dump covariance matrices + width = 12; + std::cout << "Covariance matrix for simulation for one days" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << simOneDayCovMatrix.at(i).at(j); + } + std::cout << std::endl; + } + std::cout << "Covariance matrix for simulation for ten days" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << simTenDaysCovMatrix.at(i).at(j); + } + std::cout << std::endl; + } +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.h new file mode 100644 index 0000000..7865067 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/MonteCarloSimulation.h @@ -0,0 +1,28 @@ +/* + * MonteCarloSimulation.h + * + * Created on: 20.05.2011 + * Author: sven + */ + +#ifndef MONTECARLOSIMULATION_H_ +#define MONTECARLOSIMULATION_H_ + +#include "Parametrisation.h" +#include "CholeskyDecomposition.h" + +#include + +typedef std::vector< std::vector > SimulatedCourseChanges; + +class MonteCarloSimulation { +public: + MonteCarloSimulation(); + virtual ~MonteCarloSimulation(); + void doSimulations(const Parametrisation& param, const CholeskyDecomposition& cholDecomp); +private: + SimulatedCourseChanges mOneDaySimulatedCourseChanges; + SimulatedCourseChanges mTenDaySimulatedCourseChanges; +}; + +#endif /* MONTECARLOSIMULATION_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.cpp new file mode 100644 index 0000000..5c9370b --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.cpp @@ -0,0 +1,64 @@ +/* + * Normaldistribution.cpp + * + * Created on: 20.05.2011 + * Author: sven + */ + +#include "Normaldistribution.h" +#include +#include +#include + +Normaldistribution::Normaldistribution() { +} + +Normaldistribution::~Normaldistribution() { +} + +void Normaldistribution::calcRandomVector(const CholeskyMatrix& D, const std::vector& mu , std::vector& y) +{ + std::vector u(nenEndOfCompanies); + calcStandardNormalDistributedRandomVector(nenEndOfCompanies,u); + for (int i=0;i& u) +{ + double x1,x2; + double v1,v2; + double u1,u2; + double s; + int counter = 0; + while (counter < size) + { + do + { + x1 = ((double) rand()) / (RAND_MAX + 1.0); + x2 = ((double) rand()) / (RAND_MAX + 1.0); + v1 = (2.0 * x1) - 1.0; + v2 = (2.0 * x2) - 1.0; + s = (v1*v1) + (v2*v2); + } while (s >= 1.0); + u1 = v1 * std::sqrt( - (2.0 / s) * std::log(s) ); + u2 = v2 * std::sqrt( - (2.0 / s) * std::log(s) ); + if (counter < size) { + u.at(counter) = u1; + counter++; + } + if (counter < size) { + u.at(counter) = u2; + counter++; + } + } +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.h new file mode 100644 index 0000000..5609ba3 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Normaldistribution.h @@ -0,0 +1,24 @@ +/* + * Normaldistribution.h + * + * Created on: 20.05.2011 + * Author: sven + */ + +#ifndef NORMALDISTRIBUTION_H_ +#define NORMALDISTRIBUTION_H_ + +#include "Parametrisation.h" +#include "CholeskyDecomposition.h" +#include + +class Normaldistribution { +public: + Normaldistribution(); + virtual ~Normaldistribution(); + void calcRandomVector(const CholeskyMatrix& D, const std::vector& mu , std::vector& y); +private: + void calcStandardNormalDistributedRandomVector(const int size, std::vector& u); +}; + +#endif /* NORMALDISTRIBUTION_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.cpp new file mode 100644 index 0000000..a326008 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.cpp @@ -0,0 +1,299 @@ +/* + * Parametrisation.cpp + * + * Created on: 13.05.2011 + * Author: sven + */ + +#include "Parametrisation.h" + +#include +#include +#include +#include +#include + +const char* Parametrisation::msInputFilename = "../Kurse_SS11.csv"; + +Parametrisation::Parametrisation() +:mArithAverageVectors(nenEndOfCompanies) +,mStandardDeviationsOneDay(nenEndOfCompanies) +,mStandardDeviationsTenDays(nenEndOfCompanies) +{ + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) { + mCovarinaceMatrixOneDay.push_back(std::vector(nenEndOfCompanies)); + mCovarinaceMatrixTenDays.push_back(std::vector(nenEndOfCompanies)); + mCorrelationMatrixOneDay.push_back(std::vector(nenEndOfCompanies)); + mCorrelationMatrixTenDays.push_back(std::vector(nenEndOfCompanies)); + } +} + +Parametrisation::~Parametrisation() { +} + +void Parametrisation::readCsvFile() +{ + unsigned dayCounter = 0; + std::ifstream inFile; + inFile.open(msInputFilename, std::ios::in); + char buffer[256]; + unsigned lineNum = 0; + while(inFile.getline(buffer, sizeof(buffer))) + { + lineNum++; + if (lineNum <= 3) { + continue; + } + std::string tmp(buffer); + std::vector tokens; + this->tokenize(tmp,tokens); + StockPrices prices; + prices.mDayIdx = dayCounter; + prices.mDate = tokens.at(0); + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) { + prices.mStock.at(static_cast(c)).mValue = toDouble(tokens.at(c + 1)); + } + mLastYearData.push_back(prices); + dayCounter++; + } + inFile.close(); +} +void Parametrisation::tokenize(const std::string& str, + std::vector& tokens, + const std::string& delimiters) +{ + // Skip delimiters at beginning. + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (std::string::npos != pos || std::string::npos != lastPos) + { + std::string token = str.substr(lastPos, pos - lastPos); + std::string::size_type commaPos = token.find(","); + if (commaPos != std::string::npos) + { + token.replace(commaPos,1,"."); + } + // Found a token, add it to the vector. + tokens.push_back(token); + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = str.find_first_of(delimiters, lastPos); + } +} + double Parametrisation::toDouble(const std::string& str) + { + std::istringstream ssIn(str); + double res; + ssIn >> res; + return res; + } +void Parametrisation::dumpValues() +{ + std::vector::const_iterator it; + it = mLastYearData.begin(); + for (; it != mLastYearData.end() ; it++) { + StockPrices sp = *it; + std::cout << sp.mDayIdx << ";" << sp.mDate; + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) { + std::cout << ";" << sp.mStock.at(c).mValue; + } + std::cout << std::endl; + } +} + +void Parametrisation::dumpRelChanges(const enHoldingTime& holdingTime) +{ + std::ofstream outFile; + std::ostringstream ssOut; + ssOut<(holdingTime); + for ( ; counter < days ; counter++) { + StockPrices sp = mLastYearData.at(counter); + outFile << sp.mDayIdx << ";" << sp.mDate; + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) { + switch (holdingTime) + { + case nenOneDay: + outFile << ";" << sp.mStock.at(c).mValueRelChangeOne; + break; + case nenTenDays: + outFile << ";" << sp.mStock.at(c).mValueRelChangeTen; + break; + } + + } + outFile << std::endl; + } + outFile.close(); +} + +void Parametrisation::calcRelChanges(const enHoldingTime& holdingTime) +{ + unsigned days = mLastYearData.size(); + unsigned counter = static_cast(holdingTime); + StockPrices* prev; + StockPrices* act; + for ( ; counter < days ; counter++) { + act = &(mLastYearData.at(counter)); + prev = &(mLastYearData.at(counter - static_cast(holdingTime))); + act->calcRelChanges(*prev,holdingTime); + } + dumpRelChanges(holdingTime); +} + +void Parametrisation::calcArithAverageVectors() +{ + unsigned days = mLastYearData.size(); + unsigned counter = 1; + for ( ; counter < days ; counter++) { + StockPrices sp = mLastYearData.at(counter); + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) + { + if (counter >= nenOneDay) { + mArithAverageVectors.at(c).mArithAverOneDay += sp.mStock.at(c).mValueRelChangeOne; + } + if (counter >= nenTenDays) { + mArithAverageVectors.at(c).mArithAverTenDays += sp.mStock.at(c).mValueRelChangeTen; + } + } + } + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) + { + mArithAverageVectors.at(c).mArithAverOneDay /= (days - nenOneDay - 1); + mArithAverageVectors.at(c).mArithAverTenDays /= ( days - nenTenDays - 1); + } + + // standard deviation for one day + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) + { + double sum = 0.0; + double diff = 0.0; + for (unsigned counter = nenOneDay; counter < days ; counter++) { + diff = mLastYearData.at(counter).mStock.at(c).mValueRelChangeOne - mArithAverageVectors.at(c).mArithAverOneDay; + sum += (diff * diff) / (mLastYearData.size() - nenOneDay - 1); + } + mStandardDeviationsOneDay.at(c) = std::sqrt(sum); + } + + // standard deviation for ten days + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) + { + double sum = 0.0; + double diff = 0.0; + for (unsigned counter = nenTenDays; counter < days ; counter++) { + diff = mLastYearData.at(counter).mStock.at(c).mValueRelChangeTen - mArithAverageVectors.at(c).mArithAverTenDays; + sum += (diff * diff) / (mLastYearData.size() - nenTenDays - 1); + } + mStandardDeviationsTenDays.at(c) = std::sqrt(sum); + } + dumpArithAverageVectors(); +} + +void Parametrisation::dumpArithAverageVectors() +{ + int width = 16; + int prec = 6; + std::cout << std::setw(width) << "Idx" << std::setw(width) << "one day avg" << std::setw(width) << "ten days avg" << std::endl; + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) + { + ArithAverages av = mArithAverageVectors.at(c); + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << c + << std::setw(width) << std::setprecision(prec) << std::fixed << av.mArithAverOneDay + << std::setw(width) << std::setprecision(prec) << std::fixed << av.mArithAverTenDays << std::endl; + } +} + +void Parametrisation::calcCovarianceMatrices() +{ + double diffI = 0.0; + double diffJ = 0.0; + double sum = 0.0; + + //one day + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + if (i <= j) { + sum = 0.0; + for (unsigned n=nenOneDay ; n < mLastYearData.size() ; n++) { + diffI = mLastYearData.at(n).mStock.at(i).mValueRelChangeOne - mArithAverageVectors.at(i).mArithAverOneDay; + diffJ = mLastYearData.at(n).mStock.at(j).mValueRelChangeOne - mArithAverageVectors.at(j).mArithAverOneDay; + sum += (diffI * diffJ) / (mLastYearData.size() - nenOneDay - 1); + } + mCovarinaceMatrixOneDay.at(i).at(j) = sum; + } else { + mCovarinaceMatrixOneDay.at(i).at(j) = mCovarinaceMatrixOneDay.at(j).at(i); + } + } + } + + // ten days + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + sum = 0.0; + for (unsigned n=nenTenDays ; n < mLastYearData.size() ; n++) { + diffI = mLastYearData.at(n).mStock.at(i).mValueRelChangeTen - mArithAverageVectors.at(i).mArithAverTenDays; + diffJ = mLastYearData.at(n).mStock.at(j).mValueRelChangeTen - mArithAverageVectors.at(j).mArithAverTenDays; + sum += (diffI * diffJ) / (mLastYearData.size() - nenTenDays - 1); + } + mCovarinaceMatrixTenDays.at(i).at(j) = sum; + } + } + dumpCovarianceMatrices(); +} + +void Parametrisation::dumpCovarianceMatrices() +{ + int width = 12; + int prec = 6; + std::cout << "Covariance matrix for one day" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCovarinaceMatrixOneDay.at(i).at(j); + } + std::cout << std::endl; + } + std::cout << "Covariance matrix for ten days" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCovarinaceMatrixTenDays.at(i).at(j); + } + std::cout << std::endl; + } +} + +void Parametrisation::calcCorrelationMatrices() +{ + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + mCorrelationMatrixOneDay.at(i).at(j) = mCovarinaceMatrixOneDay.at(i).at(j) / (mStandardDeviationsOneDay.at(i) * mStandardDeviationsOneDay.at(j)); + mCorrelationMatrixTenDays.at(i).at(j) = mCovarinaceMatrixTenDays.at(i).at(j) / (mStandardDeviationsTenDays.at(i) * mStandardDeviationsTenDays.at(j)); + } + } + dumpCorrelationMatrices(); +} + +void Parametrisation::dumpCorrelationMatrices() +{ + int width = 12; + int prec = 6; + std::cout << "Correlation matrix for one day" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCorrelationMatrixOneDay.at(i).at(j); + } + std::cout << std::endl; + } + std::cout << "Correlation matrix for ten days" << std::endl; + for (unsigned i = static_cast(nenDaimler) ; i < static_cast(nenEndOfCompanies); i++) { + for (unsigned j = static_cast(nenDaimler) ; j < static_cast(nenEndOfCompanies); j++) { + std::cout << std::setw(width) << std::setprecision(prec) << std::fixed << mCorrelationMatrixTenDays.at(i).at(j); + } + std::cout << std::endl; + } +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.h new file mode 100644 index 0000000..337442e --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/Parametrisation.h @@ -0,0 +1,160 @@ +/* + * Parametrisation.h + * + * Created on: 13.05.2011 + * Author: sven + */ + +#ifndef PARAMETRISATION_H_ +#define PARAMETRISATION_H_ + +#include +#include +#include + +enum enCompany +{ + nenDaimler = 0, + nenDeuBa, + nenFMC, + nenRWE, + nenSolarWorld, + + // must be last entry + nenEndOfCompanies +}; + +enum enHoldingTime +{ + nenOneDay = 1, + nenTenDays = 10 +}; + +struct Stock +{ + double mValue; + double mValueRelChangeOne; + double mValueRelChangeTen; + Stock() + :mValue(-99999999.9),mValueRelChangeOne(-99999999.9),mValueRelChangeTen(-99999999.9) + {} + void calcRelChange(const Stock& prev, const enHoldingTime& holdingTime) + { + switch (holdingTime) + { + case nenOneDay: + mValueRelChangeOne = ((mValue - prev.mValue) / prev.mValue) * 100.0; + break; + case nenTenDays: + mValueRelChangeTen = ((mValue - prev.mValue) / prev.mValue) * 100.0; + break; + default: + break; + } + + } +}; + +struct StockPrices +{ + StockPrices() + :mStock(nenEndOfCompanies) {} + std::string mDate; + unsigned mDayIdx; + std::vector mStock; + void calcRelChanges(const StockPrices& prevDay, const enHoldingTime& holdingTime) + { + for (unsigned c = static_cast(nenDaimler) ; c < static_cast(nenEndOfCompanies); c++) { + mStock.at(c).calcRelChange(prevDay.mStock.at(c), holdingTime); + } + } +}; + + +struct ArithAverages{ + double mArithAverOneDay; + double mArithAverTenDays; + ArithAverages() + :mArithAverOneDay(0.0),mArithAverTenDays(0.0) {} +}; + + +typedef std::vector< std::vector > CovarianceMatrix; +typedef CovarianceMatrix CorrelationMatrix; + + +class Parametrisation { +public: + Parametrisation(); + virtual ~Parametrisation(); + void readCsvFile(); + void calcRelChanges(const enHoldingTime& holdingTime); + void calcArithAverageVectors(); + void calcCovarianceMatrices(); + void calcCorrelationMatrices(); + + double getLastValue(const enCompany& comp) const + { + return mLastYearData.back().mStock.at(comp).mValue; + } + + const CovarianceMatrix& getCovarianceMatrix(const enHoldingTime& holdingTime) const + { + switch (holdingTime) + { + case nenOneDay: + //return mCorrelationMatrixOneDay; + return mCovarinaceMatrixOneDay; + case nenTenDays: + //return mCorrelationMatrixTenDays; + return mCovarinaceMatrixTenDays; + default: + throw 17 ; + } + } + void getArithAverages(std::vector& mu, const enHoldingTime holdingTime) const + { + unsigned c; + switch(holdingTime) + { + case nenOneDay: + for (c = nenDaimler; c < nenEndOfCompanies; c++) + { + mu.at(c) = mArithAverageVectors.at(c).mArithAverOneDay; + } + return; + case nenTenDays: + for (c = nenDaimler; c < nenEndOfCompanies; c++) + { + mu.at(c) = mArithAverageVectors.at(c).mArithAverTenDays; + } + return; + default: + throw 17; + } + } + const std::vector& getStockPrices() const + { + return mLastYearData; + } +private: + const static char* msInputFilename; + std::vector< StockPrices > mLastYearData; + std::vector mArithAverageVectors; + std::vector mStandardDeviationsOneDay; + std::vector mStandardDeviationsTenDays; + CovarianceMatrix mCovarinaceMatrixOneDay; + CovarianceMatrix mCovarinaceMatrixTenDays; + CorrelationMatrix mCorrelationMatrixOneDay; + CorrelationMatrix mCorrelationMatrixTenDays; + + void tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters = ";"); + double toDouble(const std::string& str); + void dumpValues(); + void dumpRelChanges(const enHoldingTime& holdingTime); + void dumpArithAverageVectors(); + void dumpCovarianceMatrices(); + void dumpCorrelationMatrices(); +}; + +#endif /* PARAMETRISATION_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/main.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/main.cpp new file mode 100644 index 0000000..e868108 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Aufgabe2und3/src/main.cpp @@ -0,0 +1,35 @@ +/* + * main.cpp + * + * Created on: 13.05.2011 + * Author: sven + */ + +#include "Parametrisation.h" +#include "CholeskyDecomposition.h" +#include "MonteCarloSimulation.h" +#include "HistoricSimulation.h" + +#include +#include + +int main(int argc, char* argv[]) +{ + srand(time(NULL)); + Parametrisation param; + CholeskyDecomposition cholDecomp; + param.readCsvFile(); + param.calcRelChanges(nenOneDay); + param.calcRelChanges(nenTenDays); + param.calcArithAverageVectors(); + param.calcCovarianceMatrices(); + param.calcCorrelationMatrices(); + cholDecomp.calcCholeskyDecompostions(param); + HistoricSimulation hsim; + hsim.doSimulation(param,nenOneDay); + hsim.doSimulation(param,nenTenDays); + MonteCarloSimulation sim; + sim.doSimulations(param,cholDecomp); + + return 0; +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.cproject b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.cproject new file mode 100644 index 0000000..e1f7892 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.cproject @@ -0,0 +1,946 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.project b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.project new file mode 100644 index 0000000..7738775 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/.project @@ -0,0 +1,82 @@ + + + DiceSim + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/DiceSim/Debug} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/dicesim.plt b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/dicesim.plt new file mode 100644 index 0000000..b5a01dd --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/dicesim.plt @@ -0,0 +1,12 @@ +set terminal wxt +set terminal wxt font "/Library/Fonts/Sans Serif, 11" +set datafile separator ";" +set xlabel "eyes" +plot "dicesim.csv" using 1:2 title "abs. Freq." with steps + +set output "dicesim.png" +set terminal png font "/Library/Fonts/Sans Serif, 11" +set datafile separator ";" +set xlabel "eyes" +plot "dicesim.csv" using 1:2 title "abs. Freq." with steps +replot diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSim.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSim.cpp new file mode 100644 index 0000000..fcbd64a --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSim.cpp @@ -0,0 +1,47 @@ +/* + * DiceSim.cpp + * + * Created on: 13.05.2011 + * Author: sven + */ + +#include +#include +#include + +#include "DiceSim.h" + +DiceSim::DiceSim(unsigned numDice, unsigned numRolls) +:mNumDice(numDice),mNumRolls(numRolls),mEyesAbsFreq((numDice * 6)) +{ + srand(time(NULL)); + for(mResultIter = mEyesAbsFreq.begin() ; mResultIter != mEyesAbsFreq.end() ; mResultIter++) + { + *mResultIter = 0; + } + for(unsigned n=0; n< numRolls; n++) + { + unsigned eyesSum = 0; + for(unsigned d=0; d + +class DiceSim { +public: + DiceSim(unsigned numDice, unsigned numRolls); + virtual ~DiceSim(); + const std::vector& getResult() const + { + return mEyesAbsFreq; + } +private: + unsigned mNumDice; + unsigned mNumRolls; + std::vector mEyesAbsFreq; + std::vector::iterator mResultIter; + unsigned rollDie(); +}; + +#endif /* DICESIM_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.cpp new file mode 100644 index 0000000..cd5e750 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.cpp @@ -0,0 +1,127 @@ +/* + * DiceSimController.cpp + * + * Created on: 11.05.2011 + * Author: sven + */ +#ifndef DICESIMCONTROLLER_H_ + #include "DiceSimController.h" +#endif + +#ifndef _LIBGLADEMM_XML_H + #include +#endif + +#ifndef DICESIM_H_ + #include "DiceSim.h" +#endif + +#include +#include +#include "Util.h" + +// because of static +const char* DiceSimController::UI_FILENAME = "ui/dicesim.glade"; + +DiceSimController::DiceSimController() { + Glib::RefPtr builder = Gtk::Builder::create_from_file(UI_FILENAME); + builder->get_widget("mainwindow",mPtrMainWin); + builder->get_widget("startbtn",mPtrStartBtn); + builder->get_widget("dicecombo",mPtrDiceCombo); + builder->get_widget("rollscombo",mPtrRollsCombo); + builder->get_widget("textview1",mPtrTextView); + + mRefPtrTextBuffer = Gtk::TextBuffer::create(); + mPtrTextView->set_buffer(mRefPtrTextBuffer); + + mRollsTreeStore = Gtk::TreeStore::create(mRollsCols); + mPtrRollsCombo->set_model(mRollsTreeStore); + mDiceTreeStore = Gtk::TreeStore::create(mDiceCols); + mPtrDiceCombo->set_model(mDiceTreeStore); + + Gtk::TreeModel::Row rowDice1 = *(mDiceTreeStore->append()); + rowDice1[mDiceCols.mData] = 1; + Gtk::TreeModel::Row rowDice2 = *(mDiceTreeStore->append()); + rowDice2[mDiceCols.mData] = 2; + Gtk::TreeModel::Row rowDice10 = *(mDiceTreeStore->append()); + rowDice10[mDiceCols.mData] = 10; + + Gtk::TreeModel::Row rowRolls500 = *(mRollsTreeStore->append()); + rowRolls500[mRollsCols.mData] = 500; + Gtk::TreeModel::Row rowRolls1000 = *(mRollsTreeStore->append()); + rowRolls1000[mRollsCols.mData] = 1000; + Gtk::TreeModel::Row rowRolls10000 = *(mRollsTreeStore->append()); + rowRolls10000[mRollsCols.mData] = 10000; + + mPtrDiceCombo->pack_start(mDiceCols.mData); + mPtrRollsCombo->pack_start(mRollsCols.mData); + mPtrDiceCombo->set_active(0); + mPtrRollsCombo->set_active(0); + + mPtrMainWin->signal_hide().connect(sigc::ptr_fun(&Gtk::Main::quit)); + mPtrStartBtn->signal_clicked().connect(sigc::mem_fun(this,&DiceSimController::on_startbutton_clicked)); +} + +DiceSimController::~DiceSimController() { + // TODO Auto-generated destructor stub +} + +void DiceSimController::startApp(Gtk::Main& kit) +{ + kit.run(*mPtrMainWin); +} + +void DiceSimController::on_startbutton_clicked() +{ + Gtk::TreeModel::iterator diceIter = mPtrDiceCombo->get_active(); + Gtk::TreeModel::Row diceRow = *diceIter; + Gtk::TreeModel::iterator rollsIter = mPtrRollsCombo->get_active(); + Gtk::TreeModel::Row rollsRow = *rollsIter; + unsigned numDice = diceRow[mDiceCols.mData]; + unsigned numRolls = rollsRow[mRollsCols.mData]; + std::cout << "dice: " << numDice << " rolls: " << numRolls << std::endl; + DiceSim diceSim(numDice,numRolls); + std::string text = "Eyes\tabs. freq.\n"; + const std::vector& results = diceSim.getResult(); + std::vector::const_iterator it = results.begin(); + unsigned n=numDice; + for( ; it != results.end() ; it++) + { + if (n <= 6 * numDice) { + text += Util::ToUString(n); + text += "\t"; + text += Util::ToUString(*it); + text += "\n"; + n++; + } + } + mRefPtrTextBuffer->set_text(text); + writeToCSV(results,numDice); + startGnuPlot(); +} + +void DiceSimController::writeToCSV(const std::vector& results, unsigned numDice) +{ + std::ofstream csvFile; + csvFile.open("dicesim.csv", std::ios::out); + std::vector::const_iterator it; + unsigned n=numDice; + for(it = results.begin() ; it != results.end() ; it++) { + if (n <= 6 * numDice) { + if (it != results.begin()) { + csvFile << std::endl; + } + csvFile << n << ";"; + csvFile << *it; + n++; + } + } + csvFile.close(); +} +void DiceSimController::startGnuPlot() +{ + int i = system("gnuplot dicesim.plt -p"); + if (i != 0) { + std::cerr << "Error starting gnuplot: " << i << std::endl; + } +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.h new file mode 100644 index 0000000..3c39e30 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/DiceSimController.h @@ -0,0 +1,49 @@ +/* + * DiceSimController.h + * + * Created on: 11.05.2011 + * Author: sven + */ + +#ifndef DICESIMCONTROLLER_H_ +#define DICESIMCONTROLLER_H_ + +#ifndef _GTKMM_H + #include +#endif + +class DiceSimController { +public: + DiceSimController(); + virtual ~DiceSimController(); + void startApp(Gtk::Main& kit); +private: + + class Columns : public Gtk::TreeModel::ColumnRecord { + public: + Columns() { + add(mData); + } + + ~Columns() {} + + Gtk::TreeModelColumn mData; + }; + static const char* UI_FILENAME; + Gtk::Window* mPtrMainWin; + Gtk::Button* mPtrStartBtn; + Gtk::ComboBox* mPtrDiceCombo; + Gtk::ComboBox* mPtrRollsCombo; + Glib::RefPtr mDiceTreeStore; + Glib::RefPtr mRollsTreeStore; + Gtk::TextView* mPtrTextView; + Glib::RefPtr mRefPtrTextBuffer; + Columns mDiceCols; + Columns mRollsCols; + + void on_startbutton_clicked(); + void writeToCSV(const std::vector& results, unsigned numDice); + void startGnuPlot(); +}; + +#endif /* DICESIMCONTROLLER_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/Util.h b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/Util.h new file mode 100644 index 0000000..3ff7d76 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/Util.h @@ -0,0 +1,78 @@ +/* + * Util.h + * + * Created on: 31.03.2011 + * Author: sven + */ + +#ifndef UTIL_H_ +#define UTIL_H_ + +#ifndef _GLIBCXX_SSTREAM + #include +#endif +#ifndef _GLIBMM_USTRING_H + #include +#endif + +class Util +{ +public: + static Glib::ustring ToUString(unsigned short val) + { + std::ostringstream ssIn; + ssIn << val; + Glib::ustring res = ssIn.str(); + return res; + } + + static Glib::ustring ToUString(short val) + { + std::ostringstream ssIn; + ssIn << val; + Glib::ustring res = ssIn.str(); + return res; + } + + static Glib::ustring ToUString(unsigned val) + { + std::ostringstream ssIn; + ssIn << val; + Glib::ustring res = ssIn.str(); + return res; + } + + static Glib::ustring ToUString(double val) + { + std::ostringstream ssIn; + ssIn << val; + Glib::ustring res = ssIn.str(); + return res; + } + + static unsigned short ToUShort(Glib::ustring& val) + { + std::istringstream buffer(val.raw()); + unsigned short res; + buffer >> res; + return res; + } + + static unsigned ToUint(Glib::ustring& val) + { + std::istringstream buffer(val.raw()); + unsigned res; + buffer >> res; + return res; + } + + static short ToShort(Glib::ustring& val) + { + std::istringstream buffer(val.raw()); + short res; + buffer >> res; + return res; + } +}; + +#endif /* UTIL_H_ */ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/main.cpp b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/main.cpp new file mode 100644 index 0000000..c27bcd4 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/src/main.cpp @@ -0,0 +1,23 @@ +/* + * main.cpp + * + * Created on: 11.05.2011 + * Author: sven + */ + +#ifndef DICESIMCONTROLLER_H_ + #include "DiceSimController.h" +#endif + +#ifndef _GTKMM_H + #include +#endif + +int main(int argc, char* argv[]) +{ + Gtk::Main kit(argc,argv); + DiceSimController diceSimController; + diceSimController.startApp(kit); + + return 0; +} diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/ui/dicesim.glade b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/ui/dicesim.glade new file mode 100644 index 0000000..2266cc9 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/DiceSim/ui/dicesim.glade @@ -0,0 +1,131 @@ + + + + + + False + DiceSim + + + True + True + + + True + False + + + True + False + + + True + False + no. of dice + + + True + True + 0 + + + + + + + + True + False + + + True + True + 2 + + + + + True + True + 0 + + + + + True + False + + + True + False + no of rolls + + + True + True + 0 + + + + + + + + True + False + + + True + True + 2 + + + + + True + True + 1 + + + + + start + True + True + True + False + + + True + True + 2 + + + + + False + True + + + + + True + True + automatic + automatic + + + True + True + + + + + True + True + + + + + + diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418.csv b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418.csv new file mode 100644 index 0000000..f0cb3d9 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418.csv @@ -0,0 +1,6 @@ +Schlusskurse an den Handelstagen der letzten 12 Monate (XETRA);;;;; +;;;;; +;Daimler;Deutsche Bank;Fresenius Medical Care;RWE;Solarworld +18.04.2011;48,265;40;50,68;45,49;10,69 +;;;;; +15.04.2011;49,47;41,075;50,75;46,185;11,05 diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418_lsg.csv b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418_lsg.csv new file mode 100644 index 0000000..78a4652 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110418_lsg.csv @@ -0,0 +1,15 @@ +"Schlusskurse an den Handelstagen der letzten 12 Monate (XETRA)";;;;; +;;;;; +;Daimler;"Deutsche Bank";"Fresenius Medical Care";RWE;Solarworld +2011/04/18;48,265;40;50,68;45,49;10,69 +;;;;; +2011/04/15;49,47;41,075;50,75;46,185;11,05 +;;;;; +"Veränderung [%]";-2,43581968870022;-2,61716372489349;-0,13793103448276;-1,50481758146584;-3,25791855203621 +;;;;; +;200000;150000;250000;300000;200000 +;;;;; +Portfoliowert;;;;; +15.4.;44808250;;;; +18.4;44108000;;;; +Differenz;-700250;;;; diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503.csv b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503.csv new file mode 100644 index 0000000..7e6de67 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503.csv @@ -0,0 +1,6 @@ +Schlusskurse an den Handelstagen der letzten 12 Monate (XETRA);;;;; +;;;;; +;Daimler;Deutsche Bank;Fresenius Medical Care;RWE;Solarworld +03.05.2011;51,65;43,25;51,39;44,005;10,445 +;;;;; +15.04.2011;49,47;41,075;50,75;46,185;11,05 diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503_lsg.csv b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503_lsg.csv new file mode 100644 index 0000000..9b57032 --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_110503_lsg.csv @@ -0,0 +1,15 @@ +"Schlusskurse an den Handelstagen der letzten 12 Monate (XETRA)";;;;; +;;;;; +;Daimler;"Deutsche Bank";"Fresenius Medical Care";RWE;Solarworld +2011/05/03;51,65;43,25;51,39;44,005;10,445 +;;;;; +2011/04/15;49,47;41,075;50,75;46,185;11,05 +;;;;; +"Veränderung [%]";4,40671113806347;5,29519172245891;1,26108374384237;-4,72014723395042;-5,47511312217195 +;;;;; +;200000;150000;250000;300000;200000 +;;;;; +Portfoliowert;;;;; +15.4.;44808250;;;; +3.5.;44955500;;;; +Differenz;147250;;;; diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_SS11.csv b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_SS11.csv new file mode 100644 index 0000000..1e88dca --- /dev/null +++ b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/Kurse_SS11.csv @@ -0,0 +1,261 @@ +Schlusskurse an den Handelstagen der letzten 12 Monate (XETRA);;;;; +;;;;; +;Daimler;Deutsche Bank;Fresenius Medical Care;RWE;Solarworld +19.04.2010;36,305;49,65;41,625;66,64;11,105 +20.04.2010;39;50,73;42,01;67,17;11,35 +21.04.2010;38,45;50,35;41,95;66,49;11,5 +22.04.2010;37,85;49,11;41,855;66,14;11,435 +23.04.2010;38,87;48,94;42,04;62,64;11,5 +26.04.2010;39,47;50,37;41,975;62,24;11,5 +27.04.2010;37,93;47,86;41,61;61,04;11,13 +28.04.2010;37,765;47,54;41,2;60,91;10,63 +29.04.2010;38,795;48,63;41;61,01;11,195 +30.04.2010;38,815;47,56;40,72;61,86;10,885 +03.05.2010;38,615;47,7;41,09;62,6;10,805 +04.05.2010;37,37;45,94;40,935;61,89;10,205 +05.05.2010;37,02;45,299;39,75;61,29;10,05 +06.05.2010;36,93;43,384;40,06;60,24;9,796 +07.05.2010;35,85;41,682;38,86;58,17;9,55 +10.05.2010;38,01;47,042;38,95;59,58;9,797 +11.05.2010;38,655;46,478;38,53;59,75;9,08 +12.05.2010;39,79;46,997;38,86;61,25;9,631 +13.05.2010;41,37;46,287;40,04;61,21;9,742 +14.05.2010;40,575;44,367;39,72;59,58;9,29 +17.05.2010;41,085;44,708;39,63;59,37;9,091 +18.05.2010;41,915;45,359;39,925;60,25;9,063 +19.05.2010;40,2;44,048;39,625;59,2;8,68 +20.05.2010;38,4;43,67;39,51;58,52;8,143 +21.05.2010;38,83;43,675;38,205;57,6;8,329 +24.05.2010;38,485;43,256;38,8;57,31;8,153 +25.05.2010;37,19;42,401;38,89;56,54;7,951 +26.05.2010;38,24;42,96;39,33;56,8;8,386 +27.05.2010;39,935;44,931;40,13;58,35;8,499 +28.05.2010;40,3;44,116;40,655;58,76;8,588 +31.05.2010;41;44,043;41,115;58,34;8,605 +01.06.2010;40,99;43,807;41,5;58,62;8,5 +02.06.2010;40,775;43,557;41,755;58,57;8,42 +03.06.2010;41,26;44,071;42,94;59,06;8,559 +04.06.2010;40,38;42,801;42,96;58,27;8,404 +07.06.2010;40,08;42,228;43,025;57,96;8,27 +08.06.2010;40,24;42,037;43,12;56,26;8,195 +09.06.2010;41,94;42,938;44,2;56,45;8,396 +10.06.2010;43,255;43,206;44,56;56,6;8,908 +11.06.2010;42,735;43,698;44,065;56,19;9,879 +14.06.2010;42,52;44,185;43,63;56,89;10,06 +15.06.2010;42,33;45,086;44,32;57,29;9,946 +16.06.2010;41,14;45,436;44,39;57,22;10,095 +17.06.2010;42,315;45,814;44,6;56,9;9,955 +18.06.2010;43,12;45,895;44,165;57,1;9,907 +21.06.2010;44,5;45,814;43,965;57,8;10,75 +22.06.2010;44,47;45,227;44,15;57,15;10,345 +23.06.2010;43,95;44,394;43,58;56,36;10,165 +24.06.2010;43,425;43,393;43,885;55,44;10,025 +25.06.2010;42,015;42,865;44,1;55,15;10,02 +28.06.2010;43,24;43,689;44,71;55,08;9,795 +29.06.2010;41,28;41,864;44,285;53,32;9,344 +30.06.2010;41,92;42,501;44,325;53,72;9,16 +01.07.2010;40,42;40,954;43,85;53,25;9,284 +02.07.2010;40,28;41,004;42,95;53,35;9,82 +05.07.2010;39,95;40,84;42,425;53,35;9,81 +06.07.2010;41,21;41,636;42,84;54,38;10,44 +07.07.2010;41,945;43,197;42,53;54,8;10,735 +08.07.2010;41,58;44,608;42,28;55,08;11,26 +09.07.2010;41,635;44,822;42,225;54,92;11,25 +12.07.2010;41,565;44,594;42,615;54,95;11,225 +13.07.2010;43,805;45,85;42,7;55,39;11,14 +14.07.2010;43,545;45,905;43,06;55,06;11,195 +15.07.2010;43,275;44,744;42,72;54,69;11,35 +16.07.2010;43,05;43,379;42,315;52,33;11,35 +19.07.2010;42,63;42,778;42,315;52,37;11,16 +20.07.2010;41,42;43,083;41,56;52,4;11 +21.07.2010;40,955;43,434;41,3;52,64;11,11 +22.07.2010;42,26;45,222;41,41;53,85;11,49 +23.07.2010;42,485;45,277;41,125;53,5;11,67 +26.07.2010;43,155;45,85;41,15;53,67;11,735 +27.07.2010;41,34;47,907;43,15;54,51;11,745 +28.07.2010;41,465;48,462;43,125;54,66;11,485 +29.07.2010;41,435;48,553;42,2;54,52;10,75 +30.07.2010;41,375;48,78;42,105;54,19;10,415 +02.08.2010;41,4;50,146;42,12;55,75;10,645 +03.08.2010;42;50,919;42,42;55,78;10,74 +04.08.2010;41,68;50,828;43,275;56,17;10,8 +05.08.2010;42,125;50,983;42,96;55,79;10,535 +06.08.2010;40,965;50,601;43;55,26;10,39 +09.08.2010;41,97;51,101;43,085;55,99;10,495 +10.08.2010;41,225;50,309;42,91;55,5;10,15 +11.08.2010;40,19;48,826;42,78;54,19;9,671 +12.08.2010;39,07;48,243;43,395;53,63;9,92 +13.08.2010;39,145;48,143;43,74;53,22;9,82 +16.08.2010;39,955;47,352;44,33;52,8;9,602 +17.08.2010;41,05;48,289;44,775;54,08;9,819 +18.08.2010;40,625;47,825;44,885;54,3;9,71 +19.08.2010;39,88;46,587;44,57;53,7;9,518 +20.08.2010;39,23;46,269;44,415;53,38;9,359 +23.08.2010;39,15;46,651;44,64;53,43;9,354 +24.08.2010;38,66;45,905;44,8;52,91;9,055 +25.08.2010;38,295;45,29;45,405;52,26;8,89 +26.08.2010;38,085;45,513;44,885;52,01;9,037 +27.08.2010;38,405;45,632;44,74;52,41;9,019 +30.08.2010;38,125;45,186;44,865;52,07;9,073 +31.08.2010;38,36;45,122;44,68;51,68;8,974 +01.09.2010;40,455;46,396;44,955;52,29;9,294 +02.09.2010;41;44,903;44,045;52,57;9,354 +03.09.2010;41,655;45,513;43,525;53,23;9,45 +06.09.2010;41,25;45,65;44,115;54,21;9,512 +07.09.2010;41,355;44,89;44,17;53,85;9,353 +08.09.2010;42;44,603;44,505;54,24;9,28 +09.09.2010;43,08;45,522;44,1;53,85;9,296 +10.09.2010;43,78;43,411;44,16;53,46;9,06 +13.09.2010;43,665;44,148;44,37;53,53;9,066 +14.09.2010;44,15;44,799;44,29;52,55;9,07 +15.09.2010;44,12;44,112;44;52,45;9,071 +16.09.2010;44,055;42,81;43,99;52,14;9,147 +17.09.2010;44,475;42,037;43,83;51;9,004 +20.09.2010;45,5;42,665;44,05;51,1;9,066 +21.09.2010;45,635;40,726;44,465;51,22;9,031 +22.09.2010;44,85;41,015;44,195;50,68;8,887 +23.09.2010;44,345;41,09;44,16;50,28;8,78 +24.09.2010;46,13;41,1;44,515;50,4;8,78 +27.09.2010;46,41;41,15;44,55;50,22;8,735 +28.09.2010;46,23;40,25;45,47;50,16;8,784 +29.09.2010;46,275;39,26;45,51;49,825;8,698 +30.09.2010;46,46;40,145;45,305;49,55;9,2 +01.10.2010;45,515;39,8;45,79;49,555;9,197 +04.10.2010;43,785;39,575;45,33;49,24;9,101 +05.10.2010;44,69;40,545;44,955;49,14;9,16 +06.10.2010;44,24;41,15;44,355;49,135;9,34 +07.10.2010;45,37;40,985;44,465;49,39;9,454 +08.10.2010;45,435;40,65;45,135;48,8;9,375 +11.10.2010;45,925;40,44;44,975;49,025;9,469 +12.10.2010;47,425;40,065;45,1;48;9,361 +13.10.2010;47,935;41,65;45,15;48,575;9,613 +14.10.2010;47,4;41,31;45,385;49,025;10,145 +15.10.2010;47,725;40,8;45,45;49,61;10,07 +18.10.2010;47,775;41,45;45,545;50,25;10,055 +19.10.2010;47,04;42,2;45,48;50,16;9,935 +20.10.2010;47,8;42,365;45,08;50,15;9,974 +21.10.2010;49,03;42,165;44,835;50,54;9,878 +22.10.2010;49,305;42,095;45,29;50,33;9,876 +25.10.2010;49,7;41,86;45,1;50,41;10,155 +26.10.2010;48,74;41,19;45,35;50,47;10,26 +27.10.2010;47,62;41,585;45,505;50,75;10,425 +28.10.2010;46,98;41,585;45,68;51,2;10,725 +29.10.2010;47,43;41,42;45,77;51,5;10,42 +01.11.2010;47,655;40,98;45,65;51,22;10,15 +02.11.2010;48,41;41,07;45,27;51,49;10,15 +03.11.2010;48,34;40,46;44,96;51,1;9,96 +04.11.2010;50;41,385;43,82;51,51;10 +05.11.2010;48,94;41,725;43,735;51,29;9,838 +08.11.2010;48,935;41,845;43,995;50,62;9,775 +09.11.2010;50,04;41,91;43,74;50,44;10 +10.11.2010;49,175;40,96;44,79;51;9,578 +11.11.2010;49,56;40,32;44,515;50,25;8,9 +12.11.2010;49,88;40,42;44,565;49,9;8,648 +15.11.2010;50,89;40,75;44,45;49,8;8,483 +16.11.2010;49,47;40,15;44,2;49,35;8,197 +17.11.2010;49,27;40,62;43,8;49,525;8,169 +18.11.2010;50,81;41,095;44,41;50,07;8,489 +19.11.2010;50,74;40,43;44,14;49,78;8,377 +22.11.2010;50,56;39,865;43,45;49,56;8,18 +23.11.2010;49,515;38,945;43,325;48,68;8,071 +24.11.2010;52,04;38,905;43,945;48,79;8,025 +25.11.2010;51,93;38,915;44,335;49,035;8,1 +26.11.2010;51,54;38,27;44,905;48,9;8,059 +29.11.2010;49,79;37,12;44,13;48,09;7,558 +30.11.2010;49,87;36,595;44,47;47,96;7,004 +01.12.2010;51,94;37,67;45,375;48,68;7,099 +02.12.2010;53,49;38,72;45,78;48,69;7,132 +03.12.2010;53,95;38,89;45,115;48,56;7,353 +06.12.2010;53,62;38,275;44,845;48,285;7,313 +07.12.2010;54,15;38,19;44,415;48,4;7,383 +08.12.2010;53,26;38,56;44,52;48,475;7,45 +09.12.2010;53,3;39,4;44,38;49,415;7,957 +10.12.2010;54,87;39,795;44,325;49,37;8,021 +13.12.2010;54,76;40,06;44,12;49,73;8,061 +14.12.2010;54,11;40,165;44,3;50,01;7,875 +15.12.2010;53,9;39,485;43,895;49,47;7,47 +16.12.2010;54,41;39,695;43,56;49,59;7,28 +17.12.2010;53,68;39,8;43,06;49,01;7,119 +20.12.2010;53,88;39,42;43,01;49,4;7,3 +21.12.2010;54,66;39,63;43,39;49,62;7,53 +22.12.2010;54,33;39,42;43,285;49,8;7,561 +23.12.2010;54,07;39,53;43,51;49,815;7,565 +27.12.2010;51,57;39,265;43,565;49,6;7,4 +28.12.2010;51,5;39,435;43,65;49,975;7,344 +29.12.2010;51,32;39,435;43,45;50,15;7,365 +30.12.2010;50,73;39,1;43,23;49,89;7,465 +03.01.2011;51,71;39,56;43,035;50,4;7,47 +04.01.2011;51,99;40,5;42,855;50,98;7,45 +05.01.2011;53,6;41,56;42,575;51,47;7,336 +06.01.2011;54,6;41,68;43,505;51,42;7,4 +07.01.2011;54,53;41,01;43,44;50,96;7,29 +10.01.2011;53,91;40,29;43,12;50,27;7,04 +11.01.2011;54,97;40,485;42,86;50,56;7,16 +12.01.2011;54,88;42,24;43,26;51,87;7,304 +13.01.2011;54,97;42,85;43,01;52,98;7,23 +14.01.2011;55,95;43,26;42,81;53,27;7,235 +17.01.2011;56,89;42,965;42,475;52,96;7,25 +18.01.2011;58,46;43,49;42,045;53,69;7,82 +19.01.2011;57,08;43,5;41,905;53,33;7,838 +20.01.2011;55,37;43,54;41,905;54,88;7,676 +21.01.2011;54,78;44,275;41,125;55,26;7,922 +24.01.2011;54,52;44,33;41,105;54,74;7,792 +25.01.2011;55,21;43,635;42,085;53,66;7,844 +26.01.2011;56,27;43,275;42,06;53,01;7,8 +27.01.2011;55,9;43,6;42,345;53,01;7,651 +28.01.2011;54,8;43,63;42,8;52,64;7,376 +31.01.2011;53,42;43,17;42,735;52,61;7,207 +01.02.2011;53,3;43,88;43,43;53,55;7,471 +02.02.2011;52,5;44,42;43,9;53,68;7,613 +03.02.2011;53,01;45,1;44,375;53,73;7,643 +04.02.2011;52,69;46,235;44,645;53,43;7,82 +07.02.2011;53,62;46,82;44,785;53,4;8,34 +08.02.2011;55,28;47,055;44,9;53,09;8,56 +09.02.2011;55,03;46,83;45,54;53,2;8,444 +10.02.2011;55,48;46,01;46,25;53,5;8,274 +11.02.2011;56,51;46,17;45,9;53,47;8,332 +14.02.2011;56,57;45,77;46,785;53,15;8,726 +15.02.2011;55,98;46,9;47,775;52,86;8,789 +16.02.2011;53,54;48,54;47,48;52,05;8,988 +17.02.2011;52,97;47,855;47,66;52,22;9,071 +18.02.2011;52,63;47,93;47,225;52,56;9,5 +21.02.2011;52,22;46,39;47,02;52,25;8,93 +22.02.2011;53,05;46,515;47,475;52,5;9,15 +23.02.2011;51,29;46,09;47,15;52,09;8,91 +24.02.2011;50,49;45,82;47,305;49,39;8,852 +25.02.2011;51,07;46,585;47,7;49,22;8,904 +28.02.2011;51,05;46,58;47,975;48,91;8,71 +01.03.2011;51,02;45,815;48,32;48,24;8,55 +02.03.2011;49,6;45,95;48,665;47,99;8,268 +03.03.2011;49,18;45,87;48,715;48,14;8,415 +04.03.2011;48,235;44,885;49,46;47,81;8,389 +07.03.2011;48,595;44,54;49,175;47,62;8,307 +08.03.2011;49,25;44,6;48,83;47,78;8,452 +09.03.2011;49,82;43,715;49,28;47,51;8,365 +10.03.2011;48,705;43,265;48,84;47,67;7,939 +11.03.2011;47,79;42,73;48,46;47,925;7,636 +14.03.2011;47,175;42,625;48,24;45,64;8,629 +15.03.2011;45,28;41,025;46,45;43,995;10,635 +16.03.2011;44,375;40,2;46,5;42,855;10,275 +17.03.2011;44,875;40,78;46,23;43,76;10,56 +18.03.2011;45,9;40,41;45,665;43,5;10,06 +21.03.2011;46,86;41,19;45,82;43,82;10,385 +22.03.2011;46,465;41,125;46,515;43,73;9,894 +23.03.2011;47,35;40,91;46,9;43,91;10,3 +24.03.2011;49,015;41,565;47,645;44,36;10,3 +25.03.2011;48,995;41,37;47,79;44,69;10,335 +28.03.2011;48,27;41,625;47,57;44,71;11,2 +29.03.2011;48,35;41,445;47,4;44,475;11,32 +30.03.2011;49,835;41,945;47,72;45,235;11,21 +31.03.2011;49,85;41,485;47,39;44,945;11,5 +01.04.2011;51,59;42,75;48,225;45,665;11,39 +04.04.2011;51,56;42,175;48,79;46,29;11,43 +05.04.2011;52,42;41,9;49,2;46,35;11,5 +06.04.2011;52,6;41,93;49,055;46,615;11,95 +07.04.2011;52,16;42,49;49,46;46,665;11,785 +08.04.2011;52,04;42,92;49,4;47,095;11,805 +11.04.2011;50,65;42,62;49,5;47,225;11,6 +12.04.2011;50,47;42;48,805;46,75;11,135 +13.04.2011;51,1;42,69;50;47,155;11,3 +14.04.2011;49,79;41,595;49,89;46,655;11,03 +15.04.2011;49,47;41,075;50,75;46,185;11,05 diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/MuS_Aufgabenblatt_2_SS_11.pdf b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/MuS_Aufgabenblatt_2_SS_11.pdf new file mode 100644 index 0000000..babd3e2 Binary files /dev/null and b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/MuS_Aufgabenblatt_2_SS_11.pdf differ diff --git a/Master/Modellbildung_und_Simulation/Aufgabenblatt2/mus-eisenhauer-abgabe2.zip b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/mus-eisenhauer-abgabe2.zip new file mode 100644 index 0000000..5a3f129 Binary files /dev/null and b/Master/Modellbildung_und_Simulation/Aufgabenblatt2/mus-eisenhauer-abgabe2.zip differ -- cgit v1.2.3