Skip to content

Simplyfiyng BasicOperations intersection#5

Open
pierlauro wants to merge 1 commit into
cs-au-dk:masterfrom
pierlauro:master
Open

Simplyfiyng BasicOperations intersection#5
pierlauro wants to merge 1 commit into
cs-au-dk:masterfrom
pierlauro:master

Conversation

@pierlauro

Copy link
Copy Markdown

Since due to De Morgan's law A ∩ B = (Ac ∪ Bc)c, the intersection operation can be simplified in order to avoid the quadratic algorithm.

Since due to De Morgan's law **A ∩ B = (A<sup>c</sup> ∪ B<sup>c</sup>)<sup>c</sup>**, the intersection operation can be simplified in order to avoid the quadratic algorithm.
@amoeller

Copy link
Copy Markdown
Member

The complement operations involve 'determinize', so this may not be a good idea. Do you have some experimental evidence that your suggestion is in fact faster in general?

@pierlauro

pierlauro commented Jul 12, 2017

Copy link
Copy Markdown
Author

You're right, I did not take in consideration the non-deterministic automatas.

Intersecting dozens of DFAs, I discovered that my solution is improving the performances (20% faster). Maybe the improvement I experienced is due to the characteristics of DFAs I am working with: they are very similar and the alphabet is not too big.

I will come back with an appropriate analysis after further experiments. Anyway, I think it's a good idea to let people choose the preferred method by adding a new method intersectionDeMorgan.

@amoeller

Copy link
Copy Markdown
Member

Provided that further experiments are convinving: Let's add a static field intersection_de_morgan (false by default) and a method setIntersectionDeMorgan (like setMinimizeAlways) to control which version to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants