And Vera, why are you using exceptions instead of return values? I think it's slowing your solver down considerably.
Wow... Just Wow...Optimized I had the code at 5 seconds in my recently updated format, however now it increased to 31 seconds. That makes it 6-7 times slower by not using the two potential exceptions.