diff options
| author | Bertrand <bertrand.horel@gmail.com> | 2016-04-20 21:56:00 +0200 |
|---|---|---|
| committer | Bertrand <bertrand.horel@gmail.com> | 2016-04-20 21:56:00 +0200 |
| commit | 4e723ffa229db059601d3a0c47f6c229652ee208 (patch) | |
| tree | 8fc76ff57fecf16b3d986aa057477abd14a3ed1a /src/projet.cpp | |
| parent | d3d2034b35a5fe76f533a4d5ffc9db7ea0f778d9 (diff) | |
| download | projet_C++-4e723ffa229db059601d3a0c47f6c229652ee208.tar.gz | |
modification de la structure asian option
Diffstat (limited to 'src/projet.cpp')
| -rw-r--r-- | src/projet.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/projet.cpp b/src/projet.cpp index af322ed..9d3ac15 100644 --- a/src/projet.cpp +++ b/src/projet.cpp @@ -82,7 +82,7 @@ std::vector<double> normalize (std::vector<double> mu) { u = normalize(mu); vector<double> q = quantile_norm(100, 1); vector<double> p(100, 0.01); - asian_option A(0.05, 1.0, 50, 0.1, d, 45); + asian_option A(0.05, 1.0, 50, 0.1, 45, true); exponential_tilt<asian_option> G(mu, A); typedef compose_t<exponential_tilt<asian_option>, multi_gaussian_truncated> tilted_option; std::vector<tilted_option> X; @@ -90,16 +90,13 @@ std::vector<double> normalize (std::vector<double> mu) { for(int i=1; i<100; i++) { X.push_back(compose(G, multi_gaussian_truncated(q[i-1],q[i], u))); } - for(int i=0; i<100; i=i+10){ - std::cout<<X[i]()<<endl; - } stratified_sampling<tilted_option> S(p, X); - S.draw(1000); + S.draw(1000000); cout<<"l'estimateur de la moyenne est :"<<S.estimator().first<<endl; } void exemple2_rqmc(int d) { - asian_option A(0.05, 1.0, 50.0, 0.1, 16, 45); + asian_option A(0.05, 1.0, 50.0, 0.1, 45,true); int N= 10000; @@ -116,7 +113,7 @@ void exemple2_rqmc(int d) { } }; -int make_table(vector< vector<double> > data1, vector< vector<double> > data2) { +int make_table1(vector< vector<double> > data1, vector< vector<double> > data2) { std::fstream fs("doc/table.tex", std::fstream::out);; fs<<R"(\begin{tabular}{|r|rr|rr|c|})"<<std::endl; fs<<R"(\hline)"<<endl; @@ -139,7 +136,7 @@ int main() vector< vector<double> > data1 = exemple1_stratified(); cout<<"Randomised quasi Monte-Carlo sur l'exemple 1 de la normale"<<endl; vector< vector<double> > data2 = exemple1_rqmc(); - make_table(data1, data2); + make_table1(data1, data2); exemple2_stratified(16); return 0; |
