--- /dev/null
+#!/usr/bin/env python3
+
+from versuchung.experiment import Experiment
+from versuchung.archives import TarArchive, GitArchive
+from versuchung.files import Directory
+from versuchung.execute import shell, CommandFailed
+
+import re
+import os
+
+def natural_key(string_):
+ return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)]
+
+class SolverExperiment(Experiment):
+ inputs = { 'formulas' : TarArchive() }
+ outputs = { 'timing' : Directory() }
+
+ def build_solver(self):
+ pass
+
+ def run_solver(self, formula):
+ pass
+
+ def run(self):
+ print("Building Solver ...")
+ self.build_solver()
+ formulas = sorted(os.listdir(self.inputs.formulas.path), key=natural_key)
+ shell.track(self.outputs.timing.path)
+ for formula in formulas:
+ print("Running for %s ..." % formula)
+ try:
+ self.run_solver(os.path.join(self.inputs.formulas.path, formula))
+ except CommandFailed:
+ break
+
+
+class CoolExperiment(SolverExperiment):
+ inputs = { 'cool' : GitArchive() }
+ outputs = {}
+
+ def __init__(self):
+ CoolExperiment.inputs.update(SolverExperiment.inputs)
+ CoolExperiment.outputs.update(SolverExperiment.outputs)
+ super(CoolExperiment, self).__init__()
+
+ def build_solver(self):
+ with self.inputs.cool as path:
+ shell("make")
+
+ def run_solver(self, formula):
+ with self.inputs.cool as path:
+ shell("timeout 1001 ./coalg.native sat KD --verbose < %s" % formula)
+
+
+
+if __name__ == "__main__":
+ import sys
+ experiment = CoolExperiment()
+ dirname = experiment(sys.argv)
+
+ print(dirname)