Selection of iteration variables

9 posts / 0 new
Last post
jakesson
Offline
Joined: 2009-03-14
Selection of iteration variables

There are some issues related to selection of iteration variables that needs to be settled. The compiler computes alias sets from equations of the type

x = y
in which case x *or* y may be eliminated. How to chose which variable to keep is non-trivial. Also, it seems necessary in some situations to propagate information from the variables in an alias set which are not selected to the iteration variable of the alias set. Consider for example an alias set where one of the variables is an input - in order to preserve the structure of the model, the iteration variable then needs to have input causality. Another example is variable attributes. For example, if a variable has the fixed attribute set to true, this information cannot be discarded if another variable is selected as iteration variable. If it is, then the number of initial equations change and the model most likely becomes unbalanced.
 
Ideally, we can come up with a consistent and transparent set of rules for selection of iteration variables.
 
Best
/Johan

magnus
Offline
Joined: 2009-03-12
I don't think that causality

I don't think that causality of a variable has to be regarded in symbolic transformations (unless for top-level inputs). Or?
I also think that all variables in an alias set must be "equivalent" in some sense that probably includes the property of having all (relevant) attributes equal.
As a consequence of above it should not matter which of x and y that is eliminated. I think.
/Magnus
 

hubertus
Offline
Joined: 2009-04-24
Two step procedure?

A user may not bother to set attributes/modifiers in a way that they are the same for x and y, even if there is an equation x = y. In order to reduce unnecessary errors, attributes like fixed need to be matched according to certain heuristics (if fixed = true for x, but fixed is default for y, fixed is set true for y as well without error). After such a procedure, the attributes should be equal and it does not matter which variable is chosen. Dymola avoids errors in case of contradictory attributes as far as possible, but warnings are in order for many discrepancies (x(nominal=0.1) and y(nominal=1e7) could have a huge influence on the solution, if nominal would be used for scaling) A warning may be a good idea. Dymola is silent in that case. The case that only one variable has nominal set is probably more common. BTW: with iteration variable you mean the used variable as opposed to the variable that is aliased away?.

jakesson
Offline
Joined: 2009-03-14
Inputs in alias sets
magnus wrote:

I don't think that causality of a variable has to be regarded in symbolic transformations (unless for top-level inputs). Or? 

Elimination of alias variables is performed on the flattened model, so only top-level inputs are present. This probably means that if an input and an algebraic variable is in the sam alias set, then the iteration variable needs to have an input prefix as well.
/Johan

jakesson
Offline
Joined: 2009-03-14
RE: Selection of iteration variables
hubertus wrote:

BTW: with iteration variable you mean the used variable as opposed to the variable that is aliased away?.

By iteration variable I mean the variables which are kept in the model after elimination of aliases.
 
I agree that the fixed attribute needs to be preserved, and then it probably makes sense to select the corresponding start value. If more than one variable in an alias set has fixed=true and the start values differ then it is an error.
In the case of min and max, which are commonly used to set bounds in optimization problems, it is reasonable to select the bounds for the iteration variable to be the most conservative combination of bounds, i.e., the smallest max attribute value and the largest min attribute value.
/Johan

magnus
Offline
Joined: 2009-03-12
I am a bit confused about the

I am a bit confused about the use of the words "iteration variables". You mean non-alias variables, I guess; Those that are not eliminated. I would guess that the input prefix was still kept as an attribute in the AST nodes also for non-toplevel variables. Then they may be disregarded in alias equivalence. That was my comment.

magnus
Offline
Joined: 2009-03-12
x
hubertus wrote:

A user may not bother to set attributes/modifiers in a way that they are the same for x and y, even if there is an equation x = y. In order to reduce unnecessary errors, attributes like fixed need to be matched according to certain heuristics (if fixed = true for x, but fixed is default for y, fixed is set true for y as well without error). After such a procedure, the attributes should be equal and it does not matter which variable is chosen. Dymola avoids errors in case of contradictory attributes as far as possible, but warnings are in order for many discrepancies (x(nominal=0.1) and y(nominal=1e7) could have a huge influence on the solution, if nominal would be used for scaling) A warning may be a good idea. Dymola is silent in that case. The case that only one variable has nominal set is probably more common. BTW: with iteration variable you mean the used variable as opposed to the variable that is aliased away?.

I would start with the simple rule that all (or relevant) attrubutes must be equal for alias equivalence. If this turns out to be too conservative then heuristics or other rules may be implemented in the future.

jakesson
Offline
Joined: 2009-03-14
Inputs in alias sets
magnus wrote:

I am a bit confused about the use of the words "iteration variables". You mean non-alias variables, I guess; Those that are not eliminated.

Yes. But I'm not sure about the term 'iteration variables' - is there a better expression?

magns wrote:

I would guess that the input prefix was still kept as an attribute in the AST nodes also for non-toplevel variables. Then they may be disregarded in alias equivalence. That was my comment.

No, all input prefixes are eliminated during flattening except for the top-level inputs.
/Johan
 
 

magnus
Offline
Joined: 2009-03-12
x
jakesson wrote:

Yes. But I'm not sure about the term 'iteration variables' - is there a better expression?

The term "iteration variable" is normally used in the context of equation tearing, to my knowledge. Thereby my confusion. I don't know which word to use in this context.

Login or register to post comments