PermutaTriangle / Tilings

a Python library for working with gridded permutation and tilings
https://permutatriangle.github.io/programs/2019-6-17-tilings.html
BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

SpecificationNotFound: Expansion unsuccessful #455

Open jaypantone opened 2 years ago

jaypantone commented 2 years ago

To recreate in about 5 minutes:

from tilings.tilescope import TileScopePack, TrackedSearcher
from comb_spec_searcher.rule_db import RuleDBForest

basis = "0132_0213_0321"
pack = TileScopePack.all_the_strategies(2).make_fusion(tracked=False).make_fusion(component=True, tracked=False).kitchen_sinkify(0, 0, False).make_tracked()
css = TrackedSearcher(basis, pack, ruledb=RuleDBForest(), expand_verified=True, max_assumptions=1)
spec = css.auto_search(status_update=10)
spec.expand_verified()

The problem, seems to be:

[I 220505 14:13:03 specification:163] Expanding with LocallyFactorable on
    +-+-+
    |1| |
    +-+-+
    | |●|
    +-+-+
    1: Av(0132, 0213, 0321)
    ●: point
    Requirement 0:
    0: (1, 0)
    Assumption 0:
    can count points in cell (0, 1)

[I 220505 14:13:03 comb_spec_searcher:586] No more classes to expand.
[I 220505 14:13:03 specification:171] Specification NOT detected. Allowing reverse rules
[I 220505 14:13:03 comb_spec_searcher:586] No more classes to expand.

Full traceback:

---------------------------------------------------------------------------
SpecificationNotFound                     Traceback (most recent call last)
~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_comb_class(self, comb_class, pack, reverse, continue_expanding_verified, max_expansion_time)
    238             spec_rule = css._auto_search_rules(
--> 239                 max_expansion_time=max_expansion_time, status_update=60
    240             )

~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/comb_spec_searcher.py in _auto_search_rules(self, max_expansion_time, perc, smallest, status_update)
    553             )
--> 554         raise SpecificationNotFound
    555

SpecificationNotFound:

The above exception was the direct cause of the following exception:

SpecificationNotFound                     Traceback (most recent call last)
~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_verified(self)
    167                     reverse=False,
--> 168                     continue_expanding_verified=False,
    169                 )

~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_comb_class(self, comb_class, pack, reverse, continue_expanding_verified, max_expansion_time)
    241         except SpecificationNotFound as e:
--> 242             raise SpecificationNotFound("Expansion unsuccessful") from e
    243         new_spec = CombinatorialSpecification(self.root, spec_rule)

SpecificationNotFound: Expansion unsuccessful

During handling of the above exception, another exception occurred:

SpecificationNotFound                     Traceback (most recent call last)
~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_comb_class(self, comb_class, pack, reverse, continue_expanding_verified, max_expansion_time)
    238             spec_rule = css._auto_search_rules(
--> 239                 max_expansion_time=max_expansion_time, status_update=60
    240             )

~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/comb_spec_searcher.py in _auto_search_rules(self, max_expansion_time, perc, smallest, status_update)
    553             )
--> 554         raise SpecificationNotFound
    555

SpecificationNotFound:

The above exception was the direct cause of the following exception:

SpecificationNotFound                     Traceback (most recent call last)
<ipython-input-8-37d851895894> in <module>
----> 1 spec.expand_verified()

~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_verified(self)
    174                     pack,
    175                     reverse=True,
--> 176                     continue_expanding_verified=True,
    177                 )
    178

~/Dropbox/Research/Active/2017-44-ATRAP/repos/comb_spec_searcher/comb_spec_searcher/specification.py in expand_comb_class(self, comb_class, pack, reverse, continue_expanding_verified, max_expansion_time)
    240             )
    241         except SpecificationNotFound as e:
--> 242             raise SpecificationNotFound("Expansion unsuccessful") from e
    243         new_spec = CombinatorialSpecification(self.root, spec_rule)
    244         return new_spec

SpecificationNotFound: Expansion unsuccessful
christianbean commented 2 years ago
Screenshot 2022-05-09 at 10 28 31

this issue is slightly more subtle. The rule needed to expand the verified node 25 is 25 -> (4, 24), but our original spec contains the reverse rule 24 -> (25, 4). I believe this is because locally factorable tells us 25 relies on 0, but really it relies on 24, and in our spec its the only place 24 occurs so we don't recognise the shift between 0 and 24.

Another observation, if we had the reverse add assumption to give the rule 24 -> (0), perhaps we wouldn't need to go through the reverse cartesian product in the first place.