You are here

Problem with the element function

After encountering an unexpected error when running an old model built with Simile 5.3, I discovered that the element function did not work anymore with such a complex syntax (as examplified in the documentation of the function for advanced users!):

element([[5,7],[1,4],[8,5]], [3,3,2,2])

Only an equation such as element([[5,7],[1,4],[8,5]], 1) is now accepted in Simile 5.8 and the last 5.8p4!

Could you please tell me how to solve this problem?...

Thanks,

François

Forums: 

Well I have to admit that it does look as though, as soon as you understood the behaviour of element(...) with multidimensional arguments, we took it away and put something even more bizarrely inexplicable in its place! However, there is method in our madness, and the current behaviour will stay. I will update the documentation to describe it properly and explain the motivation behind it, and let you know when that is done.

In the mean time you can reproduce the old behaviour using explicit replication with makearray, e.g.,

makearray(element([[5,7],[1,4],[8,5]], element([3,3,2,2],place_in(1))),4) -> [[8,5], [8,5], [1,4], [1,4])

Sorry about the failure to keep the documentation up-to-date, and thanks for letting me know!

Thanks Jasper for your quick reply. Without understanding the rationale for such a complicated syntax, I was able to adapt the new formulation to my model!

Looking forward to a comprehensive documentation about it.

Best regards