diff --git a/packages/CLPBN/clpbn.yap b/packages/CLPBN/clpbn.yap index 0981c1157..79d4f2d09 100644 --- a/packages/CLPBN/clpbn.yap +++ b/packages/CLPBN/clpbn.yap @@ -699,48 +699,48 @@ pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State) :- ; format("Error: solver '~w' is unknown.", [Solver]), fail ), - pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, Solver). + pfl_init_solver(Solver, QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, ve) :- !, +pfl_init_solver(ve, QueryKeys, AllKeys, Factors, Evidence, State) :- !, init_ve_ground_solver(QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, hve) :- !, +pfl_init_solver(hve, QueryKeys, AllKeys, Factors, Evidence, State) :- !, clpbn_horus:set_horus_flag(ground_solver, hve), init_horus_ground_solver(QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, bdd) :- !, +pfl_init_solver(bdd, QueryKeys, AllKeys, Factors, Evidence, State) :- !, init_bdd_ground_solver(QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, bp) :- !, +pfl_init_solver(bp, QueryKeys, AllKeys, Factors, Evidence, State) :- !, clpbn_horus:set_horus_flag(ground_solver, bp), init_horus_ground_solver(QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(QueryKeys, AllKeys, Factors, Evidence, State, cbp) :- !, +pfl_init_solver(cbp, QueryKeys, AllKeys, Factors, Evidence, State) :- !, clpbn_horus:set_horus_flag(ground_solver, cbp), init_horus_ground_solver(QueryKeys, AllKeys, Factors, Evidence, State). -pfl_init_solver(_, _, _, _, _, Solver) :- +pfl_init_solver(Solver, _, _, _, _, _) :- format("Error: solver '~w' can't be used for learning.", [Solver]), fail. pfl_run_solver(LVs, LPs, State) :- em_solver(Solver), - pfl_run_solver(LVs, LPs, State, Solver). + pfl_run_solver(Solver, LVs, LPs, State). -pfl_run_solver(LVs, LPs, State, ve) :- !, +pfl_run_solver(ve, LVs, LPs, State) :- !, run_ve_ground_solver(LVs, LPs, State). -pfl_run_solver(LVs, LPs, State, hve) :- !, +pfl_run_solver(hve, LVs, LPs, State) :- !, run_horus_ground_solver(LVs, LPs, State). -pfl_run_solver(LVs, LPs, State, bdd) :- !, +pfl_run_solver(bdd, LVs, LPs, State) :- !, run_bdd_ground_solver(LVs, LPs, State). -pfl_run_solver(LVs, LPs, State, bp) :- !, +pfl_run_solver(bp, LVs, LPs, State) :- !, run_horus_ground_solver(LVs, LPs, State). -pfl_run_solver(LVs, LPs, State, cbp) :- !, +pfl_run_solver(cbp, LVs, LPs, State) :- !, run_horus_ground_solver(LVs, LPs, State). pfl_end_solver(State) :- diff --git a/packages/CLPBN/horus/LiftedKc.cpp b/packages/CLPBN/horus/LiftedKc.cpp index c366c282d..c0ea76b8c 100644 --- a/packages/CLPBN/horus/LiftedKc.cpp +++ b/packages/CLPBN/horus/LiftedKc.cpp @@ -950,26 +950,27 @@ LiftedCircuit::createSmoothNode ( vector LiftedCircuit::getAllPossibleTypes (unsigned nrLogVars) const { - if (nrLogVars == 0) { - return {}; - } - if (nrLogVars == 1) { - return {{LogVarType::POS_LV},{LogVarType::NEG_LV}}; - } vector res; - Ranges ranges (nrLogVars, 2); - Indexer indexer (ranges); - while (indexer.valid()) { - LogVarTypes types; - for (size_t i = 0; i < nrLogVars; i++) { - if (indexer[i] == 0) { - types.push_back (LogVarType::POS_LV); - } else { - types.push_back (LogVarType::NEG_LV); + if (nrLogVars == 0) { + // do nothing + } else if (nrLogVars == 1) { + res.push_back ({ LogVarType::POS_LV }); + res.push_back ({ LogVarType::NEG_LV }); + } else { + Ranges ranges (nrLogVars, 2); + Indexer indexer (ranges); + while (indexer.valid()) { + LogVarTypes types; + for (size_t i = 0; i < nrLogVars; i++) { + if (indexer[i] == 0) { + types.push_back (LogVarType::POS_LV); + } else { + types.push_back (LogVarType::NEG_LV); + } } + res.push_back (types); + ++ indexer; } - res.push_back (types); - ++ indexer; } return res; } diff --git a/packages/CLPBN/pfl.tex b/packages/CLPBN/pfl.tex index 6994b0ad3..27f051424 100644 --- a/packages/CLPBN/pfl.tex +++ b/packages/CLPBN/pfl.tex @@ -38,7 +38,7 @@ CRACS \& INESC TEC, Faculty of Sciences, University of Porto \thispagestyle{empty} \vspace{5cm} \begin{center} - \large Last revision: January 11, 2013 + \large Last revision: January 18, 2013 \end{center} \newpage @@ -60,7 +60,7 @@ The package also includes implementations for a set of well-known inference algo %------------------------------------------------------------------------------ %------------------------------------------------------------------------------ \section{Installation} -PFL is included with the \href{http://www.dcc.fc.up.pt/~vsc/Yap/}{YAP} Prolog system. However, there isn't yet a stable release of YAP that includes PFL. So you will need to install a development version of YAP. To to so, you must have installed the \href{http://git-scm.com/}{Git} version control system. The commands to perform a default installation of YAP in your home directory in a Unix-based environment are shown next. +PFL is included with the \href{http://www.dcc.fc.up.pt/~vsc/Yap/}{YAP} Prolog system. However, there isn't yet a stable release of YAP that includes PFL and you will need to install a development version. To do so, you must have installed the \href{http://git-scm.com/}{Git} version control system. The commands to perform a default installation of YAP in your home directory in a Unix-based environment are shown next. \begin{enumerate} \setlength\itemindent{-0.01cm} @@ -433,7 +433,7 @@ Parameter learning is done by calling the \texttt{em/5} predicate. Its arguments Where, \begin{itemize} - \item \texttt{Data} is a list of samples for the distribution that we want to estimate. Each sample is a list of either observed random variables or unobserved random variables (denoted when its state value is not instantiated). + \item \texttt{Data} is a list of samples for the distribution that we want to estimate. Each sample is a list of either observed random variables or unobserved random variables (denoted when its state or value is not instantiated). \item \texttt{MaxError} is the maximum error allowed before stopping the EM loop. \item \texttt{MaxIters} is the maximum number of iterations for the EM loop. \item \texttt{CPTs} is a list with the estimated conditional probability tables. diff --git a/packages/zlib b/packages/zlib index b98ea2bb6..980a0b995 160000 --- a/packages/zlib +++ b/packages/zlib @@ -1 +1 @@ -Subproject commit b98ea2bb69599c44bdda52c7f1d3e6e3152b97aa +Subproject commit 980a0b9950ca0b52b327234fd2f66e0790f9c4e1