Message Boards Message Boards

Order of Hyper Edges impacts performance and results

Posted 4 years ago

If it wasn't obvious, they way you construct the Hyper Graph can impact performance and potentially the result to.

Timing[WolframModel[{{1,2,1}, {5, 6}, {5}} -> 
            {                
                {1,11},{2,12},
                {5},{7,6},
                {11},{11,12},{11,12,11},{5,7}
            }, 
    {{1,2,1},{1,2},{1}} , 36, "FinalStatePlot"]]

takes 115 seconds, while

Timing[WolframModel[{{1,2,1}, {5, 6}, {5}} -> 
            {                
                {11,12,11},{11,12},{11},
                {5,7},{5},
                {1,11},{2,12},
                {7,6}
            }, 
    {{1,2,1},{1,2},{1}} , 36, "FinalStatePlot"]]

takes only 102.

The difference can depending on the rule also influence the result:

enter image description here enter image description here

Do you have insights or thumb rules how improve the performance of you rules?

Is 'it being safe to permute hyper edges in the return value' equivalent to 'the rule is causally invariant for those initial conditions'?

Posted 4 years ago

Yes, the evolution order depends on the "age" of hyperedges. The hyperedges within a single rule output are assumed to have decreasing ages left-to-right, which is why you are getting different results. See more details in the "EventOrderingFunction" documentation.

Causal invariance is related to this, but it's not equivalent. In a special case of causal invariance where the multiway branching does not happen at all (i.e., there are never two overlapping matches for any given intermediate state), putting the rule output in a different order indeed would not change the results (reverse is not generally true, however). But keep in mind, causal invariance is not guaranteed to give you the same result after a finite number of steps (it only requires causal graphs to be eventually the same after an arbitrary large number of steps), so generally speaking you might get different results even in causal invariant systems.

POSTED BY: Max Piskunov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract