Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate2,Haskell
    primarykey
    data
    text
    <ol> <li>Atom: The Atom is the datatype used to describe Atomic Sentences or propositions. These are basically represented as a string.</li> <li>Literal: Literals correspond to either atoms or negations of atoms. In this implementation each literal is represented as a pair consisting of a boolean value, indicating the polarity of the Atom, and the actual Atom. Thus, the literal ‘P’ is represented as (True,"P") whereas its negation ‘-P’ as (False,"P"). 2</li> <li>Clause: A Clause is a disjunction of literals, for example PvQvRv-S. In this implementation this is represented as a list of Literals. So the last clause would be [(True,"P"), (True,"Q"), (True,"R"),(False,"S")].</li> <li>Formula: A Formula is a conjunction of clauses, for example (P vQ)^(RvP v-Q)^(-P v-R). This is the CNF form of a propositional formula. In this implementation this is represented as a list of Clauses, so it is a list of lists of Literals. Our above example formula would be [[(True,"P"), (True,"Q")], [(True,"R"), (True,"P"), (False,"Q")], [(False, "P"), (False,"P")]].</li> <li>Model: A (partial) Model is a (partial) assignment of truth values to the Atoms in a Formula. In this implementation this is a list of (Atom, Bool) pairs, ie. the Atoms with their assignments. So in the above example of type Formula if we assigned true to P and false to Q then our model would be [("P", True),("Q", False)]</li> </ol> <p>Ok so I wrote and update function</p> <pre><code> update :: Node -&gt; [Node] </code></pre> <p>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.</p> <pre><code> update :: Node -&gt; [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)) )] </code></pre> <p>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</p> <pre><code> type Atom = String type Literal = (Bool,Atom) type Clause = [Literal] type Formula = [Clause] type Model = [(Atom, Bool)] type Node = (Formula, ([Atom], Model)) update2 :: Node -&gt; [Node] update2 = undefined </code></pre> <p>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 ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload