Diffusion models with time-dependent parameters: "An analysis of computational effort and accuracy of different numerical methods"
DOI10.5281/zenodo.7588361Zenodo7588361MaRDI QIDQ6702709FDOQ6702709
Dataset published at Zenodo repository.
Rolf Ulrich, Thomas Richter, Markus Janczyk
Publication date: 7 August 2022
Copyright license: Creative Commons Attribution 4.0 International
Software repository for the reproduction of the test cases from Thomas Richter, Rolf Ulrich, Markus Janczyk:Diffusion models with time-dependent parameters: An analysis of computational effort and accuracy of different numerical methods This software is used in particular for the reproducibility of the results. However, the algorithms can also be used directly for own purposes. If you have any questions about possibly necessary adaptations, please contact thomas.richter@ovgu.de. Parts of this repository General setup Pythoncollects all Python script. Here,Python/PythonToolsare several internal functions, e.g. the realizations of KFE and random walks.Python/resultsandPython/picsare the directories where the results (figures and text-files) are put. C++collects the C++ scripts. Case I Reproduces Case I of the paper (time-independent) Python/TestCase1.py runs the test-case with random walks, integral equation method and with KFE. It produces output inPython/picsandPython/results. These results will be used inC++/testcase1.cc(as reference solution) and byPython/TestCase1-Plot.py C++/testcase1.cc runs the stochastic Euler simulation. Script is started byC++/run-testcase1.sh. It reads in the reference solution generated byPython/TestCase1.pyfor computing errors. Python/TestCase1-Plot.py produces Fig. 6 of the paper. It requires the outputs ofPython/TestCase1.pyandC++/testcase1.cc Case II Reproduces Case II of the paper (time-dependent thresholds and drift) Python/TestCase2.py runs the test-case with random walks, integral equation method and with KFE. It produces output inPython/picsandPython/results. These results will be used inC++/testcase2.cc(as reference solution) and byPython/TestCase2-Plot.py C++/testcase2.cc runs the stochastic Euler simulation. Script is started byC++/run-testcase2.sh. It reads in the reference solution generated byPython/TestCase2.pyfor computing errors. Python/TestCase2-Plot.py produces Fig. 7 of the paper. It requires the outputs ofPython/TestCase2.pyandC++/testcase2.cc Python/TestCase2-AdjustRandomWalks.py runs simulations to reproduce Fig. 11 of the paper and implements the modification of the random walk strategy to limit oscillations. Case III Reproduces Case III of the paper (dependency of the accuracy on the derivative of the drift) Python/TestCase3.py runs the test-case with random walks, integral equation method and with KFE for a fixed discretization but with different values of the drift tau. It produces first part of Fig. 8. C++/testcase3.cc runs the stochastic Euler simulation. Script is started byC++/run-testcase3.sh. It reads in the reference solution generated byPython/TestCase3.pyfor computing errors. Python/TestCase3-Plot.py produces second part of Fig. 8. Depends on the output ofPython/TestCase3.py Case IV Reproduces Case IV of the paper (accuracy and efficiency for Dirac initial data) Python/TestCase4.py runs the test-case with random walks, integral equation and with KFE for a refined discretizations. Python/TestCase4-Plot.py produces Fig. 9. Depends on the output ofPython/TestCase4.py Python/TestCase4-showsolution.py Solves with the KFE and plots the solution as surface plot over time and space variable. This skript is used to create Fig. 10 of the paper. Problem parameters and discretization can be adjusted at the top of the script. To test the different stabilization strategies, one can either adjust the value of theta, or one activates Rannacher time-marching by commenting in the marked lines in the skript PythonTools/kfe.py, here in kfe_ale(..) Data Fitting Python scripts to fit the KFE model to the Data published by Rolf Ulrich et al. in R. Ulrich, H. Schrter, H. Leuthold, T. BirngruberAutomatic and controlled stimulus processing in conflict tasks: Superimposed diffusion processes and delta functions.Cognitive Psychology, 78 , 148174 Python/DataFitting-Simon.py runs the parameter fitting for the Simon task and produces data for Fig. 9 and Table 1. Python/Eriksen-Fletcher.py runs the parameter fitting for the Eriksen Fletcher task and produces data for Fig. 9 and Table 2. Installation running the examples Python The python skripts can just be started. Just note that they depend on each other, i.e.:Python/TestCase1.pyproduces a reference solution that is required byC++/testcase1.ccand the results of both are needed inPython/TestCase1-Plot.py The scripts only depend on standard packages like numpy or scipy and all Python environments should work. One suggestion is to use Spyder as part of Anaconda. C++ The C++-programs are not intended for performing the simulations in a stand-alone application. Instead, the SDE is simulated for a given number of trialsN_trand a given time stepdtand this simulation is repeated64times in order to estimate the average error. It should however be simple to use the scripts as basis for an efficient parallel simulation tool that uses multithreading. Configuration The C++ test cases must be compiled. The test cases are set up to usecmake. We suggest the following (in a Linux-environment or on a Mac using homebrew or MacPorts): Create a directory for compilation, e.g.C++/binnow called thebin-dir In thebin-dircalls cmake bycmake ..(adjust the path, if thebin-diris not a subdirectory of theC++-dir. Several options can be adjusted. InC++/bincallccmake .to make all necessary changes. If you change the location of thebin-diryou will have to modify the run-scriptsrun-testcase[123].sh. Compilation Initially and whenever you change the code, the programs must be re-compiled InC++/binjust callmake Running the examples The programs are started inC++. For each of the test-case there is a skript to start the program. InC++callsh ./run-testcase1.sh(orsh ./run-testcase2.sh, etc.) Each script will start the programs several times. ForCase I,Case IIandCase IVthe simulation is started on a sequence of finer and finer discretizations, forCase IIIthe value oftauwill be changed. The scripts store the output inC++/results. Old outputs will be overwritten! Further, the scripts read information about the reference solution fromPython/resuts. The C++ programs use multithreading the OpenMP. If you do not specify the number of threads to be used, all available threads are taken including all hyperthreads. This is usually not efficient it is therefore advisable to set the number of threads by hand, e.g. by calling export OMP_NUM_THREADS=8 before calling the run-scripts. License Information Initially the software has been written Thomas Richter, Otto-von-Guericke University Magdeburg, Germany in 2022, 2023 (thomas.richter@ovgu.de) You are free to use the scripts under theCreative Commons Attribution 4.0 License.
This page was built for dataset: Diffusion models with time-dependent parameters: "An analysis of computational effort and accuracy of different numerical methods"