From e56b32e5a8df18a931b83a0cd3af5b7f188d40a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Nadeau?= Date: Tue, 27 Aug 2019 18:16:06 +0000 Subject: [PATCH] update readme to show the option to count objects --- README.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.rst b/README.rst index 830a2e87e..a2906110c 100644 --- a/README.rst +++ b/README.rst @@ -177,6 +177,20 @@ the ``from_dict`` function is written in such a way that for any class ... data['alphabet'], ... bool(int(data['just_prefix']))) +We also add some methods that we will need to get the enumerations of the +objects. + +.. code:: python + + ... def is_epsilon(self): + ... return self.prefix == "" and self.just_prefix + ... + ... def is_atom(self): + ... return len(self.prefix) == 1 and self.just_prefix + ... + ... def is_positive(self): + ... return len(self.prefix) > 0 + Our ``CombinatorialClass`` is now ready. What is left to do is create the strategies that the ``CombinatorialSpecificationSearcher`` will use for performing combinatorial exploration. This is given in the form of a @@ -394,5 +408,10 @@ we see that the minimum polynomial satisfied by the generating function and moreover ``F = -(x**7 + x**5 + x**4 + x**3 + x**2 + 1)/(x**6 + x**3 - x**2 + 2*x - 1)``. +.. code:: python + + >>> tree.count_objects_of_length(10) + 331 + You can now try this yourself using the file ``example.py``, which can count any set of words avoiding consecutive patterns.