Ok so I wrote and update function update :: Node -> [Node] It takes in a Node and returns a list of the Nodes that result from assigning True to an unassigned atom in one case and False in the other (ie. a case split). The list returned has two nodes as elements. One node contains the formula with an atom assigned True and the model updated with this assignment, and the other contains the formula with the atom assigned False and the model updated to show this. The lists of unassigned atoms of each node are also updated accordingly. This function makes use of an assign function to make the assignments. It also uses the chooseAtom function to select the literal to assign. update :: Node -> [Node] update (formula, (atoms, model)) = [(assign (chooseAtom atoms, True) formula, (remove (chooseAtom atoms) atoms, ((chooseAtom atoms,True)) `insert` model)) , (assign (chooseAtom atoms, False) formula, (remove (chooseAtom atoms) atoms, ((chooseAtom atoms, False) `insert` model)) )] Now I have to do the same thing but this time I must implement a variable selection heuristic.this should replace the chooseAtom and I'm supposed to write a function update2 using it type Atom = String type Literal = (Bool,Atom) type Clause = [Literal] type Formula = [Clause] type Model = [(Atom, Bool)] type Node = (Formula, ([Atom], Model)) update2 :: Node -> [Node] update2 = undefined So my question is how can I create a heurestic and to implement it into the update2 function ,that shoud behave identical to the update function ? |