Correct least constraints value implementation#1192
Merged
Conversation
Merge update
Merge latest changes
lcv previously sorted by nconflicts (conflicts with already-assigned neighbours), which is degenerate during a consistent search. Add CSP.count_lost_values(var, val, assignment) - the number of values ruled out in unassigned neighbours' domains - and order lcv by it, matching the AIMA definition. Clean snake_case implementation; tests updated. Closes aimacode#1089.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR for #1089 - have added a method for lcv based on implementation in aima-java.
The implementation has two loops for checking constraints in both directions, which might need refactoring to make it more Pythonic.
Also included a straightforward method test on the heuristic.
Please review & suggest any changes.
@antmarakis @norvig