-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integer overflow when comparing two large automata #84
Comments
Thank you for reporting this issue. Unfortunately, I don't have a quick solution in mind. For computing the shortest separating word, the method performs a breadth-first traversal on the product-automaton which requires Do you have anything specific in mind, or is it more about reporting the correct issue (e.g., using an If you don't care about shortest counterexamples, you could use the |
Unless I'm overlooking something, I think the method Even though Do you agree with this?
Unfortunately, my algorithms assume shortest counterexamples. |
The main problem is not running out of memory, but not being able to compute the correct ids / indices. Despite overflowing, I think two's complement still allows you to correctly compute multiplication and addition (i.e., abusing negative values as an unsigned interpretation) but as soon as your input automata have more than 2^16 states each, you hit a dead end. Luckily, a rather simple solution is to use longs instead of ints. Especially in the large case, you can easily use them as keys for the Map without too much of a performance overhead. I refactored the class in b7dc4ca and took the freedom to remove the large version as well since it was an identical implementation with just different bookkeeping. I also added a test-case that now passes. However, I would be greatful if you could double-check with your use-case as well. Since the class is pretty much self-contained, you should be able to just copy it as-is and call it instead of the current upstream version. |
I have two large automata for which I call the function
Automata.findShortestSeparatingWord
to find some difference (if any). However, these automata are apparently so large that an integer overflow happens on the following line.automatalib/util/src/main/java/net/automatalib/util/automaton/equivalence/DeterministicEquivalenceTest.java
Line 44 in d156e08
This means that the subsequent check
if (totalStates > MAP_THRESHOLD)
passes and the program ultimately crashes with aNegativeArraySizeException
onautomatalib/util/src/main/java/net/automatalib/util/automaton/equivalence/DeterministicEquivalenceTest.java
Line 74 in d156e08
The text was updated successfully, but these errors were encountered: