Skip to content

Integration with Matlab model simulator

Andrea Vandin edited this page Dec 20, 2023 · 4 revisions

How to integrate MultiVeStA with your matlab simulator

Contact us for detailed instructions ([email protected])

If you are brave enough, you can it yourself

  1. Download the archive containing a running version of MultiVeStA integrated with a simple matlab simulator of a coin tosser model (matlabMultiVeStA.zip)

  2. Decompress the archive

  3. If using a Mac or Linux machine, navigate to the extracted folder with a terminal, and open run.sh

  4. Inside run.sh, one has to change a few things:

    • Not all java versions work.
      • We tested it on java 11, which can be downloaded here
      • It does not work with java 17
    • In run.sh, replace the two occurrences of /Library/Java/JavaVirtualMachines/jdk-11.0.14.jdk/Contents/Home/bin/java with the right path where you have downloaded or installed the suggested version of java (if you are lucky, just writing java might work)
  5. One has to point to the folder bin/maci64 inside the installation folder of Matlab. Replace /Applications/MATLAB_R2023a.app/bin/maci64 with the right path

  6. Save run.sh, and execute it from terminal.

MultiVeStA shall open a plot very similar to the one on the right here:

Plot

We can see that the number of heads and tails tend to be evenly picked. This is because we parametrized the system as being a fair coin (setParams 0.5, where 0.5 is the probability of extracting head). If we decrease 0.5 to 0.1, we will get a plot like the one on the left about, where the number of heads is much lower than that of tails.

Instructions on how to run on windows environments will follow.


These are the parameters for the command line version of MultiVeStA:

  • -f your multiquatex query. In our case, we ask to count the number of heads and tails at every simulation step from 1 to 10
  • -l the parallelism degree to use (across how many processes should the simulations be distributed)
  • -ds a delta (precision of the estimate) value for each property in the query. The estimations computed by MultiVeStA will actually be confidence intervals centered on the estimation, +- delta/2
  • -a the alpha value (the accuracy of the confidence interval) 
  • -m the folder containing all matlab scripts of the model
  • -otherParams should specify parameters specific to the considered model. In this case we have:
    • cointoss the name of the matlab class to create. We accept only constructors without parmeters
    • evalObs the name of the function used to evaluate observations
    • setParams the name of the function to be invoked right after calling the constructor
    • 0.5 space-separated list of parameters for the model. In this case, we only have the probability of extracting a head

In addition, 

  • -sots is used to generate the list of random seeds used by MultiVeStA. If you provide it, the very same analysis (very same simulations) will be performed every time you run this command (for replicability). If this is not of interest, just remove -sots 1
  • -vp can be used to disable the generation of interactive plots if not needed.
  • -bs how many simulations shall be performed before checking/computing confidence intervals. We will perform iterations of bs simulations until we get the required confidence intervals
  • -ir 1 we will create intermediate CSV files after every 1 iteration of bs simulations

This tutorial has been written with the contribution of