:py:mod:`omnisolver.pt.algorithm` ================================= .. py:module:: omnisolver.pt.algorithm Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: omnisolver.pt.algorithm.perform_monte_carlo_sweeps omnisolver.pt.algorithm.should_exchange_states omnisolver.pt.algorithm.exchange_states .. py:function:: perform_monte_carlo_sweeps(replicas: numba.typed.List[omnisolver.pt.replica.Replica], num_sweeps) -> None Perform given number of Monte Carlo sweeps for each replica. The operation is parallelized over replicas. :param replicas: replicas for which to perform sweeps. The caller should make sure that replicas don't share common data (e.g. their states don't point to the same place in memory. :param num_sweeps: number of sweeps to perform. .. py:function:: should_exchange_states(replica_1: omnisolver.pt.replica.Replica, replica_2: omnisolver.pt.replica.Replica) -> bool Determine if given replicas should exchange their states. The probability of exchanging states depends on current energy and temperatures of replicas. in particular, colder replica should always exchange state with hotter replica if its energy is lower. .. py:function:: exchange_states(replica_1, replica_2) Exchange state and energies of two replicas. This function exchanges current states and energies between replicas. All other properties of replicas stay the same. In particular, best energies and best states found so far by each replica remain unchanged. Temperatures (beta) also remain unchanged. This is important for the implementation of PTSampler.