Download AsmetaL: a user guide

Transcript
par
owner(left_fork(self)) := undef
owner(right_fork(self)) := undef
eating(self) := false
endpar
endif
endif
main rule r_choose_philo =
forall $p in Philosophers with true do program($p)
default init initial_state:
function eating ($p in Philosophers)= false
function owner ($f in Fork) = undef
agent Philosophers :
par
r_Eat[]
r_Think[]
endpar
Code 10: Five philosophers
The users must set the values of the monitored function hungry($p in Philosophers) (i.e. the values of the function locations) to identify the philosophers that
want to eat. This model makes the assumption that the user will respect the concurrency on the use of the forks and, so, that will never let two neighbour philosophers
eat at the same time. In fact, the following execution causes an inconsistent update
since phil_4 and phil_5 cannot eat at the same time:
INFO - <Run>
INFO - <Transition>
Insert a boolean constant for hungry(phil_4):
true
Insert a boolean constant for hungry(phil_5):
true
Exception in thread "main" org.asmeta.interpreter.UpdateClashException
Code 11: Five philosophers
14