From 6cad8969c666814e7fdf89f3c4d5c26c80623c81 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 15 Jan 2013 12:27:21 +0000 Subject: [PATCH 1/6] Put solver always as the first argument --- packages/CLPBN/clpbn.yap | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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) :- From 568325818700c77d7abc620d8ea91997a96e8803 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 16 Jan 2013 08:53:09 +0000 Subject: [PATCH 2/6] PFL manual: fix typo --- packages/CLPBN/pfl.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/CLPBN/pfl.tex b/packages/CLPBN/pfl.tex index 6994b0ad3..f0ca5ba27 100644 --- a/packages/CLPBN/pfl.tex +++ b/packages/CLPBN/pfl.tex @@ -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. From 829c3ec8c4107db92aad2e4b916f57b079556c5f Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 24 Jan 2013 13:14:07 +0000 Subject: [PATCH 3/6] update to latest swi. --- packages/zlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9dfedafe98e195967cc6e0cce1370ac24c0d2533 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 25 Jan 2013 13:45:35 +0000 Subject: [PATCH 4/6] PFL manual: small improvements --- packages/CLPBN/pfl.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/CLPBN/pfl.tex b/packages/CLPBN/pfl.tex index f0ca5ba27..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} From bef65dac57db6478f45bdd1f96c94128ab9b12ef Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 25 Jan 2013 13:47:20 +0000 Subject: [PATCH 5/6] Fix a compilation error with older versions of GCC --- packages/CLPBN/horus/LiftedKc.cpp | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/CLPBN/horus/LiftedKc.cpp b/packages/CLPBN/horus/LiftedKc.cpp index c366c282d..baf8b5fed 100644 --- a/packages/CLPBN/horus/LiftedKc.cpp +++ b/packages/CLPBN/horus/LiftedKc.cpp @@ -950,26 +950,28 @@ LiftedCircuit::createSmoothNode ( vector LiftedCircuit::getAllPossibleTypes (unsigned nrLogVars) const { + vector res; if (nrLogVars == 0) { - return {}; + // do nothing } 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); + 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; } From 0d9d59f5fe9b11af7d9d37af5ed25561789cca0d Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 25 Jan 2013 13:58:30 +0000 Subject: [PATCH 6/6] Trivial --- packages/CLPBN/horus/LiftedKc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/CLPBN/horus/LiftedKc.cpp b/packages/CLPBN/horus/LiftedKc.cpp index baf8b5fed..c0ea76b8c 100644 --- a/packages/CLPBN/horus/LiftedKc.cpp +++ b/packages/CLPBN/horus/LiftedKc.cpp @@ -953,8 +953,7 @@ LiftedCircuit::getAllPossibleTypes (unsigned nrLogVars) const vector res; if (nrLogVars == 0) { // do nothing - } - if (nrLogVars == 1) { + } else if (nrLogVars == 1) { res.push_back ({ LogVarType::POS_LV }); res.push_back ({ LogVarType::NEG_LV }); } else {