2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
11 * Created on February 21, 2019, 12:26 PM
14 #include "mathsatinterpreter.h"
15 #include "solver_interface.h"
17 MathSATInterpreter::MathSATInterpreter(CSolver *solver):
18 SMTInterpreter(solver)
22 void MathSATInterpreter::compileRunCommand(char * command , size_t size){
23 snprintf(command, size, "timeout %u ./mathsat -model %s > %s", getTimeout(), SMTFILENAME, SMTSOLUTIONFILE);
26 MathSATInterpreter::~MathSATInterpreter(){
29 int MathSATInterpreter::getResult(){
30 ifstream input(SMTSOLUTIONFILE, ios::in);
32 while(getline(input, line)){
33 if(line.find("unsat")!= line.npos){
36 if(line.find("(") != line.npos){
37 char cline [line.size()+1];
38 strcpy ( cline, line.c_str() );
41 if (2 == sscanf(cline,"%*[^0123456789]%u%*[^0123456789]%s", &id, valuestr)){
43 if (strcmp (valuestr, "true)") == 0 ){
45 }else if (strcmp(valuestr, "false)") == 0){
48 ASSERT(2 == sscanf(cline, "%*[^0123456789]%u%*[^0123456789]%u", &id, &value));
51 model_print("Signature%u = %u\n", id, value);
52 sigEnc.setValue(id, value);