I am working on a C++ data analysis project.
I originally worked on a science project during the summer which modelled a stochastic system using the C++11 random number libraries, specifically the mt19937_64 engine mt199937_64 in conjunction with the exponential distribution random number mapping exponential distribution.
I wish to use my work to demonstrate the capabilities of my data analysis project. I wrote the data analysis project specifically because there are no libraries which provide the functionality I require. At the time, I completed the project without the code I have now written.
I have to hand my C++ project in in a "header-only" format. This is rather difficult, as I used GSL to fit non-linear functions for me. I therefore can't use GSL in my project.
How am I to fit the non-linear data then?
Well, I'm planning to use a trick... I intent to run the project on my computer at home, generating a random sequence of data and completing the fits required, saving the fit parameters to disk.
(Can you see where this is going?)
I then intend for my supervisor to run the project demo on their computer using the data from some input files containing the fit parameters.
BUT! The fit will be different each time, because I am using random number generators. Unless I can find a way to seed the random number generator mt19937_64 with the same value each time, so that the same sequence is generated.
So, in summary:
- Generate data at home, perform fits and save parameters to disk
- Send project to supervisor for marking
- Generate same sequence of data on supervisors computer
- Load parameters from disk
- Notify supervisor that since GSL cannot be used in project, fits have been pre-calculated, same data has been generated, and use data analysis program to process results
Is it possible to seed the mt19937_64 engine in such a way that the same sequence is generated each time a program is run?
I presume this is possible, as there is a seed function, see here. However I don't know if this will do what I want it to, or will work as I expect, generating the same sequence each time.
By the way, I can't send a datafile with all this data as it will be several 10's of gigabytes in size.
In addition, I should use the C++11 libraries rather than writing my own as this demonstrates use of C++11 features in my code... (Gets marks)
Aucun commentaire:
Enregistrer un commentaire