Class MetropolisHastings

java.lang.Object
org.oristool.simulator.samplers.MetropolisHastings
All Implemented Interfaces:
Sampler

public final class MetropolisHastings extends Object implements Sampler
Sampler for general PDFs using the Metropolis-Hastings algorithm.
  • Constructor Details

    • MetropolisHastings

      public MetropolisHastings(Function f)
      Builds a sampler for the given function.
      Parameters:
      f - a PDF function
  • Method Details

    • getSample

      public BigDecimal getSample()
      Description copied from interface: Sampler
      Returns the next sample.
      Specified by:
      getSample in interface Sampler
      Returns:
      next sample
    • computeSample

      public BigDecimal computeSample()
      Computes the next sample according to the Metropolis-Hastings algorithm.
      Returns:
      the next sample