Friday, May 4, 2012

Solver issues

Over the last few days I've worked with the Solver and the helpers that are calling it from LineEditingHandler to get it to work correctly on several consecutive calls. For example, if we call the solver on a four line rectangle with two free points, we always get a solution. If we call it with no free points and immediately after that with 2 free points, we don't get a solution, because the global objects that are used to store the point references weren't properly re-initialized and no solution is found.

Re-initializing them for every call causes the solver to become too slow and there are some cases where the references are not properly updated, resulting in NaN values for the point coordinates.

I'm trying to change the Solver so that the global objects won't be changed and the results returned by it will be used to update the references only when a solution is found. This way the initializers wouldn't be called multiple times and we would avoid the NaN problem.