Charles Gretton
Let \(\alpha\) be an truth assignment for \({\cal P}\)
We write \(\alpha \models x\) if \(\alpha\) satisfies expression \(x\)
Given expression \(x\) determine if \(\exists \alpha\) s.t. \(\alpha \models x\)
A literal is a proposition \(p\) or its negation \(\overline{p}\)
A disjunctive clause is a disjunction over literals - e.g. \((p_1 \lor \overline{p_3} \; )\)
Conjunctive Normal Form (CNF) expression is conjunction of disjunctive clauses:
DIMACS CNF | Interpretation/Expression |
---|---|
|
\(\begin{array}{l} \text{CNF problem with 3 propositions and 2 disjunctive clauses}\\ (p_1 \lor \overline{p_3} \; ) \\ \land (p_2 \lor p_3 \lor \overline{p_1} \;) \end{array}\) |
\({NP}\)-complete
- Generally below approaches have exponential worst case runtime
Approach | Optimisation | Complete | Syntactic | Gist |
---|---|---|---|---|
Resolution | ✘ | ✓ | ✓ | Inference |
SLS | ✓ | ✘\(^1\) | ✘ | Local Search |
DPLL | ✘ | ✓ | ✘ | Systematic Search |
CDCL | ✘ | ✓ | ✘ | DPLL with Inference |
The Rule:
\(\begin{array}{c} \text{premise, admits resolving on}\;p \\ \hline \textsf{resolvant}\; \text{is a new disjunctive clause} \end{array}\)Example:
\(\begin{array}{c} (x \lor p) \land (\overline{p} \lor y) \\ \hline (x \lor y) \end{array}\)Proof of \(\nexists \alpha\) s.t. \(\alpha \models x\)
\(\circ\) Let \(x\) be a CNF; Write \(c_i\in x\) for clause \(c_i\) in \(x\)
\(\circ\) \(c\land c'\vdash_R c_R\) says \(c_R\) is a resolvant of \(c\) and \(c'\)
\(\circ\) \(\pi = \langle c_1,c_2, ..., c_m \rangle\) is a resolution refutation
\(\;\; \circ\) \(c_i\in x\) or \(c_j\land c_k\vdash_R c_i\) where \(j,k < i\)
\(\;\; \circ\) \(c_m=\{\}\), contains no literals, is unsatisfiable
\(\{\)Davis\(^{*\dagger}\),Putnam\(^*\),Logemann\(^\dagger\),Loveland\(^\dagger\)\(\}\)
\(\{\)1960\(^{*}\),1962\(^{\dagger}\)\(\}\)
\(\circ\) Let \(x\) be a CNF and \(\ell\) a literal
\(\circ\) We define \(x\downharpoonright\ell=x'\)
\(\;\; \circ\) \(\forall c\in x\) s.t. \(\{\ell, \overline{\ell}\} \cap c \equiv \emptyset\) we have \(c\in x'\)
\(\;\; \circ\) \(\forall c\in x\) s.t. \(\ell \in c\) we have \(c\not\in x'\)
\(\;\; \circ\) \(\forall c\in x\) s.t. \(\overline{\ell} \in c\) we have \(c \backslash \overline{\ell} \in x'\)
\(\;\; \circ\) \(x'\) only contains the inclusions above
\(\circ\) Denoted \({UP}(x)\), iteratively until fixpoint:
\(\;\; \circ\) For unit \(\{\ell\}\in x\) apply \(x\downharpoonright\ell\)
bool DPLL(set:Clause x)
// Simplify formula with Unit Propagation
x=UP(x);
while ( p <- x && pure(x,p) )
// i.e. All occurences of p in x have same parity
x=UP(x /\ {sign(p,x)p});
// Occurrences of each proposition have same parity
if (consistent_set(x)) return true; // SAT
// Empty disjunctive clause cannot be satisfied
if ( c <- x && |c| == 0 ) return false ; // UNSAT
// i.e. proposition selection heuristic
p=select_proposition(x);
return DPLL(x /\ {p}) || DPLL(x /\ {-p});
bool CDCL(set:Clause x,list:Literal D=[], set:Clause LC={})
do{
if ( {} <- UP(D /\ LC /\ x) ){
if ( D == [] ) return false; // UNSATISFIABLE
c = CONFLICT (D /\ LC /\ x);
m = assertion_level(c, D);
D = D[:m];
LC = c /\ LC;
} else {
if ( RESTART ) D=[];
l=select_literal(D /\ LC /\ x);
if ( NULL == l ) return true; // SATISFIABLE
D=D+[l]
}
}while(true);
\[\mathbf{f}(\alpha,c) = \bigg\{ \begin{array}{ccc} 0 & \text{if} & \alpha\models c\\ 1 & \text{if} & \alpha\not\models c \end{array} \] | \[\mathbf{V}_x(\alpha) = \sum_{c\in x} \mathbf{f}(\alpha,c) \] |
\(V_a\) :: asset \(a\) is used
\(P_{fg}\) :: task \(f\) precedes task \(g\) on some asset
\(P_{af}\) :: schedule for asset \(a\) starts at task \(f\)
\(D_f\) :: task f is scheduled
\(D_fV_a\) :: task \(f\) is scheduled on asset \(a\)
\(T_{tf}\) :: task \(f\) is serviced with an asset of type \(t\)
\(C_{fgt}\) :: profit scheduling \(f\) and \(g\) on asset type \(t\)
\(C_{aft}\) :: profit for asset \(a\) of type \(t\) starting at \(f\)
\(\sum_{f}P_{af}-V_{a}=0\) :: asset used iff scheduled
\(\sum_{f}-P_{af}\geq -1\) :: assets starts once
\(-D_{f} + \sum_{v}P_{vf} = 0\) :: task once as a successor
\(-D_{f} + \sum_{a}D_{f}V_{a} = 0\) :: task assigned once
\(-D_{f} + \sum_{g}-P_{fg} \geq 0\) :: task once as predecessor
\(-P_{fg} + D_{f} \geq 0\); \(-P_{fg} + D_{g}\geq 0\)
\(f\) scheduled with \(g\), then its scheduled.
\(-P_{fg} - D_{g}V_{a} + D_{f}V_{a} \geq -1 \);
\(f\) scheduled with \(g\) are served by one \(a\)
\(-T_{tf} + \sum_{a:[t(a)=t]}(D_{f}V_{a}) = 0\)
\(f\) served by one \(a\) of type \(t\)
\( - T_{tg} - P_{fg} + C_{fgt} \geq -1 \) ; \(P_{fg} - C_{fgt} >= 0\)
To incur a profit \(C_{fgt}\)
git clone git@github.com:ANU-HPC/dagster.git
docker build --no-cache -t milthorpe/async-neighbours .
docker run -it --mount src=`pwd`,target=/home/appuser,\
type=bind milthorpe/async-neighbours
cd dagster
make -j 16
cd .. # Back to the root folder
cd Benchmarks/ramsey
make
for i in {4..10} ; do
./generate_ramsey_NM -N $i -M 2 2> ramsey.M2.N$i.map
> ramsey.M2.N$i.cnf
mv dag_${i}_2.dag ramsey.M2.N$i.dag
done
cd ../../ # Back to the root folder
cd dagster
for i in {4..10} ; do echo $i ;
mpirun -n 4 ./dagster -m 0 -e 1 \
../Benchmarks/ramsey/ramsey.M2.N$i.dag \
../Benchmarks/ramsey/ramsey.M2.N$i.cnf
if [ $(cat dag_out.txt | wc -l) -gt 0 ] ; then
mv dag_out.txt ramsey.M2.N$i.sol
fi
done
ls ramsey.*
ramsey.M2.N4.sol ramsey.M2.N5.sol
for f in `cat ramsey.M2.N4.sol | tr ' ' '\n' | grep -v ^-` ; do
cat ../Benchmarks/ramsey/ramsey.M2.N4.map | grep :\ $f\ -
done
MAPPING: 2 -> v2 x v3 = c1
MAPPING: 4 -> v1 x v3 = c1
MAPPING: 5 -> v0 x v3 = c0
MAPPING: 7 -> v1 x v2 = c0
MAPPING: 10 -> v0 x v2 = c1
MAPPING: 11 -> v0 x v1 = c0
for f in `cat ramsey.M2.N5.sol | tr ' ' '\n' | grep -v ^-` ; do
cat ../Benchmarks/ramsey/ramsey.M2.N5.map | grep :\ $f\ -
done
MAPPING: 2 -> v3 x v4 = c1
MAPPING: 4 -> v2 x v4 = c1
MAPPING: 5 -> v1 x v4 = c0
MAPPING: 7 -> v0 x v4 = c0
MAPPING: 9 -> v2 x v3 = c0
MAPPING: 12 -> v1 x v3 = c1
MAPPING: 13 -> v0 x v3 = c0
MAPPING: 15 -> v1 x v2 = c0
MAPPING: 18 -> v0 x v2 = c1
MAPPING: 20 -> v0 x v1 = c1