Q1
I was just wondering if its ok to work on the assignments with people from
other sections?
A1
You can work on the assignments with students from any section,
but the number of people in a team must be less than or equal to 3.
Q2
I was wondering where I can find the slides/handouts you were using in class.
A2
Take notes in class: write down the most important definitions and ideas.
The copies of all slides are posted on my.torontomu.ca in
the Course Documents folder. It is recommended to review slides after each class.
Q3
I was wondering if you want us to buy both textbooks, and if so, do
you have some sort of recommended readings/chapters for each book that
relates to this course, or do you expect us to read the entire books?
A3
As we mentioned in class, you have to read only Hector Levesque's book.
From time to time, we recommend chapters from his book that you have to read.
The recommendations are posted in the Documents folder on my.torontomu.ca
together with the links to PDF files with slides. If you would like to
read more about AI or if you feel you need extra reading, you might wish
to browse another recommended book as a supplementary reading.
But this is not required. In particular, the university bookstore has
copies of Russell and Norvig's book. Note that some sections of their book
assume that the reader has a certain level of mathematical maturity.
If you really would like to learn more about AI, then you might wish to browse
some of the suggested extra-curriculum materials,
but this is not required.
Q4
Can we use the symbol ";" (OR symbol) in the bodies of our rules?
A4
No, you are not allowed to use ";" and you also are not
allowed to use commands "->" and "!" when you work on your assignments.
Note that any rule with disjunction OR (i.e., with ";") in its body
can be written as a couple of rules with the same predicate
in the head, but with one disjunct per body.
Q5
Can we use anonymous variables in our queries?
A5
No, to avoid confusion, use named variables only to formulate queries,
as it was discussed in class. Recall when we discussed the back-chaining algorithm,
it is defined for named variables only.
Q6
Part1: are the predicates
hasAccount(Person,Bank,Amount), lives(Person,City),
created(Person,Bank,Month,Year)
the only predicates we are supposed to use? Can we add our own predicates?
For question (3) where it asks for an account with Bank of Montreal and
Scotiabank can we invoke a query that includes someamount
with a number say 100.
A6
(1) No, you cannot introduce any new predicates in your queries.
Formulate your queries using the predicates given to you.
(2) Read your lecture notes: pay attention where we use
variables (that start with a capital letter), and where we
use constants (that start with a lower-case letter).
Also, the amount can be anything, you have to express this
in your query, i.e., you cannot use a particular number.
Q7
In the Assignment 1 it is requested to develop a ``KB with at least 10 different people". Could you please clarify, should it be 10-15 atomic
sentences only about bank account, e.g. hasAccount(Person,Bank,Amount),
and then in this case we need 10-15 of lives(Person,City) and
created(Person,Bank,Month,Year) or
should it be 10-15 in total of atomic sentences?
A7
The 1st assignment is somewhat flexible regarding the number
of atomic statements. You are supposed to write
at most 15 atomic statements using each predicate, but it is
also fine if you include, say, 10 atomic statements with each predicate
(i.e., 30 in total). Actually, you can write a different number of
statements for different predicates (say, less than 10 statements with
the predicate lives(Person,City) ). You will not be penalized for
doing this. I would say that you should type at least 15-20 atomic
statements in total. The TA who will mark your assignment will check
(1) that you have a reasonable number of atomic statements,
(2) that all your queries are correct (this is the most important in Part1), and
(3) that answers you are getting from Prolog correspond exactly to
those atomic statements that you typed in.
You are expected to learn from Part1 how to translate queries from English
to Prolog, how back-chaining and back-tracking work together, and what
answers your queries will retrieve from your KB, depending on what you
include in your KB.
Q8
How can we find a person who has the oldest account. Can we use rules?
Can we use lists ?
I tried to type :- in the query field, but this did not work.
A8
In Part 1, you are not allowed to use any rules or lists.
You can type in atomic statements only. Then, you have to express
English queries in Prolog as precisely as you can. (If your predicates
have extra variables that retrieve irrelevant data, it's ok.)
In queries, you can use given predicates,
operator AND (represented by ",") and not.
You cannot use ";" and you cannot use rules. Please note also that
the number of atomic statements in an actual KB can potentially be arbitrary,
i.e., your query should successfully find the oldest account
no matter whether there are 2 accounts at BMO or 2000 accounts at
BMO. In any case, note that a query finds an account at BMO,
AND, moreover, such account that it is the oldest one.
These last 2 questions may require some thinking. In terms of
overall strategy, it is better for you to complete the remaining
questions in the assignment, and once they have been completed, if time permits,
you can think a bit more about the last two questions from Part 1.
Q9
We are getting repeated answers to our queries. Is it ok?
A9
Yes, this is fine. There are advanced techniques to get rid of repetitions.
In cps721, we do not study those advanced features of Prolog.
Q10
I was just wondering as to how we have to submit our first assignment.
Does each member of the group upload
each file or is there a single submission per group?
A10
You have to upload only 1 ZIP file per group electronically on D2L.
Write names and student numbers of all members from your group in each file.
Read the 1st page of the assignment. All instructions are there.
Follow them exactly to avoid penalties. Read each question for more
specific instrcuctions wehre you have to place your code in the provided template.
Q11
For the assignment, you have mentioned that we must work in a group of 2-3, but
I do not know any other students in the class. I am just wondering if you can
help me out in this situation.
A11
Visit Communications/Groups on D2L, and self-enroll into any available group.
If you'll decide later to change your group, you can quit from one group,
and then self-enroll into another group. Read carefully
the CPS721 policy on collaboration: you can discuss your assignment
only with your group partners, but not with outsiders.
Otherwise, you may get a penalty: see the CMF.
Q12
Since we aren't allowed to use anonymous variables in our queries,
are we allowed to use random variables such as I etc.? The problem is
when we use it, it still outputs the balance that we did not intent to request.
If you could help us or point us in the right direction, that would be great.
A12
You are not asked to use random variables. I understand you would like
to say that you are using arbitrary named variables in some queries.
If you mean that your query returns extra values not explicitly
requested by your query, this is ok. There is no need to suppress them.
The TA will check only if logical structure of your query is correct, and
whether it returned what it should be returning according to your KB.
As for your example, recall you never need equality without negation,
e.g., there is no need to include X=X in any query. All variables are
local in a query and each variable has same value everywhere in the query.
Q13
I was wondering if in Part 1 in the assignment for questions like
"Did anyone open 3 different accounts in 3 consecutive years"
the query needs to return a specific value right the way or
it's ok to determine it by the number of results we see?
A13
Your Prolog query must be a correct rendering of the meaning of an
English question. You get marks in Part 1 depending on how correctly and
completely you expressed the logical meaning in Prolog. In the example you
mentioned, the query must return the correct results right away. Of course,
for this to happen, design your KB in such a way that your query can
retrieve some values (e.g., names of people) instead of just saying "no".
Q14
I am currently solving the first assignment and have come to the
following question on part 1:
"11. Who has the largest account ..."
Did you want us to provide
a solution for this question in terms of a simple query only?
without having, let's say, non-atomic statements in our KB?
The reason I ask is because finding the minimum (or max) value of a list
of possible values usually involves some kind of aggregate function that
iterates over all possible values and I'm having a little bit of a hard time
trying to figure out a solution that only involves simple queries and
a KB that only has atomic statements. Backtracking/backchaining should
be able to care of this or did I misread the instructions?
A14
Yes, backtracking/backchaining alone should be able to take care of this,
no matter how many statements are in a KB. Each query should be similar
to what we discussed in class and should have a relatively simple
structure. You cannot use any conditional statements (rules) in KB in Part1.
You are not allowed to use lists in this assignment.
This query can be expressed using only techniques for queries discussed
in class. Think carefully about reformulating this query in logically
equivalent terms so that reformulation can be expressed in Prolog directly.
Q15
i'm trying to use the Moon computers to access the ECLiPSe Prolog
program for our assignment 1. But when i try to type the command "tkeclipse &"
or /opt/ECLiPSe/bin/x86_64_linux/tkeclipse & in my terminal, it does not
display anything. However, I can run a command-line version as
/opt/ECLiPSe/bin/x86_64_linux/eclipse
How can I run tkeclipse on moon Linux machines?
A15
If you would like to verify from home whether your Prolog code runs on Linux
before you submit it, then login to any moon Linux server as
ssh -X -l yourLoginName moon.cs.torontomu.ca
Notice the option -X that does X-Windows forwarding:
read manual pages for ssh. You can also use -Y for similar purposes.
From moon, you should be able to run Prolog as
/opt/ECLiPSe/bin/x86_64_linux/tkeclipse & or /opt/ECLiPSe/bin/x86_64_linux/eclipseAll other instructions about running Prolog in labs are posted at
Q16
I had a question about assignment1 part 2(b):
"Add rules to q2_bank_calc.pl that accomplish the following" means we write conditional statements, right?
A16
Yes.
Q17
I have a question regarding Assignment 1, Part 1, Q11:
Who has the largest account (ie. highest balance) created in 2010 or
later, of anyone who lives in Toronto
What does the largest amount mean?
A17
Your query must find a person with the max balance in an account.
Q18
I'm having a bit of trouble getting the conditional statement for
... in Assignment 1, question 2. I've been trying
multiple things, but I can't seem to get it to work, and I'm getting
more confused. (... skip code and text ... ) Would you be able to help me
go in the right direction? I've attached my code to this email.
A18
I'm sympathetic to the efforts that you are making,
and I know that learning is not always an easy process.
However, I never debug programs of CPS721 students, and
I do not comment what exactly is wrong, if they email me
code of their homework.
The reason is that the CPS721 students are upper-level CS
students, and very soon you will be working for a company,
where you will be expected to complete a given task yourself.
Q19
A19
Q20
A20
Q21
A21
Q22
A22
Q23
A23
Q24
A24
Q25
A25