Reproducibility of problems in Modelling Toolkit (MTK)

We are trying to cache the simplified model of an MTK model in a file. Currently we using the serialize() function of base Julia.

Observation: The serialized file is different each time we generate it, even if the original DAE system is the same.

Is this to-be-expected? Is there a way to avoid that?

What is different? Can you show the diff?

I think this is to be expected if we serialize the ODEProblem, as this has runtime-generated functions. I think the file should be the same every time if we serialize the ODEProblemExpr.

The RGFs should also be the same expression each time, because (a) it uses the same code path as ODEProblemExpr and (b) it’s required for compilation caching that no gensym is used and you get equivalent expressions when repeated.

1 Like

I could share two .xz files with you, and you could try to create a diff. But I cannot share them here on discourse, because discourse does not allow that. This are binary files, a diff does not tell me anything.

ufechner@framework:~/repos/KiteModels.jl/data$ ls -la *.xz
-rw-rw-r-- 1 ufechner ufechner 1397856 apr 22 18:37 prob_dynamic_1.11_3_seg.bin.bak.xz
-rw-rw-r-- 1 ufechner ufechner 1396680 apr 22 18:47 prob_dynamic_1.11_3_seg.bin.xz

This are MTK problems created from identical input, saved using the Julia base function serialize().

Any suggestion?

Are the texts the same?

I mean, the files are different, how shall I know if the texts are the same? I do not know what you mean with “the texts”.

ODEProblemExpr gives you a Julia expression. Are the two cases from different expressions?