Serialization of PMF failes if PMF is based on IProbabilityMassFunction
When running the analytical solver (SRES) on the media store example, the solving process stops with the following error:
This exception seems to be new with the integration of the latest StoEx parser/serializer. The issue appears because the Xtext-based serializer cannot serialize a probability mass function (PMF) with the generic samples SampleImpl<T>. The serializer must know the particular type of the sample (e.g. IntSampleImpl) in order to predict the type of the PMF to be serialized. The previously used serializer does not seem to have required a particular sample type.
Fix has been integrated into master.
We opted for a possible fix before the serialization of the expression in the solver. Introducing type safety in the probability function implementation is nearly impossible because of the sheer amount of code to be adjusted.
Error still replicable with the appended edu.kit.kastel.scbs.ageofmaturity model
We (thanks to ) identified the location that produces generic samples for PMFs and inserted logic to produce the most concrete subtype of samples based on the value type. This is some sort of hacky solution because it would be better to remember the type of samples in the IProbabilityMassFunction and recreate these particular types later. However, this requires changes of APIs that are used in various places.
We are not sure if this is the only location which produces these generic samples but at least it fixes the particular error reported in the issue.