## cool / src / lib / GMLMIP-0.1 / rules / test.cpp @ 7c4d2eb4

History | View | Annotate | Download (1.08 KB)

1 | e034e268 | Thorsten Wißmann | #include "GML_premise.h" |
---|---|---|---|

2 | |||

3 | #include "bdd.h" |
||

4 | |||

5 | ```
int main() {
``` |
||

6 | |||

7 | bdd_init(10000, 1000); |
||

8 | ```
bdd_setvarnum(100);
``` |
||

9 | |||

10 | ```
// Create a premise object
``` |
||

11 | const int n = 1; |
||

12 | const int m = 1; |
||

13 | |||

14 | int a[n] = {2}; |
||

15 | int b[m] = {1}; |
||

16 | |||

17 | GML_Premise p(n,m,a,b); |
||

18 | ```
//p.construct_conclusions();
``` |
||

19 | |||

20 | ```
//SetOfConclusions s(p.get_n_plus_m(), p.construct_conclusions());
``` |
||

21 | |||

22 | ```
/*
``` |
||

23 | ```
bdd underlying[3];
``` |
||

24 | ```
for(int i = 0; i < 3; i++)
``` |
||

25 | ```
underlying[i] = bdd_ithvarpp(i);
``` |
||

26 | |||

27 | ```
//bdd_printdot(underlying[0]);
``` |
||

28 | |||

29 | ```
bdd_printdot(s.get_jth_conclusion(underlying,2));
``` |
||

30 | ```
*/
``` |
||

31 | |||

32 | |||

33 | vector<Conclusion> vec = p.construct_conclusions(); |
||

34 | for(unsigned int i=0; i < vec.size(); i++){ |
||

35 | ```
cout << "Rule " << i << endl;
``` |
||

36 | for(unsigned int j=0; j < vec[i].size(); j++){ |
||

37 | cout << "Valuation " << j << ": "; |
||

38 | for(int k=0; k < vec[i][j].get_n(); k++){ |
||

39 | cout << "p[" << k << "] = " << vec[i][j].get_p_i(k) << ", "; |
||

40 | } |
||

41 | cout << endl; |
||

42 | } |
||

43 | ```
cout << "==================" << endl;
``` |
||

44 | } |
||

45 | |||

46 | ```
/* Testing new clause/valuation constructor */
``` |
||

47 | ```
/*
``` |
||

48 | ```
for(unsigned int j=0; j < 8; j++){
``` |
||

49 | ```
Clause c(j,3);
``` |
||

50 | ```
for(int k=0; k < 3; k++){
``` |
||

51 | ```
cout << "p[" << k << "] = " << c.get_p_i(k) << ", ";
``` |
||

52 | ```
}
``` |
||

53 | ```
cout << endl;
``` |
||

54 | ```
}
``` |
||

55 | ```
*/
``` |
||

56 | |||

57 | |||

58 | return 0; |
||

59 | } |