No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Tutorial]] | [[Category:Tutorial]] | ||
[[Category:User Manual]] | |||
We assume that you grasped the way that ProB setups up the initial states of a B machine as outlined in [[Tutorial Setup Phases]], and have understood why animation is difficult as outlined in [[Tutorial Understanding the Complexity of B Animation]]. | We assume that you grasped the way that ProB setups up the initial states of a B machine as outlined in [[Tutorial Setup Phases]], and have understood why animation is difficult as outlined in [[Tutorial Understanding the Complexity of B Animation]]. | ||
Line 8: | Line 8: | ||
* a representation using AVL-trees. | * a representation using AVL-trees. | ||
The second representation allows ProB to deal with larger sets and relations (starting at around 100,000 elements performance will start to slow down). However, this representation can only be used if the constraint solver knows exactly '''all''' elements of a set or relation. The list representation will be used if only part of the set or relation is known. | The second representation allows ProB to deal with larger sets and relations (starting at around 100,000 elements performance will start to slow down). However, this representation can only be used if the constraint solver knows exactly '''all''' elements of a set or relation. The list representation will be used if only part of the set or relation is known. | ||
To give an idea about the performance related to the new AVL-based representation, take the substitution | |||
<pre> | |||
numbers := numbers - ran(%n.(n:cur..limit/cur|cur*n)) | |||
</pre> | |||
* For limit=10,000 this takes 0.2 seconds (on a 2008 laptop); with the list representation this operation ran out of memory after 2 minutes in ProB 1.2.x. | |||
* For limit=100,000 this takes 2.1 seconds. | |||
* For limit=1,000,000 this takes about 21.9 seconds. | |||
For example, if the PROPERTIES contains the following predicates | For example, if the PROPERTIES contains the following predicates |
We assume that you grasped the way that ProB setups up the initial states of a B machine as outlined in Tutorial Setup Phases, and have understood why animation is difficult as outlined in Tutorial Understanding the Complexity of B Animation.
First, it is important to understand that as of version 1.3, ProB uses two representations for sets and relations:
The second representation allows ProB to deal with larger sets and relations (starting at around 100,000 elements performance will start to slow down). However, this representation can only be used if the constraint solver knows exactly all elements of a set or relation. The list representation will be used if only part of the set or relation is known.
To give an idea about the performance related to the new AVL-based representation, take the substitution
numbers := numbers - ran(%n.(n:cur..limit/cur|cur*n))
For example, if the PROPERTIES contains the following predicates
then all values will be fully known and the new AVL-based representation will be used. However, for example for
we would only have partial information about x (which the constraint solver will encode using the list [1|->_, 2|->_] where the underscore marks as of yet unknown bits.
Basically, the ProB constraint solver works as follows:
The priority is a rough estimate of the number of possible solutions; predicates with the lowest estimate will be "executed" first.
The following picture provides a very rough picture of this process: