Commit 24d9f0a0 authored by Chanelle Lee's avatar Chanelle Lee
Browse files

Fixed some bugs when running on the hpc. Changed CMakeLists.txt to use subdirectory pybind11

parent 044e93a9
......@@ -11,6 +11,7 @@ set(SOURCES "${SOURCE_DIR}/agentFunctions.cpp")
set(SOURCES "${SOURCE_DIR}/evidenceFunctions.cpp")
# Generate python module
find_package(pybind11 REQUIRED)
#find_package(pybind11 REQUIRED)
add_subdirectory(pybind11)
pybind11_add_module(agentFunctions ${SOURCES} "${SOURCE_DIR}/bindings.cpp")
pybind11_add_module(evidenceFunctions ${SOURCES} "${SOURCE_DIR}/bindings.cpp")
......@@ -22,7 +22,7 @@ py::array_t<double> update_on_evidence(int evidence_id, double distrust,
double b_evidence = belief_ptr[evidence_id];
/* Evidential updating is undefined for inconsistent cases */
if ((distrust == 0) && (b_minSite == 1))
if ((distrust == 0) && (b_evidence == 1))
{
return belief;
}
......
......@@ -17,5 +17,5 @@ PYBIND11_MODULE(agentFunctions, m){
PYBIND11_MODULE(evidenceFunctions, m){
m.doc() = "Functions for improving evidence performance";
m.def("pick_option", &pick_option, "Picks an option from a weighted distribution")
m.def("pick_option", &pick_option, "Picks an option from a weighted distribution");
}
......@@ -5,7 +5,7 @@
#include <vector>
#include <math.h>
#include "evidenceFunction.hpp"
#include "evidenceFunctions.hpp"
int pick_option(int num_options, py::array_t<double> weights){
if (weights.ndim() != 1)
......@@ -34,7 +34,5 @@ int pick_option(int num_options, py::array_t<double> weights){
}
}
selected; // when iterations end, selected is some element of sequence.
}
return selected;
return selected;
}
......@@ -13,3 +13,5 @@ namespace py = pybind11;
\param weights : a pybind11 numpy array with the weights for the options
*/
int pick_option(int num_option, py::array_t<double> weights);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment