Skip to content
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

The optimal solution is not always provided #34

Open
wvenialbo opened this issue Nov 7, 2020 · 0 comments
Open

The optimal solution is not always provided #34

wvenialbo opened this issue Nov 7, 2020 · 0 comments

Comments

@wvenialbo
Copy link

wvenialbo commented Nov 7, 2020

In most of my test cases, the optimal solution is not found. I guess it is a hashing issue. By excluding duplicate and mirror entries in the search tree, there is an implicit assumption that a branch represents an equal or longer solution, however, that is not always the case. Some solutions with more individual steps could be associated to one with less moves, as shown in the figure below.

image

The figure shows the provided solution in the upper branch and the optimal solution in the lower branch. The firs image in the upper row is the problem setup. The first step in both branches are mirrored states, whereas the step 3 in the provided solution is a duplicate state of the step 5 in the optimal solution, as are the two last steps shown in both branches.

A possible workaround is to keep a separate list of already computed states, to avoid compute duplicate states in the corresponding subtree, and a full tree of solutions, with a mechanism to avoid recursive tree traversing, since a state can have more than one parent.

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

No branches or pull requests

1 participant