1. A computer-implemented method for defining a structured stochastic automaton in which a computer system performs operations comprising: obtaining at least one state space (SS) for variables of interest relating to a problem of interest; obtaining one or more densities (D) defining pure functions over locations in said at least one SS; obtaining one or more kernels (K) defining a stochastic walk through said at least one SS; and providing a transformed model by an inference engine, said transformed model consisting of at least one state space SS, zero or more densities D, and at least one kernel K, and wherein said inference engine transforms the problem of interest to automatically provide an appropriate inference algorithm or restructures the existing problem of interest to be more efficient.