Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erohkohl/n-queens-sat
Modelling n-queens problem as conjunctive normal form and solving it with DPLL algorithm. This project should made me familiar with Rust and the test driven approach.
https://github.com/erohkohl/n-queens-sat
constraint-programming constraint-satisfaction-problem dpll-algorithm n-queens rust rust-lang sat-solver tdd
Last synced: 1 day ago
JSON representation
Modelling n-queens problem as conjunctive normal form and solving it with DPLL algorithm. This project should made me familiar with Rust and the test driven approach.
- Host: GitHub
- URL: https://github.com/erohkohl/n-queens-sat
- Owner: erohkohl
- Created: 2017-06-24T18:30:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T19:00:58.000Z (over 7 years ago)
- Last Synced: 2024-05-22T22:33:07.863Z (6 months ago)
- Topics: constraint-programming, constraint-satisfaction-problem, dpll-algorithm, n-queens, rust, rust-lang, sat-solver, tdd
- Language: Rust
- Homepage:
- Size: 16.3 MB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - n-queens-sat - modelling n-queens problem as conjunctive normal form and solving it with DPLL algorithm. (Unclassified / Libraries)
README
Modelling n-queens problem as propositional formula and solve it with DPLL
------------
[![Build Status](https://travis-ci.org/erohkohl/n-queens-sat.svg?branch=master)](https://travis-ci.org/erohkohl/n-queens-sat) [![codecov](https://codecov.io/gh/erohkohl/n-queens-sat/branch/master/graph/badge.svg)](https://codecov.io/gh/erohkohl/n-queens-sat)This project provides a simple implementation of the *Davis, Putnam, Logemann* and *Loveland* algorithm
(see [DPLL](https://en.wikipedia.org/wiki/DPLL_algorithm)) in the modern systems programming language
[Rust](https://www.rust-lang.org/en-US/). The DPLL algorithm decides whether a propositional
formula in *conjunctive normal form* (CNF) is satisfiable and returns a satisfiable assignment. Therefore it extends the
depth first search with *unit propagation* (UP), if a literal must be true in the current partial assignment. You
can find my implementation of the DPLL algorithm in the Rust-file
[src/logic/sat.rs](https://github.com/erohkohl/n-queens-sat/blob/master/src/logic/sat.rs). Furthermore the file
[src/model/n_queens.rs](https://github.com/erohkohl/n-queens-sat/blob/master/src/model/n_queens.rs)
contains the modelling of the n-queens problem as propositional formula. The following listing shows one possible
solution of the four-queens problem.```bash
. Q . .
. . . Q
Q . . .
. . Q .
```This implementation is not able to solve six-queens problem in acceptable time, because it's
data structures and UP is not fast enough.#### Future work
- Improve performance of UP and data structures to solve eight-queens problem in appropriate time
- Add *Conflict-Driven Clause Learning* (see [CDCL](https://en.wikipedia.org/wiki/Conflict-Driven_Clause_Learning))
to DPLL algorithm