-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASPSolver.h
144 lines (110 loc) · 4.15 KB
/
ASPSolver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/***************************************************************************
* Copyright (C) 2014 by Mushthofa *
* Mushthofa.Mushthofa@Ugent.be *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file ASPSolver.h
* @author Roman Schindlauer, Mushthofa
*
* @brief ASP solver base class.
*
*/
#ifndef _ASPSOLVER_H
#define _ASPSOLVER_H
#include <iostream>
#include <string>
#include <vector>
#include "ProcessBuff.h"
#include "Error.h"
#include "Globals.h"
#include "AtomSet.h"
#include "Program.h"
#include "ASPResultParser.h"
/**
* @brief ASP solver class.
*/
class ASPSolver
{
public:
ASPSolver()
:answersetsleft(false)//, resultParser(rp)
{}
virtual ~ASPSolver()
{
//delete resultParser;
}
/**
* @brief Calls the answer set solver with a program.
*
*
*
*/
virtual void callSolver(std::string program, int, int) = 0;
/**
* @brief Retrieves an Answer set, incrementing the internal result pointer.
*
*
*/
virtual void getNextAnswerSet() = 0;
/**
* @brief Returns the number of answer sets of the last result.
*/
//virtual unsigned numAnswerSets() = 0;
virtual bool answerSetsLeft() const = 0;
std::string getNextLine()
{
std::string result = currline;
getNextAnswerSet();
return result;
}
protected:
/**
* @brief System command to call the external asp reasoner.
*/
std::string lpcommand;
/**
* @brief List of arguments supplied
*/
std::vector<std::string> lpargs;
/**
* @brief Internal result
*/
//AtomSet currentAnswer;
// std::vector<std::string> aslines;
std::string currline;
/* Is there any answers left */
bool answersetsleft;
/* Program string */
/* Result Parser */
//ASPResultParser* resultParser;
};
/* The class to store ASP Solver factory */
typedef boost::shared_ptr<ASPSolver> ASPSolverPtr;
class ASPSolverEngine
{
public:
ASPSolverEngine()
{}
/* Create one instance of the solver */
virtual ASPSolver* createSolverFilter(bool checkOnly, std::set<std::string>) = 0;
virtual ASPSolver* createSolver(bool checkOnly) = 0;
virtual ~ASPSolverEngine() {}
protected:
};
#endif // _ASPSOLVER_H
//End