Skip to content

flammel/rustasata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustasata

From https://baldur.iti.kit.edu/sat/files/l07.pdf

boolean DPLL(ClauseSet S) {
    α = ∅, Trail = new Stack()
    while (not all variables assigned in α) {
        if (unitPropagation(S, α) = CONFLICT) {
            L = the last literal in Trail not tried both True and False
            if (no such L) return UNSATISFIABLE
            α = unassign all literals after L in Trail
            pop all literals after L in Trail
            α = (α \ {L}) ∪ {¬L}
        } else {
            L = pick an unassigned literal
            add {L = 1} to α
            Trail.push(L)
        }
    }
    return SATISFIABLE
}

boolean CDCL(ClauseSet S) {
    α = ∅, Trail = new Stack()
    while (not all variables assigned in α) {
        if (unitPropagation(S, α) = CONFLICT) {
            analyze the conflict which gives us:
            - a new learned clause C, S = S ∪ {C}
            - if C = ∅ return UNSATISFIABLE
            - a literal L in the Trail to which we backtrack
            update α and Trail according to L
        } else {
            L = pick an unassigned literal
            add {L = 1} to α
            Trail.push(L)
        }
    }
    return SATISFIABLE
}

About

A SAT solver in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published