scripts, cores and docs

This commit is contained in:
Tom Krüger
2021-01-24 02:09:19 +01:00
parent a9fe4f1ae0
commit f66fcd679d
37 changed files with 298 additions and 180 deletions

41
util/extend.py Executable file
View File

@@ -0,0 +1,41 @@
#!python3
import sys
from pysat.formula import CNF
import argparse
import pathlib as pl
import bz2
def main():
f_ext= CNF(from_fp=sys.stdin)
instance_dir = pl.Path(parse_args())
instance, core_nr = parse_header(f_ext.comments[0])
ipath = instance_dir / (instance + ".cnf.bz2")
f = CNF(ipath)
f.extend(f_ext)
f.comments = []
f.to_fp(sys.stdout,
comments=["c extension_of:{} nr:{}".format(instance, core_nr)])
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--instance_dir",
type=str,
help="path to the directoy containing all instances")
args = parser.parse_args()
return args.instance_dir
def parse_header(header):
tokens = header.split(' ')[1:]
return tokens[0].split(':')[1], int(tokens[1].split(':')[1])
if __name__ == "__main__":
main()

BIN
util/glucose Executable file

Binary file not shown.

7
util/solve_extended.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
dir_path=$(dirname $(realpath $0))
extend_script="${dir_path}/extend.py"
glucose_bin="${dir_path}/glucose"
bzip2 -d < ${1} | python3 ${extend_script} -i "${dir_path}/../instances"| ${glucose_bin}

5
util/test.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo $0
echo $(dirname $0)