Skip to content

Commit ae099bd

Browse files
committed
restructuring completed
1 parent a525091 commit ae099bd

File tree

194 files changed

+43844
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+43844
-9
lines changed

Diff for: .gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,9 @@ ENV/
9999

100100
# mypy
101101
.mypy_cache/
102+
103+
# project files
104+
.idea/
105+
106+
# pracmln configuration file(s)
107+
.pracmln.conf

Diff for: 3rdparty/toulbar2-0.9.7.0/x86_64/Linux/toulbar2

1.65 MB
Binary file not shown.
1.16 MB
Binary file not shown.

Diff for: MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
recursive-include python2 *
2+
recursive-include python3 *

Diff for: examples/alarm/alarm.pracmln

1.89 KB
Binary file not shown.

Diff for: examples/hmm/hmm.pracmln

1.59 KB
Binary file not shown.

Diff for: examples/meals/meals.pracmln

72.1 KB
Binary file not shown.
23.5 KB
Binary file not shown.

Diff for: examples/smokers/smokers.pracmln

2.92 KB
Binary file not shown.

Diff for: examples/taxonomies/taxonomies.pracmln

3.44 KB
Binary file not shown.

Diff for: examples/tweety/tweety.pracmln

1.69 KB
Binary file not shown.

Diff for: examples/vegetarians/vegetarians.pracmln

5.87 KB
Binary file not shown.

Diff for: libpracmln/CMakeLists.txt

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(libpracmln)
3+
4+
#####################
5+
## Default options ##
6+
#####################
7+
8+
if(NOT CMAKE_BUILD_TYPE)
9+
set(CMAKE_BUILD_TYPE Release CACHE STRING
10+
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
11+
FORCE)
12+
endif(NOT CMAKE_BUILD_TYPE)
13+
14+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
15+
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "Install path for project" FORCE)
16+
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
17+
18+
###############
19+
## CXX Flags ##
20+
###############
21+
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
23+
# Unused warnings
24+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter")
25+
# Additional warnings
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body -Wlogical-op")
27+
28+
##################
29+
## Dependencies ##
30+
##################
31+
32+
## System dependencies are found with CMake's conventions
33+
find_package(PythonLibs $ENV{PYTHONDIST} REQUIRED)
34+
35+
if(NOT PYTHONLIBS_FOUND)
36+
message(ERROR "PythonLibs not found!")
37+
endif()
38+
39+
find_package(Boost REQUIRED COMPONENTS python-py35)
40+
41+
##################
42+
## Header files ##
43+
##################
44+
45+
# Display additional files in qtcreator
46+
add_custom_target(header_files SOURCES
47+
include/pracmln/mln.h
48+
)
49+
50+
###########
51+
## Build ##
52+
###########
53+
54+
include_directories(
55+
include
56+
${Boost_INCLUDE_DIRS}
57+
${PYTHON_INCLUDE_DIRS}
58+
)
59+
60+
add_library(pracmln SHARED src/mln.cpp)
61+
target_link_libraries(pracmln
62+
${Boost_LIBRARIES}
63+
${PYTHON_LIBRARIES}
64+
)
65+
66+
add_definitions(-DPROJECT_SRC_DIR="${PROJECT_SOURCE_DIR}")
67+
add_executable(test_mln src/test_mln.cpp)
68+
target_link_libraries(test_mln pracmln)
69+
70+
#############
71+
## Install ##
72+
#############
73+
74+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include" DESTINATION ${CMAKE_INSTALL_PREFIX})
75+
76+
install(TARGETS pracmln
77+
RUNTIME DESTINATION bin
78+
LIBRARY DESTINATION lib
79+
ARCHIVE DESTINATION lib
80+
)

Diff for: libpracmln/include/pracmln/mln.h

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#ifndef __MLN_H__
2+
#define __MLN_H__
3+
4+
// STL
5+
#include <string>
6+
#include <vector>
7+
8+
class MLN{
9+
private:
10+
struct Internal;
11+
Internal *internal;
12+
13+
std::vector<std::string> methods;
14+
15+
size_t method;
16+
size_t logic;
17+
size_t grammar;
18+
19+
std::string mln;
20+
std::string db;
21+
22+
bool initialized;
23+
bool dbIsFile;
24+
bool updateDB;
25+
bool updateMLN;
26+
27+
public:
28+
MLN();
29+
virtual ~MLN();
30+
31+
bool initialize();
32+
33+
std::vector<std::string> getMethods() const;
34+
std::vector<std::string> getLogics() const;
35+
std::vector<std::string> getGrammars() const;
36+
37+
bool setMethod(const std::string &method);
38+
bool setLogic(const std::string &logic);
39+
bool setGrammar(const std::string &grammar);
40+
void setMLN(const std::string &mln);
41+
void setDB(const std::string &db, const bool isFile = true);
42+
void setQuery(const std::vector<std::string> &query);
43+
44+
std::string getMethod() const;
45+
std::string getLogic() const;
46+
std::string getGrammar() const;
47+
std::string getMLN() const;
48+
std::string getDB() const;
49+
std::vector<std::string> getQuery() const;
50+
51+
void setCWPreds(const std::vector<std::string> &cwPreds);
52+
void setMaxSteps(const int value);
53+
void setNumChains(const int value);
54+
void setUseMultiCPU(const bool enable);
55+
56+
std::vector<std::string> getCWPreds() const;
57+
int getMaxSteps() const;
58+
int getNumChains() const;
59+
bool getUseMultiCPU() const;
60+
61+
bool infer(std::vector<std::string> &results, std::vector<double> &probabilities);
62+
63+
private:
64+
bool init();
65+
66+
bool isInOptions(const std::string &option, const std::vector<std::string> &options, size_t &value) const;
67+
};
68+
69+
#endif //__MLN_H__

0 commit comments

Comments
 (0)