Assignment 3 FAQ
Running Time
Q. I think my program is correct but it takes minutes to solve N-queens
for N=8 and hours when N=10. I am sure that your automatic testing
will not wait hours for my solution. What should I do?
A. We will test your sat solver on a variety of small and large CNF formula. We will test your N-Queens CNF on our sat solver which works fast enough to check its correctness also for larger N. We expect your sat solver to manage to solve the CNF for N-queens for at least N=8 in less than 10 seconds. We might decide to test it even for larger values of N.
The bonus tests will be on much larger values of N.
published on 05/01/2009 22:48:42 by intro091
Can you help me with tasks 7,8 ?
The forum is full of technical answers. But try to think of it this way:
- You have a set of propositional variables (represented by an array of integers). Lets
call these variables v1,v2,
,vn. Each variable can be either "true" or "false".
- Your task7 is to express as a CNF formula the statement: at least one of v1,v2,
,vn is true. Try to
think which formula (in CNF) makes this statement.
- Your task8 is to express a CNF formula which says that not more than 1 of the variables
v1,v2,
,vn is true. Or in other words that it is not possible for two of them to be true. It means
that for every two variables
and
at least one of them is not true. This is a conjunction on all pairs (i != j) where for each pair we say that either
is false or
is false (otherwise there would be two variables true).
- Note that if phi1 expresses that at least one of the variables v1,
,vn is true and phi2
expresses that at most one of them is true then the conjunction of phi1 and phi2
expresses that "exactly one of the variables is true". Use this idea to solve task 9.
published on 04/01/2009 12:57:36 by intro091
Can we use the return statement in the middle of a function?
No.
Please use only one return at the end of a function.
published on 29/12/2008 21:25:41 by intro091
Will sorting clauses in phi will be considered as changing the original phi? do I need to copy phi so I 'll be able to sort clauses in it?
You did not mention which function (task) you are inquiring about, but phi should not be changed in any task.
Notice that a new "phi", let's call it phi2, that is also an array of arrays, can hold references to the clauses in the original phi, in a different order.
Thus you did not change phi, and did not copy it all.
As you can see above, if you want to change the order of the clauses in phi, you do not need to copy all the literals in the clause, you can just copy the reference to the clause.
For example:
- int[][] phi1 = {{1,2,3},{-4,-7},{3}};
- int[][] phi2 = new int[3][];
- phi2[0] = phi1[2];
- phi2[1] = phi1[1];
- phi2[2] = phi1[0];
published on 28/12/2008 15:41:28 by intro091
What are we supposed to do in Tasks 7 and 8? They seem too easy, maybe I did not understand them? Can you give another example?
In tasks 7 and 8 you should return a legal CNF, according to the task description.
Yes, task 7 is quite simple, and task 8 is slightly more complicated. The "Coaching" part of the tasks is very detailed, and the example is pretty clear, so it should not be very difficult to understand and implement them.
Giving another example is giving away the whole task. You should understand from the task description.
Yes, task 7 is quite simple, and task 8 is slightly more complicated. The "Coaching" part of the tasks is very detailed, and the example is pretty clear, so it should not be very difficult to understand and implement them.
Giving another example is giving away the whole task. You should understand from the task description.
published on 25/12/2008 15:35:33 by intro091
Can we use things not taught in class, like java's built-in function to copy arrays? We were told we can read and use Java API....
Generally, we ask you not to use Java elements not taught in classes or practical sessions. In some cases, we may not take points off for doing this (like if you use "i++" instead of "i=i+1" command).
It is very good you are reading through Java's API, and it is ok to use some functions we did not teach, like
; but you are not allowed to use the functions that create/copy arrays, or use Objects like Array or Vector.
It is very good you are reading through Java's API, and it is ok to use some functions we did not teach, like
; but you are not allowed to use the functions that create/copy arrays, or use Objects like Array or Vector.
published on 25/12/2008 15:17:24 by intro091
Legal CNFs?
Q:
Can we assume that a variable will not appear more than once in any single clause? Can we assume that a variable and it's opposite (e.g. x1 and ~x1) will not appear in the same clause?A:
We will not test your program for examples that have twice x1 or both x1 and -x1. So if you like to make this assumption, you may.Q:
in Task 4 (substitute): can we assume that there are no empty clauses? if not, what does the function return in that case?A:
No, you may not make this assumption. You are free to return any CNF representing the formula
Q:
in Task 4: what does it return in case phi itself is empty?A:
Think about it.
published on 22/12/2008 17:25:27 by intro091
When you say "Java method" in the assignment description, do you mean "Java function" ?
Yes.
published on 20/12/2008 11:11:43 by Intro091
Can you publish a Hebrew version of the assignment?
No.
published on 17/12/2008 13:56:02 by intro091
