CS2710 - The TA Page

Course homepage

Check out the course homepage for vital information and assignments! Course homepage is the authoritative source, this one is just trying to be helpful. Check this page often though, because I post answers to questions mailed to me here so that everybody has equal information.

Additional readings

This page will be supplemented often with additional reading for topics discussed.

readings

Announcements

Homework 8

Additional explanation on counting sums and products

Homework 7

Question: For Hw7, prob1, part c: Why is On(C,Table) not part of the state definition? If C is not already on B (which it can't be because the goal state has not yet been reached), where else could it be but on the table?

Answer: you are thinking like a human. Your reasoning is correct, but a STRIPS planner is not capable of such reasoning! And indeed, why limit ourselves to a (potentially) smaller set of goals? The goal that says On(C,z) subsumes On(C,Table) and we want to keep that generality. There is only one realization of On(C,z) for the toy problem at hand, but in a different configuration this would be limiting:

Consider goal On(B,C) in a world with blocks A,B,C,D. ( For concreteness, you can imagine On(A, Table), On(C, Table), On(B, Table), On(D,B). ) All we care about is that B be on C in the goal. We don't care whether C is on A or on the Table or on D. So our goal is Clear(B) and Clear(C) and On(B,z), saying nothing about the position of A and D. There are many states from which you can reach On(B,C) and they are captured by the use of the variable z.

Folks,
make sure you understand the notation. P(X=T) is probability of encountering a case where the variable X takes on the value T. Do not mistake this for P(X). It may be tempting (and in fact sometimes people do it, but they'd better have made the notation explicitly clear and it is prone to error ) to interpret P(X) as the probability of X being True, but this is wrong. P(X) is a TABLE of probabilities, for all values that it can take on, as opposed to P(X=T), which is a number. Please embrace this typed-language metaphor. An example:
P(X) =
P(X=T)0.23
P(X=F)0.77
T and F just happen to be the values, but they are just that and carry no further meaning. In fact, there is nothing in the assignment to suggest that they should be interpreted as True or False. Think of this to test your understanding:

  • P(X=1|Y=2) is a single number.
  • P(X|Y,Z) is a 3-dimensional table.
  • P(X=6|Y,Z) is a 2-dimensional table.
  • P(X=T|Y=2,Z,W="NorthEast") is a 1-dimensional table.
The number of dimensions is the number of unassigned variables in the P() formula.

Question:

>> For #1, Part A we need to write two STRIPS operators.  For put-on(x, y)
>> for example, x is being moved on to y.  This is fine, but what about any
>> block that x was already sitting on (say block z).  You would need to
>> delete on(x, z).  Is it ok to use this although z is not explicitly given
>> as an argument to the operator?
z is not an argument to the operator, but if you think about how the STRIPS operators are translated into first order logic, you will realize that using the variable z in the precondition of the operator achieves the effect you desire.

Question:


>> For #2, Part C I am able to derive a POP that can move either the apple or
>> the orange, but I have no way of deriving Go(Room2, Room1) which is needed
>> in order to go back and retrieve the other object.  How can I determine
>> where I would insert this step?  The examples in the notes and the book
>> did not really cover a situation like this.  Thanks
Answer:

You find yourself in a situation where (for instance) you have Orange in the Room1 and Apple and Robot in Room2. That is, you have two "Go" actions.

Here is my hint: Think about the search process as one of resolving "flaws" in the partially constructed plan. A flaw is either an open condition (precondition not satisfied) or a conflict (operation removes a necessary precondition of another). There are TWO ways of resolving an open condition O: 1) Connecting it with a step already in the partial plan that achieves O, or 2) Adding another action that achieves O.

I'd go with the second option. Make sure to resolve the resulting conflicts properly!

Homework 5

> Hello Tomas,
>
> I have been doing HW6, but I have some questions about the section the situation calculus section:
>
> b. Write a suitable logical query whose solutions will provide possible paths to the goal.
>
> Logical query = goal ?

Logical query will be something like
"is there a sequence of actions that will result in a goal state if executed from the initial state?"
and therefore takes on a form of an existentially quantified logical formula

>
> e. Describe the initial situation, and write a new rule or rules describing the Go action.
>
> Can we define something like "MaxCapacity(AgentX)" so that it can return the maximum fuel capacity
> of the agent. That will allow us to define things like:
>
> at(AgentX, Arad, S0) ^ has_fuel_level(AgentX, MaxCapacity(AgentX), S0)
>
> Where has_fuel_level(X,Y,S) means AgentX has a fuel level = Y in state S

Sure, you have the liberty to define suitable functions and predicates as you please, just attach
a short description if the meaning is not totally obvious.

>
> Also, is it allowed to define constraints in this way?
>
> ... ^ has_fuel_level(Ag, Z, S) ^ Distance(Y,X)<=Z ^ ...
>

What do you mean by constraint? A formula like the above would appear in the
precondition of an effect axiom. I think that is what you mean by 'constraint'.

> In order to apply the FillUp action, the tank of the Agent HAS to be empty? Or it is enough
> for it to have a fuel level <MaxCapacity(AgentX)?

I would say the latter.

>
> Thanks in advance 

You're welcome.

Homework 4


Carol,

    there had been confusion in the past as to the number of plies.
    +-1 will not matter for the grading. It is just a matter of convention.
    I'd go for fewer plies myself because it will save time debugging
    and evaluating.

    Yes, you have the right idea about using the heuristic.

    The programs we gave you are incredibly dumb. They just return
    some random position.

    There is no way to give the sequence you want. There are many
    correct implementations. Much depends on the order in which
    you generate children of the node. There will be several moves
    that yield the same minimax value at each step and each of these
    is "correct".

Tomas


cln23@cs.pitt.edu wrote:

>Hi Tomas,
>I just have some questions about the 10x10 tic-tac-toe game we have to
>write for homework 4.
>
>When the assignment says to search until k=2, am I correct in thinking
>that this consists of 1 player X turn maximizing the heuristic (k=1) then
>1 player O turn minimizing the heuristic (k=2)? or is there another
>decision there, i.e. player X max (k=0) player O min (k=1) player 1 max
>(k=2)? Likewise, would k=3 be 3 turns or 4?
>
>To use eval, do I just need to place the two (or three, depending on
>answer to question above) symbols in some place then call eval(board),
>then change those symbols back to '_' to try another position? is this the
>correct usage of this function?
>
>When I run two players against each other with what I have for part a,
>they seem pretty stupid. I don't think my program is right, but how stupid
>are they supposed to be? Is there any way you could give the correct
>sequence of moves for one of the boards if a minimax implementation is
>done correctly and played against itself?
>
>Thank you,
>Carol
>

Homework 2

Solution to Problem 2.

  • Bidirectional * is complete. Even if the "backward" direction does not find the goal, from the completeness of unidirectional A* it follows that the "forward" direction will find it eventually if it exists.
  • Bi-A* is not optimal. A poor (although admissible) heuristic may lead the searches so that they meet in a node and the search is terminated before they meet in a node on an optimal path. To convince yourself, try to trace bi-A* on the following graph. (eps)

Question:

	In homework 2, are we allowed to assume cyclical redundancy 
	elimination for our handwritten part?  (if not the trees grow really huge).
	
Answer: They are not THAT big... you can draw the biggest of them in 10 minutes on a sheet of paper... Note we don't ask you to submit the tree drawing, just the order of nodes expanded. In fact, you don't have to draw the tree at all, just simulate the execution of the algorithm on paper, stopping when you reach the goal for the first time.

Question:

    I've been working on the IDA* algorithm for homework #2, and kept getting
    bogus results until I realized that the "initialize_search_tree" function
    in "search.c" does NOT initialize the f and h values of the root node!
    Hence, when you check the root node to see if it should be expanded (i.e.,
    if the f value is less than your cost limit), the answer is nonpredictable.
    There are two solutions - 1) don't run your f value check on the root node
    (just always expand it), or 2) modify the search tree initialization to initialize
    the h and f values on the root. I did the former to avoid modifying any provided code,
    but you might want to tell the rest of the class to watch out for this.
    
Answer: Thanks for sharing. I fixed the code. Again, good OO thinking. Unfortunately, such are the woes of hotfixed legacy code. However, there is a third solution to the problem: Don't think object-oriented, think functional! And call f_function(node) to check the node's f_value instead of looking at node->f_value.

Homework 1

Check page 106 of the book for discussion of "effective branching factor". It differs from (just) "branching factor".

Question: The code prints the length of solution path!?

Answer: Free stuff! Don't you like free stuff?

Question:

- The maximum length of the queue structure

	I was thinking of modifying the "list_of_nodes" structure 
	so that it can maintain in "real time" the number of nodes
	in the queue and also modify add_to_list_front and remove_first_from_list 
	so that they can maintain this information. Are allowed to do that?
	
Answer: I would prefer that you keep those in variables local to the search routine, so that your changes are not scattered around the code. Good object oriented thinking though.

All homeworks

Please please place all your source programs in one directory. tar (or zip) the files in the directory where you created them. My grading scripts are not very intelligent and get thrown off by directories created by untarring the submissions. If you know how to force tar to ignore directories, please let me know.

image: decorative

Office hours

The official office hours are T10-11:30, H3-4:30. Of course you are welcome to come almost any time I am in the office. To make sure I am available, send a mail or call 4-9182.

Assignments FAQ

Assignments are to be submitted according to these instructions via FTP.