Each call to the function solve is one decision level. Take a look at the
pseudocode for solve(). Each decision level will include the deductions,
and a guess of the next unassigned variable. So, for example:
dec level 1: x1 = 0
dec level 2: x4 = 1, x5 = 0, x2 = 0
dec level 3: x3 = 0, x6 = 1
And also, say for example that the decisions in level 3 lead to a
conflict, so you backtrack to level 2, which means that you remove the
assignments made in level 3 and are left with the assignments of level 1
and 2.
Take a look also at the given functions getNextVar() and backTrack() to
get a better idea of how the structures are supposed to be used.
The reason for also having solver->variables is so that you have all the
assignments in one neat little place. Because if you were to use the stack
to get the assignments, you'd have to loop through an array, and then go
through a linked list to get the values. If you use solver->variables,
it's just a one-dimensional array. Again, take a look at how they wrote
backTrack(), and you'll see how the stack and solver->variables work
together.
HTH,
Diego
Date: Mon, 16 Feb 2004 00:29:32 GMT
Newsgroups: ut.ecf.ece242
Subject: Lab 3
Hi
I am not sure what does Lab 3 mean by DECISION LEVEL ?
Also I am wondering what's the use of assignstack if we have
solver->variables to store the values assigned to variables, and how does
this assignStack works??
Can some T.A. please help me.
Thanks