-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicit dv := pre(dv) in initial algorithm? #3472
Comments
Note relation to #2639. I'm trying to get clarity on the initialization-specific aspects in this new issue. |
Clearly discrete variables that are not unconditionally assigned should have deterministic value at the start of the initial algorithm to get deterministic results. However, using pre(dv) will mostly cause loops that cannot be solved (uniquely), unless the variable is assigned a value (independent of its initial value) and in that case the initial value didn't matter. That just seems bad. For parameters we instead have the special rule that they are initialized to their start-value in initial algorithms, and that seems like a solution that could be generalized to all variables in initial algorithms giving the following benefits:
|
If not I would propose the change above. |
dv = pre(dv) looks to me like a steady-state condition, which of course can be hard to solve for in some cases. I think using the start attribute makes a lot more sense. |
I like the idea of unifying the handling and breaking loops, but it's a non-trivial change of semantics that should be evaluated using test-implementations rather than by listening to gut feelings. |
I played around with the MWE by @maltelenz and I came to the conclusion that OMC already implements the proposed new semantics 😅:
This means, the OMC generated code first initializes those discrete variables with their start attributes, and then possibly overwrites their value when executing the initial algorithm. So, we already have a working test implementation, and it's been around for a while 😃 Is there any further tests cases you'd like to analyze with it? |
keeping @phannebohm and @kabdelhak in the loop, maybe they can further comment about this specific issue. |
Consider:
From what I read here about algorithms:
and here about when equations:
my interpretation is that the initialization problem to be solved for this model is:
which, swapping
pre(i) => prei
for readability, conceptually is similar to (pseudo code):which reveals that we have a cycle/mutually dependent equations in the variables
{i, prei}
, turning this into an illegal model.Is this interpretation correct?
The text was updated successfully, but these errors were encountered: