contributed by Christian Krause
We use the simple dining philosophers example here to give an intuition about the rule-based modeling in Henshin and to conduct a benchmark for the state space generation tool.
The transformation consists of four rules shown below.
In rule left(p) philosopher p picks up his left fork, and analogously for the rule right(p). In rule release(p) the philospher p releases his fork again. The most interesting rule is createPhilosopher(x) where x refers to the highest philosopher ID in the model (note that Henshin can find all parameters automatically here). The rule createPhilosopher(x) can be used to dynamically add a philosopher to the table and to link it to its neighbors. We use this rule to derive initial models for different numbers of philosophers below.
The state space can be either generated in the state space explorer (slow), or by right-clicking on a statespace file and selecting State Space -> Explore State Space, or programmatically as done the the DiningPhilsBenchmark class. The screenshot below shows the state space for 3 philosophers as visualized in the state space explorer. Note that we do not make use of graph isomorphy checking for making the state space smaller, because we want to be able to identify each philosopher individually (by its ID).
We conducted a benchmark to measure the speed of the state space generator. The models and the source code for the example can be found here. The following benchmark was conducted on a Intel(R) Xeon(R) CPU @ 2.50GHz with 8GB of main memory using Henshin 0.9.2. We measured the time to generate the full state space.
|Philosophers||States (= 3^p)||Transitions||Time|
Back to the top