<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ml\subsection{Parameters}
The inference modules have a number of parameters in order to control their behavior. They can be set with the directive
\begin{verbatim}
:- set_pita(&lt;parameter&gt;,&lt;value&gt;).
\end{verbatim}
or
\begin{verbatim}
:- set_mc(&lt;parameter&gt;,&lt;value&gt;).
\end{verbatim}
after initialization (\verb|:-pita.| or \verb|:-mc.|) but outside \verb|:-begin/end_lpad.|
The current value can be read with
\begin{verbatim}
?- setting_pita(&lt;parameter&gt;,Value).
\end{verbatim}
or
\begin{verbatim}
?- setting_mc(&lt;parameter&gt;,Value).
\end{verbatim}
from the top-level.
The available parameters common to both \verb|pita| and \verb|mcintyre| are:
\begin{itemize}
\item 
	 \verb|epsilon_parsing|: if (1 - the sum of the probabilities of all the head atoms) is larger than 
    \verb|epsilon_parsing|,
		then \texttt{pita} adds the null event to the head. Default value \texttt{0.00001}.
\item \verb|single_var|: determines how non ground clauses are treated: if \texttt{true}, a single random variable is assigned to the whole non ground clause, 
if \texttt{false}, a different random variable is assigned to every grounding of the clause. Default value \texttt{false}.
\end{itemize}
Moreover, \verb|pita| has the parameters
\begin{itemize}
\item \verb|depth_bound|: if \texttt{true}, the depth of the derivation of the goal is limited to the value of the \texttt{depth} parameter.  Default value \texttt{false}.
\item  \texttt{depth}: maximum depth of derivations when  \verb|depth_bound| is set to \texttt{true}. Default value \texttt{5}.
\item \verb|prism_memoization|: \verb|false|: original prism semantics, \verb|true|: semantics with memoization
\end{itemize}
If \verb|depth_bound| is set to \verb|true|, derivations are depth-bounded so you can query also programs
containing infinite loops, for example programs where queries have an infinite number of explanations. However the probability that is returned is guaranteed only to be a lower bound,
see for example \href{http://cplint.eu/e/markov_chaindb.pl}{\texttt{markov\_chaindb.pl}}

\verb|mcintyre| has the parameters
\begin{itemize}
\item \verb|min_error|: minimal width of the binomial proportion confidence interval for the probability of the query. When the confidence interval for the probability of the query is below \verb|min_error|, 
the computation stops.
 Default value \verb|0.01|.
\item 
\verb|k|:  the number of samples to take before checking whether the the binomial proportion confidence interval is below \verb|min_error|.
Default value \verb|1000|.
\verb|max_samples|: the maximum number of samples to take. This is used when the probability of the
query is very close to 0 or 1. In fact \verb|mcintyre| also checks for the validity of the
the binomial proportion confidence interval: if less than 5 failures or successes are sampled,
even if the width of the confidence interval is less than \verb|min_error|, the computation continues.
This would lead to non-termination in cases where the probability is 0 or 1. 
\verb|max_samples| ensures termination.
 Default value \verb|10e4|.
\item \verb|prism_memoization|: \verb|false|: original prism semantics, \verb|true|: semantics with memoization
\end{itemize}
The example \href{http://cplint.eu/e/markov_chain.pl}{\texttt{markov\_chain.pl}}
shows that \verb|mcintyre| can perform inference in presence of an infinite number of explanations for 
the goal. Differently from \verb|pita|, no depth bound is necessary, as the probability of selecting
the infinite computation branch is 0. However, also \verb|mcintyre| may not terminate if loops not
involving probabilistic predicates are present.

If you want to set the seed of the random number generator, you can use SWI-Prolog predicates \verb|setrand/1| and \verb|getrand/1|, see
\href{http://www.swi-prolog.org/pldoc/doc_for?object=setrand/1}{SWI-Prolog manual}.</pre></body></html>