Initial commit.

This commit is contained in:
gothictomato
2022-07-17 14:03:47 -04:00
commit 2ad31d53e3
12 changed files with 1029 additions and 0 deletions

31
cpusolver.h Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include "types.h"
typedef struct {
u32 varcnt;
u32 clausecnt;
u32* clauseinds;
u32* clausevals;
u32* watchlist;
} cpusolver;
void cpusolve() {
cpusolver s;
}
/*
* Read in DIMACs
* A clause is a list of variables and their assignments
*
* Create watchlists:
* 2 entries for each list - flag bit for if its a binary clause
*
* 2-watch:
* If one of them is marked false, remove and replace
* if there are no other literals in the clause that are true, unitprop the last literal
* if there are no literals that evaluate to true and the other watch is false, UNSAT
* if a literal is true, do nothing
* if 2 literals are unassigned, clause is unsat
*/