Kappa-Dev/KappaTools

` 1/1 Not_found` error with dual $APPLY statements in GUI

Closed this issue · 3 comments

Using WebSim + GUI, the version current as of this post, the following model produces the cryptic error above.

%agent: A(st{a b c})	%init: 10 A()
A(st{a/b}) @ 1
A(st{b/a}) @ 1
%obs: 'A_a' |A(st{a})|
%obs: 'A_b' |A(st{b})|
%obs: 'A_c' |A(st{c})|
%mod: [T] > 2 do $APPLY |A(st{a})| A(st{a/c}) ; $APPLY |A(st{b})| A(st{b/c}) ;

Re-writting the dual-effect modification as two modifications produces the same error (and is problematic for timing reasons...):

%agent: A(st{a b c})	%init: 10 A()
A(st{a/b}) @ 1
A(st{b/a}) @ 1
%obs: 'A_a' |A(st{a})|
%obs: 'A_b' |A(st{b})|
%obs: 'A_c' |A(st{c})|
%mod: [T] > 2 do $APPLY |A(st{a})| A(st{a/c}) ;
%mod: [T] > 2 do $APPLY |A(st{b})| A(st{b/c}) ;

Commenting out either of the modifications removes the error.

@pirbo if one wants to transform all agents from a mix of two state to a third state, is there a way of doing that via the interactive / perturbation mode, or should one dump the snapshot and use a text editor?

pirbo commented

The problem seems to be : KaSim crashes when an intervention leads to a deadlock. I hope I can try to understand why today but I'm not sure...

pirbo commented

Actually, there is a soundness bug hidden here but fixing it induces a non trivial refactoring:

The behavior of the simulator currently is :

  • pick the time advance
  • apply the "event-based" perturbation you have to apply
  • pick a rule to apply and apply it

BUT the perturbation can have an effect on the mixture and therefore the rule you were about to apply may not be there anymore after perturbations effects (the example here is a caricature of that as the perturbation erases absolutly all the instances of the rules!) SO the correct behavior should be:

  • pick the time advance
  • pick the rule and its instance you would like to apply but do not
  • apply "event-based" perturbation
  • check that the rule instance is still present
  • apply it of fire a "null-event"

Well, I'm realizing that this would lead to a dramatic slowdown of the simulator because 99.9999999% of the time the perturbations would change your activity (actually 99.999999% of the time, there won't be perturbations to apply) and checking the the rule still applies take time. An heuristic has to be implemented to determine whether this check is necessary...

feret commented