-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (26 loc) · 910 Bytes
/
main.cpp
File metadata and controls
34 lines (26 loc) · 910 Bytes
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
#include <cstdlib>
#include <iostream>
#include <fstream>
#include "Program.h"
#include "SmodelsBridge.h"
#include "parser.h"
using namespace std;
int main (int argc, char** argv) {
if (argc < 3)
fatal("Usage: pasp-asp [file] [smodels path]");
SmodelsBridge sb (argv[2]);
Program p(&sb);
parseGroundedASP(p, cin);
ifstream probabilitiesFile (argv[1]);
parseProbabilities(p, probabilitiesFile);
pair<Eigen::MatrixXd, Eigen::VectorXd> solution;
try {
solution = p.solve();
cout << "ANSWER: CONSISTENT" << endl;
cout << "Base:" << endl << solution.first << endl << endl << "Probability assignment:" << endl << solution.second << endl;
} catch (bool e) {
cout << "The program and the probabilities are inconsistent. There is no solution." << endl;
cout << "ANSWER: INCONSISTENT" << endl;
}
return 0;
}