SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
MathSAT.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Tool.h"
4 
5 #include <regex>
6 
7 namespace benchmax {
8 
9 /**
10  * Tool wrapper for MathSAT for SMT-LIB.
11  */
12 class MathSAT: public Tool {
13 public:
14  /// New MathSAT tool.
15  MathSAT(const fs::path& binary, const std::string& arguments): Tool("MathSAT", binary, arguments) {
16  mArguments += " -input=smt2 <";
17  }
18 
19  /// Only handle .smt2 files.
20  virtual bool canHandle(const fs::path& path) const override {
21  return is_extension(path, ".smt2");
22  }
23 
24  /// Computes the answer string from the exit code and parses statistics output.
25  virtual void additionalResults(const fs::path&, BenchmarkResult& result) const override {
26  if (result.stdout.find("unsat") != std::string::npos) result.answer = "unsat";
27  else if (result.stdout.find("sat") != std::string::npos) result.answer = "sat";
28  else if (result.stdout.find("unknown") != std::string::npos) result.answer = "unknown";
29  else if (result.stdout.find("out of memory") != std::string::npos) result.answer = "memout";
30  else result.answer = "invalid";
31 
32  result.stdout = "";
33  result.stderr = "";
34  }
35 };
36 
37 }
Tool wrapper for MathSAT for SMT-LIB.
Definition: MathSAT.h:12
MathSAT(const fs::path &binary, const std::string &arguments)
New MathSAT tool.
Definition: MathSAT.h:15
virtual bool canHandle(const fs::path &path) const override
Only handle .smt2 files.
Definition: MathSAT.h:20
virtual void additionalResults(const fs::path &, BenchmarkResult &result) const override
Computes the answer string from the exit code and parses statistics output.
Definition: MathSAT.h:25
Base class for any tool.
Definition: Tool.h:38
fs::path binary() const
Full path to the binary.
Definition: Tool.h:67
std::string mArguments
Command line arguments that should be passed to the binary.
Definition: Tool.h:45
bool is_extension(const std::filesystem::path &path, const std::string &extension)
Checks whether the extension of the filename is as specified.
Definition: filesystem.h:60
Results for a single benchmark run.