Skip to content

Instantly share code, notes, and snippets.

@KarenWest
Created March 19, 2013 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KarenWest/5195611 to your computer and use it in GitHub Desktop.
Save KarenWest/5195611 to your computer and use it in GitHub Desktop.
AI Class Homework #2 Question #1 - questions about problems I got incorrect
Here is my first question on Homework #2 Problem #1 and I did the worst on question #1 (where I got the most parts incorrect).
Part 1: Unary Constraints:
My incorrect answer was: (i), (iii), (iv), (v), (vi)
Domains after unary constraints:
A: (1,1), (1,3), (2,2), (2,3)
B: (1,3), (2,3)
C: (1,1), (1,2), (1,3), (2,1), (2,2)
D: (1,2), (2,1)
Part 2: Arc consistency
Was correct in choosing the correct domain as choice (ii) for the A and B domains, but the following was wrong in the domains of A,B.C.D after enforcing A->B.
A: (1,3), (2,3)
B: (1,3), (2,3)
C: (1,1), (1,2), (2,1), (2,2)
D: (1,2), (2,1)
After enforcing C->B:
A: (1,3), (2,3)
B: (1,3), (2,3)
C: (1,1), (1,2), (2,2)
D: (2,1)
Arcs added to queue enforcing C->B:
C->A C->B
Domains of all variables after enforcing arc consistency until queue is empty:
A: (1,3), (2,3)
B: (1,3), (2,3)
C: (1,1), (1,2), (2,2)
D: (2,1)
Part 3: Search with Arc Consistency:
Was correct that the variable that gets assigned next was choice B.
Was also correct that the value with the largest number of values remaining and therefore the least constraining value
was (2,3).
Domains of values after assignment of least constraining value to variable and enforcing arc consistency.
A: (1,3), (2,3)
B: (1,3), (2,3)
C: (1,1), (1,2), (2,2)
D: (2,1)
My solution for this CSP was correct: A: (1,3) B: (2,3) C: (2,2) D: (2,1)
That's it for Homework #2 Question #1. I will wait and see what response I get for this question before asking any remaining questions on other problems. The other questions I got incorrect were (will provide details later if this goes well): Question #2 Parts 2 and 3, Question #4, Question #5 Part 1. Everything else was correct. Thank you for encouraging me to ask my question!
(copied and pasted from the AI class discussion forum, after discovering the use of gist for asking specific homework questions)
@CSTDev
Copy link

CSTDev commented Mar 19, 2013

Hi Karen,
Not sure if any of your questions have been answered but just seen your fb post so thought I'd try to help here::

Part 1: Unary Constraints:
My incorrect answer was: (i), (iii), (iv), (v), (vi)

Nearly there, think about what a unary constraint is "Unary constraints involve a single variable (equiva
lent to
reducing domains), e.g. SA is not equal green"

So which constraints only involve the variable and a domain (no other variables are mentioned in them)? Then give the table another go, it looks like you know what you're doing there but you just got the first part wrong.

Part 2:

For the first table look at what domain was lost in the bit you got right, and just remove that domain from the table.

For the second table, look at the constraint that affects both C and B (so ii). If C has to be adjacent to B, look at the possible domains for B, and then for each of those try the domains of C, if any of them don't work with the constraint then remove them.

I'll have a think about how to explain the others if you need it. If anything doesn't make sense let me know.

@KarenWest
Copy link
Author

This goes to pietomb who responded yesterday (thank you!):

I'm in the process of redoing my unary constraints, arc consistency and search with arc consistency problem from last week's homework.

I have not yet entered my answers to know if they are correct but given I got this part correct last time, I know it is correct, and I still have a question on it.

Why in question #1 part #2 on arc consistency, when you enforce arc consistency on A->B, do you remove coordinate (1,1) and not (1,3), since in the domains of A and B, coordinate (1,1) does not overlap with A and B domains, but (1,3) is in both domains, so I would have thought conflicted (remove that one since they both cannot have that value). Yet the correct answer is remove (1,1).

Given I'm falling behind already in this class, I'll have to see whether or not to stick with it -- we'll see how it goes! Thanks for your help. ;-)

@KarenWest
Copy link
Author

I've decided that if the AI class is mostly like the arc consistency domain questions of homework #2 questions #1 and #3, I will most likely drop this class!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment