-
Notifications
You must be signed in to change notification settings - Fork 4k
fixed expanded_actions( ), added CSPlan with n-ary CSP definition, problems and tests, AC3b and AC4 with tests #1113
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
Merged
Conversation
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
Changed queue to set in AC3 (as in the pseudocode of the original algorithm) to reduce the number of consistency-check due to the redundancy of the same arcs in queue. For example, on the harder1 configuration of the Sudoku CSP the number consistency-check has been reduced from 40464 to 12562!
AC3 algorithm has non-optimal worst case time-complexity O(cd^3 ), while AC4 algorithm runs in O(cd^2) worst case time
…he constant propagation algorithm in mac inference
…eady present in test_csp.py
This reverts commit 20ab0e5.
This reverts commit f743146.
This reverts commit 9e0fa55.
… are already present in test_csp.py" This reverts commit b3cd24c.
…oosing the constant propagation algorithm in mac inference" This reverts commit 6986247.
This reverts commit 03551fb.
This reverts commit 93af259.
This reverts commit 6641c2c.
This reverts commit 9d37ae0.
This reverts commit c4139e5.
antmarakis
reviewed
Sep 15, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall pretty good, but I want to double-check whether the @staticmethod
markers can be removed or not. I would like to keep code as consistent as possible, and if the program runs without them, then they should be removed.
All these methods labeled as static are possible common usage constraints
(like allDiff) that a Constraint object can take as a second parameter. If
you prefer, I can move them outside the class as simple functions.
…On Sun, Sep 15, 2019, 11:47 Antonis Maronikolakis ***@***.***> wrote:
***@***.**** commented on this pull request.
Overall pretty good, but I want to double-check whether the @staticmethod
markers can be removed or not. I would like to keep code as consistent as
possible, and if the program runs without them, then they should be removed.
------------------------------
In csp.py
<#1113 (comment)>:
> + def meets(w1, w2):
+ return w1[p1] == w2[p2]
+
+ meets.__name__ = "meet_at(" + str(p1) + ',' + str(p2) + ')'
+ return meets
+
+ @staticmethod
+ def is_word(words):
+ """Returns True if the letters concatenated form a word in words, False otherwise"""
+
+ def isw(*letters):
+ return "".join(letters) in words
+
+ return isw
+
+ @staticmethod
Is it important to mark these as staticmethod? I don't think we use it
anywhere else in the project and I would prefer to keep things simple.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1113?email_source=notifications&email_token=AFCM2XO5FU4CTY7MNRQHMBDQJYAELA5CNFSM4IWI4N5KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCEX65RQ#pullrequestreview-288353990>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFCM2XIGAQS5QB36GOBEKNDQJYAELANCNFSM4IWI4N5A>
.
|
dj5x5
pushed a commit
to dj5x5/aima-python
that referenced
this pull request
Jul 17, 2025
…oblems and tests, AC3b and AC4 with tests (aimacode#1113) * changed queue to set in AC3 Changed queue to set in AC3 (as in the pseudocode of the original algorithm) to reduce the number of consistency-check due to the redundancy of the same arcs in queue. For example, on the harder1 configuration of the Sudoku CSP the number consistency-check has been reduced from 40464 to 12562! * re-added test commented by mistake * added the mentioned AC4 algorithm for constraint propagation AC3 algorithm has non-optimal worst case time-complexity O(cd^3 ), while AC4 algorithm runs in O(cd^2) worst case time * added doctest in Sudoku for AC4 and and the possibility of choosing the constant propagation algorithm in mac inference * removed useless doctest for AC4 in Sudoku because AC4's tests are already present in test_csp.py * added map coloring SAT problems * fixed typo errors and removed unnecessary brackets * reformulated the map coloring problem * Revert "reformulated the map coloring problem" This reverts commit 20ab0e5. * Revert "fixed typo errors and removed unnecessary brackets" This reverts commit f743146. * Revert "added map coloring SAT problems" This reverts commit 9e0fa55. * Revert "removed useless doctest for AC4 in Sudoku because AC4's tests are already present in test_csp.py" This reverts commit b3cd24c. * Revert "added doctest in Sudoku for AC4 and and the possibility of choosing the constant propagation algorithm in mac inference" This reverts commit 6986247. * Revert "added the mentioned AC4 algorithm for constraint propagation" This reverts commit 03551fb. * added map coloring SAT problem * fixed build error * Revert "added map coloring SAT problem" This reverts commit 93af259. * Revert "fixed build error" This reverts commit 6641c2c. * added map coloring SAT problem * removed redundant parentheses * added Viterbi algorithm * added monkey & bananas planning problem * simplified condition in search.py * added tests for monkey & bananas planning problem * removed monkey & bananas planning problem * Revert "removed monkey & bananas planning problem" This reverts commit 9d37ae0. * Revert "added tests for monkey & bananas planning problem" This reverts commit 24041e9. * Revert "simplified condition in search.py" This reverts commit 6d229ce. * Revert "added monkey & bananas planning problem" This reverts commit c74933a. * defined the PlanningProblem as a specialization of a search.Problem & fixed typo errors * fixed doctest in logic.py * fixed doctest for cascade_distribution * added ForwardPlanner and tests * added __lt__ implementation for Expr * added more tests * renamed forward planner * Revert "renamed forward planner" This reverts commit c4139e5. * renamed forward planner class & added doc * added backward planner and tests * fixed mdp4e.py doctests * removed ignore_delete_lists_heuristic flag * fixed heuristic for forward and backward planners * added SATPlan and tests * fixed ignore delete lists heuristic in forward and backward planners * fixed backward planner and added tests * updated doc * added nary csp definition and examples * added CSPlan and tests * fixed CSPlan * added book's cryptarithmetic puzzle example * fixed typo errors in test_csp * fixed aimacode#1111 * added sortedcontainers to yml and doc to CSPlan * added tests for n-ary csp * fixed utils.extend * updated test_probability.py * converted static methods to functions * added AC3b and AC4 with heuristic and tests
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.
Uh oh!
There was an error while loading. Please reload this page.