Repository navigation
Expand file tree
/
Copy pathtest_main.cxx
More file actions
90 lines (73 loc) · 2.17 KB
/
Copy pathtest_main.cxx
File metadata and controls
90 lines (73 loc) · 2.17 KB
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
#include "libff.h"
#include "output.h"
#include <iostream>
#include <fstream>
int main( int argc, char** argv )
{
int res = FF_parse_problem( argv[1], argv[2] );
if ( res == 0 )
{
std::cout << "Parsing of " << argv[1] << " and " << argv[2] << "was successful!" << std::endl;
}
else
{
std::cerr << "Trouble parsing, check PDDL files!" << std::endl;
std::exit(1);
}
res = FF_instantiate_problem();
if ( res == 0 )
{
std::cout << "Problem was instantiated" << std::endl;
}
else
{
std::cerr << "Could not instantiate problem!" << std::endl;
std::exit(1);
}
// Creating atoms.list and operators.list
std::ofstream out("atoms.list");
for(int i = 0; i < gnum_ft_conn; i++)
{
//print_ft_name(i);
out << i+1 << " "<< FF::get_ft_name(i) << std::endl;
}
out.close();
std::ofstream out2("operators.list");
out2 << "Name:" << std::endl;
out2 << "START()" << std::endl;
std::vector<unsigned> I, G;
FF::get_initial_state( I );
out2 << "Preconditions:" << std::endl;
out2 << "Adds:" << std::endl;
for ( unsigned i = 0; i < I.size(); i++ )
out2 << FF::get_ft_name( I[i] ) << std::endl;
out2 << "Deletes:" << std::endl;
FF::get_goal_state( G );
out2 << "Name:" << std::endl;
out2 << "END()" << std::endl;
out2 << "Preconditions:" << std::endl;
for ( unsigned i = 0; i < G.size(); i++ )
out2 << FF::get_ft_name( G[i] ) << std::endl;
out2 << "Adds:" << std::endl;
out2 << "Deletes:" << std::endl;
for(int i = 0; i < gnum_ef_conn; i++)
{
if ( gef_conn[i].removed == TRUE ) continue;
if ( gef_conn[i].illegal == TRUE ) continue;
out2 << "Name: " << std::endl;
out2 << FF::get_op_name(i) << std::endl;
out2 << "Preconditions:" << std::endl;
for(int j = 0; j < gef_conn[i].num_PC; j++) {
out2 << FF::get_ft_name( gef_conn[i].PC[j] ) << std::endl;
}
out2 << "Adds:" << std::endl;
for(int j = 0; j < gef_conn[i].num_A; j++) {
out2 << FF::get_ft_name( gef_conn[i].A[j] ) << std::endl;
}
out2 << "Deletes:" << std::endl;
for(int j = 0; j < gef_conn[i].num_D; j++) {
out2 << FF::get_ft_name( gef_conn[i].D[j] ) << std::endl;
}
}
return 0;
}