-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (40 loc) · 1.52 KB
/
main.cpp
File metadata and controls
41 lines (40 loc) · 1.52 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
//
// Created by Jason Shen on 5/21/18.
//
#include <hierarchical_map_compiler/map_network.h>
#include <iostream>
extern "C" {
#include <sdd/sddapi.h>
}
int main(int argc, const char* argv[]) {
if (argc <= 6) {
std::cout << "Usage: map_filename graph_hopper_script tmp_dir thread_num "
"sdd_filename vtree_filename"
<< std::endl;
exit(1);
}
std::string map_filename(argv[1]);
std::string graph_hopper_script(argv[2]);
std::string tmp_dir(argv[3]);
int thread_num = atoi(argv[4]);
std::string sdd_filename(argv[5]);
std::string vtree_filename(argv[6]);
std::cout << "Running map file : " << map_filename << std::endl;
std::cout << "Graph hopper script : " << graph_hopper_script << std::endl;
std::cout << "Tmp dir : " << tmp_dir << std::endl;
std::cout << "Thread Num : " << thread_num << std::endl;
std::cout << "Sdd filename : " << sdd_filename << std::endl;
std::cout << "Vtree filename : " << vtree_filename << std::endl;
MapNetwork* network =
MapNetwork::MapNetworkFromJsonSpecFile(map_filename.c_str());
network->SetGraphillionCompiler(graph_hopper_script, tmp_dir, thread_num);
auto result = network->CompileConstraint();
std::cout << "Model Count"
<< psdd_node_util::ModelCount(
psdd_node_util::SerializePsddNodes(result.first))
.get_str(10)
<< std::endl;
psdd_node_util::WritePsddToFile(result.first, sdd_filename.c_str());
sdd_vtree_save(vtree_filename.c_str(), result.second->vtree());
return 0;
}