[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [xmile] SMILE and XMILE
That is mostly what I intended, Tom. The original purpose of SMILE by itself was to define the functionality of the language we wanted to encode, which also includes equation syntax to make it consistent in all encodings of the SD language. Bob's and Magne's discussion seems to be leaking into whether the same equation syntax should be used in all encodings, but the technical committee is only concerned with the XML encoding.
To clarify again, Magne, the basic part of SMILE (up to section 6) is based on DYNAMO and was intended to define the intersection of vendor's products. I discussed the optional parts in section 6 with a number of people in the community before putting them into the spec, but they clearly need additional review.
Thanks, Travis, for joining To your questions:
The answer is "yes". However, math does not specify all we need. Examples include hierarchy (objects inside objects), stock-and-flow formulations (unless we use the syntax of integrals), and arrays.
Hi Karim, and thanks again for your enormous effort in this area. Thanks also for your clarification:
Since XML is an encoding of an SD model, it must be clearly specified what an SD model is. (SMILE is another encoding of the same thing).
I am trying to lift focus to the conceptual level, so we can agree on what an SD model is, identify its objects, object properties, and relationships among object. Only then does it make any sense to define the textual and graphical representations. There is, of course, a hidden mental model of the concepts behind your work with SMILE/XMILE. This model should be made explicit.
Jumping back to the XML encoding: In my view, we should allow vendors to maintain their uniqueness when it comes to concepts, syntax, semantics and tokens. An easy way to do this, is to let every object (variable, say), be defined with a left-hand-side (the name of the variable), and a right-hand-side (the definition of the variable). What the right-hand-side looks like, must be vendor specific. See http://www.myrtveit.com/papers/A_framework_for_dataflow_models.pdf figure 59, page 38-29.
The current XML specification, does not follow the above principle, since the definition (right-hand-side) is split up into XML elements that fits for some vendors, but certainly not for all (current or future). It would be Ok that vendors use their own, non-standard elements, or optional extra elements (such as, mathml) in their files. But the definition property should in my opinion be a text attribute of the variable object. To be concrete, I recommend that the XML encoding for a variable Y=F(X) should look like this:
The exchange between Bob and myself concerns how to map Vensim's multi-equation syntax into a single right-hand-side.
Can you clarify the following, please?
I am uncertain if SMILE/XMILE is intended to be an intersection or a union of vendor products. When looking at the specification, it seems to contain stuff outside the common core of SD. (See chapter 6, page 43ff, of the dataflow document for my understanding of core system dynamics, and how it can be extended). Is it possible to define the core of XMILE, and show how it can be extended to accommodate concepts, features, syntax etc. offered by current vendors?
Thanks for joining, in, Thomas. I agree with your statement:
The details of _expression_ syntax varies significantly among vendors. We can like it or we can dislike it, but it is a fact. The syntactical differences fall into tow groups:
PS: Note that not even IF-THEN-ELSE is semantically the same among vendors. Software with support for three- or four-state logic, have a branch for the case when the condition is undetermined, as illustrated by Dynaplan Smia's IF statement: IF a THEN b ELSE c EXCEPT d ENDIF
When mapping Vensim's multiple equations into one equation, would you like to maintain as much as possible of the existing language definition used by Vensim, or do you consider to redefine Vensim's language to match SMILE or something else?
Assuming that you want to maintain Vensim's current language definition at the conceptual, syntactical, semantic, and lexical level as much as possible, how can the following be mapped into one equation?
My suggestion is something like this:
The changes I made to your existing syntax, are:
I don't remember of bar and double arrow are already occupied by your grammar. If they are, just find some other character combinations that are free.
If you are in the process of change your modelling language (grammar), you have more degrees of freedom. Here are some examples I could think of:
If you introduce a minus operator on your subscripts, with the semantics to shift subscripts a given number of position to the left, there is no need for mapping, and the equation becomes:
If you allow for index variables and intervals (a to b), the equation can be like this:
As a comparison, here is the Smia syntax I would use:
Thanks for all the replies. The Smia is very compact, but I have to admit it is also baffling.
But, you have given a pretty good answer to the original question, because even in this case you have defined the attributes of the variable separately from its equation. So I think you have made a pretty good case for bringing in descriptive elements to the underlying computational language definition in addition to the raw equations.
As a side question, is it possible to have different units for different subscript elements in Smia? This is a possibility that is older than all our current languages (Jay was mixing units in subscripted equations in Dynamo), and perhaps not much of an issue for XMILE since optional element by element attributes would be easy to add.
The case you are talking about is represented in SMILE within the inflow and outflow equations as follows:
inflow: IF Stage = Stage1 THEN ProductionStarts ELSE WIP[Stage - 1]/ProdTime[Stage - 1]
outflow: IF Stage = Stage22 THEN Shipments ELSE WIP[Stage]/ProdTime[Stage]
I normally would not use Stage1 and Stage22 explicitly, as Stage1 has the alias "1" and Stage22 has the alias "SIZE(SELF)" which allows me to change the size of the array without then having to change my equations.
The SMILE form is also compact, but I think clearly points out the different approaches. Your formulation is declarative whereas the SMILE formulation is procedural. That is a fundamental difference and maybe herein lies the root of some of the philosophical differences coming out in this discussion.
With regards to the SMILE spec up to section 6, which I based on DYNAMO, if you compare the features there to the features you listed earlier in this thread as the basic set needed for all the models in Business Dynamics, you will see those two feature sets match almost exactly. While I did not call out that feature list at a high level (the hidden mental model you refer to), that was the intention from the beginning.
I firmly believe we need a common equation syntax for this standard to succeed. We are defining a standard for a computer-based language and a well-defined syntax and semantics is a fundamental requirement for any such language to succeed. Bob expressed it more elegantly in the XMILE webinar, where he pointed out that we used to have a common language, DYNAMO, but the vendors have all gone in different directions since then; XMILE is an effort to bring us back to a common core language. If we have different equation syntaxes, we do not have a common language.
I admit that the Smia syntax is "buffling" until it has been explained the first time. It is compact (expressive) and easy to use, once learned. The idea behind it is that the situation where there is one equation for the first or last element, and another for the rest, is very common in models. The list of index definition operators includes:
The answer to your questions about different units for different array elements, is that Smia supports a mixed data type (sometimes called variant in other systems). If a variable is defined with mixed type, every element can have its own type and unit. (This is how Smia is able to represent spreadsheets containing text, numbers, logicals, and what not). See http://www.myrtveit.com/papers/A_framework_for_dataflow_models.pdf, figure 9, page 6 for an example how elements with different units are defined. The important thing, is that the right-hand-side as well as individual array elements (even literals) have an explicit or implicit type and unit in Smia. This approach has several advantages (and no drawbacks) over associating units with the variables.
XML for arrays
You write that "optional element by element attributes would be easy to add.". Agree, it is easy to add, but is it the right approach? I think that array elements should not be represented as separate XML elements, but rather as part of the right-hand-side Definition attribute of the <Variable> element. This way we can maintain the name=definition pattern for equations, and we can also prepare the language for "big data". My experience is that it is not uncommon with arrays holding several million elements. If each array element is stored as a separate XML element, the XML representation would become many times larger (and slower) than a corresponding compact attribute form.
Your alternative definition of the WIP variable (quoted below) is definitely one way to do it.
The solution, however, means that the model is transformed, not just translated, into another syntax. By this I mean that different concepts are used to reproduce the same behaviour in two systems.
Your solution is an example of the only generic approach for transferring models from one system to the other, and it is the one I use when transforming Vensim models when opening them inside Smia.
I can understand your desire to come up with a common syntax for the standard. Is it realistic? To answer the questions myself: Before we can define a common syntax, we need to define common semantics and common concepts. This can be accomplished if we limit ourselves to the "Core SD", as defined almost identically by our two independent works on XMILE and dataflomwl, respectively.
The minute we leave the core, we run into partly overlapping and partly conflicting solutions for language features, as demonstrated by the WIP example. Here it is no longer a matter of agreeing on one syntax of the other, but on selecting among competing approaches. Who is to tell which approach to use? What about the other approaches, that are left out of the standard?
Operations on subscripts
Your WIP equation makes use of expressions involving subscripts, such as Stage-1 and SIZE(SELF). It seems to me that 1 is a synonym for Stage1, which is quite similar to the way C++ treats enumeration types, where each named element is essentially a named integer literal.
This solution is in big contract to the approaches used by Powersim and Dynaplan, where a list defines a new domain which has nothing in common with the domain of integers. The semantics of a list type is very different from the semantics of integers. Below is an example that illustrates:
The array concept of SMILE would produce different results for the variables z, w, and c. I am unsure if SMILE supports the equation for g. (I am also unsure about the semantics of your SELF function).
Note for programmers: The semantics of Smia's list elements has much in common with the semantics of pointers in programming languages. You cannot add pointers, but you can subtract them. You can add an integer to a pointer, producing a pointer, but you cannot multiply pointers, etc.
My main point of showing this, is not to point out the advantages with the Studio/Smia solution, but to highlight the huge conceptual differences between apparently similar solutions in SMILE and other systems. These differences cannot be resolved through syntax agreements, unfortunately.
The number of such differences is quite large, and growing, among the SD technologies. Do you have a suggestion for how to handle them?
Thanks for the notes on this. I want to comment on this idea of a common syntax. There is no goal to define a global syntax, but rather to define semantics and a syntax rich enough to capture the majority of things people do with the functionality in different packages. We would like to keep this close to what is in use, but since things are different it can't be identical to all of them. Thus mapping these equations back to the syntax in a particular package may require some effort. The same is true with things like function names and format, but the mapping is likely to be more complex.
A note on storing equations in general - storing both the XMILE form of the equation and the native form in the same spot would be one way to make a XMILE encoded model open in its original form in the software from which it was saved.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]