A sample is a map from elements to their values.
A sample is a map from elements to their values.
Get the acceptance ratio for the sampler.
Get the acceptance ratio for the sampler.
Called when the algorithm is killed.
Called when the algorithm is killed. By default, does nothing. Can be overridden.
Cleans up the temporary elements created during sampling
Compute the utility of each parent/decision tuple and return a DecisionSample.
Compute the utility of each parent/decision tuple and return a DecisionSample. Each decision algorithm must define how this is done since it is used to set the policy for a decision. For sampling algorithms, this will me a map of parent/decision tuples to a utility and a weight for that combination. For factored algorithms, the DecisionSample will contain the exact expected utility with a weight of 1.0.
Set this flag to true to obtain debugging information.
Set this flag to true to obtain debugging information.
Number of samples taken.
Number of samples taken.
Get the total utility and weight for a specific value of a parent and decision.
Get the total utility and weight for a specific value of a parent and decision.
Get the total utility and weight for all sampled values of the parent and decision.
Get the total utility and weight for all sampled values of the parent and decision.
Called when the algorithm is started before running any steps.
Called when the algorithm is started before running any steps. By default, does nothing. Can be overridden.
Kill the algorithm so that it is inactive.
Kill the algorithm so that it is inactive. It will no longer be able to provide answers.Throws AlgorithmInactiveException if the algorithm is not active.
Resume the computation of the algorithm, if it has been stopped.
Resume the computation of the algorithm, if it has been stopped. Throws AlgorithmInactiveException if the algorithm is not active.
Produce a single sample.
Produce a single sample. In decision MH, we always update the target (parent and decision) since the utilities mights have changed
Sets the policy for the given decision.
Sets the policy for the given decision. This will get the computed utility of the algorithm and call setPolicy on the decision. Note there is no error checking here, so the decision in the argument must match the target decision in the algorithm.
Start the algorithm and make it active.
Start the algorithm and make it active. After it returns, the algorithm must be ready to provide answers. Throws AlgorithmActiveException if the algorithm is already active.
Stop the algorithm from computing.
Stop the algorithm from computing. The algorithm is still ready to provide answers after it returns. Throws AlgorithmInactiveException if the algorithm is not active.
Test Metropolis-Hastings by repeatedly running a single step from the same initial state.
Test Metropolis-Hastings by repeatedly running a single step from the same initial state. For each of a set of predicates, the fraction of times the predicate is satisfied by the resulting state is returned. By the resulting state, we mean the new state if it is accepted and the original state if not.
Metropolis-Hastings Decision sampler. Almost the exact same as normal MH except that it keeps track of utilities and probabilities (to compute expected utility) and it implements DecisionAlgorithm trait