connecting Matlab to PRISM from PRISM source code

528 views
Skip to first unread message

casparg...@gmail.com

unread,
Oct 21, 2013, 5:16:54 AM10/21/13
to prismmod...@googlegroups.com
Dear all,

I have a question: Has anyone made an adaption to PRISM (source code) in order for it to import a transition matrix defined by a Matlab .m file?
I am working on a project in which I want to connect Matlab to PRISM and basically all I want is to export a transition matrix from Matlab into PRISM. 
I have done this by converting the Matlab transition matrix to .tra and .sta files and also using .prism files, but this is still fairly slow, so I was wondering if anyone has made a direct connection by adapting the PRISM source code.
Thanks in advance if there is any knowledge or advance on this.
Best regards,

Caspar Gevaerts 

Marcin Copik

unread,
Oct 21, 2013, 7:37:21 PM10/21/13
to prismmod...@googlegroups.com

Have you looked at MAT-file format?
Level 5 is complicated and it is a large task to implement this, but Level 4 is straightforward - header + data. Of course it has some limitations - only two-dimensional matrices are supported.
You can find more details about Mat-file format in discussion at SO(there is in comments link to a great article at "Undocumented Matlab" site)
http://stackoverflow.com/questions/4950630/matlab-differences-between-mat-versions
There is a pdf at Mathworks site which describes exhaustively Level 4 and Level 5 formats.

Supposing that you want to import matrix from Matlab file on your own, implementing Level 4 is - in my opinion! - the best idea. There is a library - JMatIO - which provides MAT-file implementation in Java, so it will be a good point to start. Of course it depends on whether you're programmer with knowledge about Java.
Unfortunately, I can't tell you if there are any plans to implement this feature in Prism - you have to wait from an answer from Prism developers ;-)

Best regards,
Marcin Copik

--
You received this message because you are subscribed to the Google Groups "PRISM model checker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prismmodelchec...@googlegroups.com.
To post to this group, send an email to prismmod...@googlegroups.com.
Visit this group at http://groups.google.com/group/prismmodelchecker.
For more options, visit https://groups.google.com/groups/opt_out.

Dave Parker

unread,
Oct 31, 2013, 7:13:13 PM10/31/13
to prismmod...@googlegroups.com, casparg...@gmail.com
Hi Caspar,

If you want to import a model that is presented in the form of a matrix,
i.e. an explicit list of transition probabilities, then the -importtrans
switch is generally the most efficient way. I see you have already tried
this (by converting to .tra/.sta files). You could probably adapt PRISM
to read Matlab .m files instead of .tra files, but unless your .m ->
.tra translation is very slow, this won't help you very much.

Unfortunately, directly importing a matrix in this way can be
inefficient, because PRISM's default methods use symbolic (BDD-based)
data structures, which are not well suited to this kind of model
construction (they work much better when the model is originally
specified in the PRISM modelling language).

Best wishes,

Dave.
Reply all
Reply to author
Forward
0 new messages