#include #include #include #include "Netica.h" #define CHKERR {if (GetError_ns (env, ERROR_ERR, NULL)) goto error;} environ_ns* env; /************************************************************************** Function: NextStates. This is a utility function to return loop through rows of CPT **************************************************************************/ int NextStates (state_bn* states, const nodelist_bn* nodes){ int nn; for (nn = LengthNodeList_bn (nodes) - 1; nn >= 0; --nn) { if (++states[nn] < GetNodeNumberStates_bn (NthNode_bn (nodes, nn))) return 0; states[nn] = 0; } return 1; } /************************************************************************** Function: BhattDist. This function Computes the Bhattarcharyya Distance between two probability distributions **************************************************************************/ double BhattDist(const prob_bn *probDist1, const prob_bn *probDist2, int n) { int i; double temp = 0.0; for(i=0; i%s\n", netName1, netName2); doNets(net1, net2); end: FreeNet_bn (net1); FreeNet_bn (net2); res = CloseNetica_bn (env, mesg); printf ("%s\n", mesg); return (res < 0 ? -1 : 0); error: fprintf (stderr, "Sensitivity Analysis: Error in %s\n", ErrorMessage_ns (GetError_ns (env, ERROR_ERR, NULL))); goto end; }