SemOpt  $Revision:83+[c2a47fa11ed3+]$
SemOpt.cpp
Go to the documentation of this file.
1 
9 #include "semopt.h"
10 
14 bool debug = false;
15 bool externalsat = true;
16 string satsolver;
17 int labellingconditions = 0;
18 bool manualopt = false;
19 string inputfile;
20 string semantics;
21 
22 int (*SatSolver)(stringstream *, int, int, vector<int> *) = NULL;
23 
24 time_t start;
25 
26 #ifndef UNIT_TEST
27 
38 int main(int argc, char *argv[])
39 {
40  time(&start);
41 
42  if (argc <= 1)
43  {
44  showHelp(hgrev);
45  return -127;
46  }
47 
48  inputfile = string(argv[1]);
49 
50  if (argc > 2)
51  {
52  if (!parseParams(argc, argv))
53  {
54  showHelp(hgrev);
55  return -127;
56  }
57  }
58 
59  AF framework = AF();
60  if (!framework.readFile(inputfile))
61  {
62  showHelp(hgrev);
63  return -1;
64  }
65 
66  if (semantics.compare(complete_string_const) == 0)
67  {
68  CompleteSemantics comp = CompleteSemantics(&framework,
69  labellingconditions);
70  comp.compute();
71 
72  Semantics::iterator it;
73  for (it = comp.begin(); it != comp.end(); it++)
74  {
75  cout << *((*it).inargs()) << endl;
76  }
77  }
78  else if (semantics.compare(preferred_string_const) == 0
79  || semantics.compare(preferred_df_string_const) == 0)
80  {
81  PreferredSemantics pref = PreferredSemantics(&framework,
82  labellingconditions);
83  if (semantics.compare(preferred_string_const) == 0)
84  pref.compute();
85  else
86  pref.compute_depht_first();
87 
88  Semantics::iterator it;
89  for (it = pref.begin(); it != pref.end(); it++)
90  {
91  cout << *((*it).inargs()) << endl;
92  }
93  }
94  else if (semantics.compare(grounded_string_const) == 0
95  || semantics.compare(grounded_poly_string_const) == 0)
96  {
97  GroundedSemantics ground = GroundedSemantics(&framework,
98  labellingconditions);
99  if (semantics.compare(grounded_string_const) == 0)
100  ground.compute();
101  else
102  ground.compute_poly();
103  Semantics::iterator it;
104  for (it = ground.begin(); it != ground.end(); it++)
105  {
106  cout << *((*it).inargs()) << endl;
107  }
108 
109  }
110  else if (semantics.compare(stable_string_const) == 0)
111  {
112  StableSemantics stab = StableSemantics(&framework, labellingconditions);
113  stab.compute();
114  Semantics::iterator it;
115  for (it = stab.begin(); it != stab.end(); it++)
116  {
117  cout << *((*it).inargs()) << endl;
118  }
119 
120  }
121  else if (semantics.compare(semistable_string_const) == 0)
122  {
123  SemistableSemantics semistab = SemistableSemantics(&framework, labellingconditions);
124  semistab.compute();
125  Semantics::iterator it;
126  for (it = semistab.begin(); it != semistab.end(); it++)
127  {
128  cout << *((*it).inargs()) << endl;
129  }
130 
131  }
132 
133  return 0;
134 }
135 #endif