Frequently Asked Questions 
(Project#1 - AI Programming)


Q. Could you give some examples for the results expected out of the unification of two AtomicExpression arrays ?

A. Example 1. Does this unify?
E1 = Brother(?x, Dan) ^ Brother(Joe, Dave)
E2 = Brother(Joe, Dave) ^ Brother(Stan, Dan)

Yes it does. ?x/Stan is the substitution. A common question which could arise:

Brother(?x, Dan) does not unify with Brother(Joe, Dave), which is the first
check I would make. I would in this case fail the unification, even though
Brother(?x, Dan) unifies with Brother(Stan, Dan) and Brother(Joe, Dave) unifies
with Brother(Joe, Dave). So the real question is, if ANY part of the
unification of E1 and E2 fails, does the entire unification of E1 with E2 fail?

No. You surely have to consider all options/possible combinations, since E1 and E2 may have multiple instances of a predicate in them. Hence EVERY unique predicate (of which there is only one, Brother, in this example) has to fail before the entire unification is considered to fail.

Example 2. Does this unify?
E1 = Brother(?x, Dan) ^ Brother(Joe, Dave) ^ Sister(Jane, Martha)
E2 = Brother(Joe, Dave) ^ Brother(Stan, Dan) ^ Sister(Kylie, Jen)

No.


Example 3. Does this unify?
E1 = Brother(?x, Dan) ^ Brother(Trevor, Sumit)
E2 = Brother(Stan, Dan) ^ Brother(Mike, Ted)

No.


Q. I Can't seem to get the source code provided for this project to compile ?

A. Putting all the files in a directory structure like <some directory>/ece479/projects/aiProgramming/ will do the trick. Then simply do "javac ./ece479/projecs/aiProgramming/*.java" or even "javac *.java" if you are in the aiProgrammming directory. As expected Unify.java won't compile since thats the file you need to make. Simply put a return statement (for the time being to get everything to compile) like "return new VariableSubstitutions();". Now from your "<some directory>" call "java ece479.projects.aiProgramming.UnifyTester" to run the program.


Q. Can I change the source code for the JAVA files provided for this project ?

A. No! Please do not make any changes to the provided JAVA files. This is because we will be using a standard set of files for all students while grading. If you make changes (add functions, variables etc.) which suit the logic of your program then it will complicate grading. On the other hand if you feel that some functionality is missing in the code we have given you (and it prevents you/takes extra time to code to solution), then please send an email to ece479@ece.arizona.edu about it.


Q. How do I use the provided aiProgramming.jar file ?

A. This archive does not contain the Unify and UnifyTester classes for obvious reasons. Hence these 2 files need to be downloaded and compiled separately. To make things simple you may remove the package statements from these files effectively making them package less (otherwise you will need the directory structure similar to that mentioned above). To get things to compile simply call "javac -classpath .:./aiProgramming.jar *.java".


Q. What do I need to turnin ?

A. Undergraduate students need to just turnin the completed "Unify.java" file. For graduate students there are some other java files. Please see the project specifications [PDF]. If for whatever reason you plan to turnin extra files, then please send an email explaining the same to ece479@ece.arizona.edu. There is no need to turnin the code which has been provided to you (since we already have it!!).


Q. Can I turnin Unify.java with an arbitrary package name ?

A. No! Either use the package name ece479.projects.aiProgramming or simply remove that line (making it packageless). Using arbitrary package names will complicate grading.


Q. How do I get the project configured in Eclipse ?

A. We cannot help students get the project configured in Eclipse. That said it is extremely easy and you may want to refer to some helpful links put up on the Class Software section of the class website.


Q. Can you provide some more coding hints/tips on getting this project done !?

A. Please take a special note of the overloading of "equals()" in all the classes. This should save you some time when making comparisons (not that the "toString()" functions are just for printing stuff to the console). The "instanceof" comparator will be useful too to find out whether something (an object) is say a variable or constant or predicate etc. Also the "getPredicate()" and "getElements()" functions in the AtomicExpression class should let you tear an atomic expression apart and implement the unify procedure. Also as you can see in the code it is perfectly legal to put a variable-variable mapping in the VariableSubstitutions class (using the "put()" function). A variable-constant mapping is also legal. For obvious reasons a constant-constant mapping is not allowed.


Q. I see a bug in the code provided. What should I do ?

A. Shoot an email to ece479@ece.arizona.edu so that the bug can be resolved.