openjij
Framework for the Ising model and QUBO.
Loading...
Searching...
No Matches
openjij.sampler.sa_sampler Namespace Reference

Classes

class  SASampler

Functions

 geometric_hubo_beta_schedule (sa_system, beta_max, beta_min, num_sweeps, seed=None)
 _ising_beta_range_statistics (cxxgraph, *, from_qubo)
 _estimate_initial_beta (scaled_sigma, scales, quantile)
 _geometric_schedule_segment (beta_start, beta_end, num_sweeps, sweeps_per_beta, *, skip_start=False)
 geometric_ising_beta_schedule (Union[openjij.cxxjij.graph.Dense, openjij.cxxjij.graph.CSRSparse] cxxgraph, beta_max=None, beta_min=None, num_sweeps=1000, seed=None, *, from_qubo=False, use_quantiles=True)

Function Documentation

◆ _estimate_initial_beta()

openjij.sampler.sa_sampler._estimate_initial_beta ( scaled_sigma,
scales,
quantile )
protected

References _estimate_initial_beta().

Referenced by _estimate_initial_beta(), and geometric_ising_beta_schedule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _geometric_schedule_segment()

openjij.sampler.sa_sampler._geometric_schedule_segment ( beta_start,
beta_end,
num_sweeps,
sweeps_per_beta,
* ,
skip_start = False )
protected

Referenced by geometric_ising_beta_schedule().

Here is the caller graph for this function:

◆ _ising_beta_range_statistics()

openjij.sampler.sa_sampler._ising_beta_range_statistics ( cxxgraph,
* ,
from_qubo )
protected
Per-spin coefficient statistics of an Ising graph.

Returns:
    Each spin's RMS local field in scaled units, the corresponding
    per-spin scale, and each spin's smallest nonzero coefficient in
    the original units. Spins with all-zero coefficients are omitted
    from the last array.

Referenced by geometric_ising_beta_schedule().

Here is the caller graph for this function:

◆ geometric_hubo_beta_schedule()

openjij.sampler.sa_sampler.geometric_hubo_beta_schedule ( sa_system,
beta_max,
beta_min,
num_sweeps,
seed = None )

Referenced by openjij.sampler.sa_sampler.SASampler._sample_hubo_old().

Here is the caller graph for this function:

◆ geometric_ising_beta_schedule()

openjij.sampler.sa_sampler.geometric_ising_beta_schedule ( Union[openjij.cxxjij.graph.Dense, openjij.cxxjij.graph.CSRSparse] cxxgraph,
beta_max = None,
beta_min = None,
num_sweeps = 1000,
seed = None,
* ,
from_qubo = False,
use_quantiles = True )
Make a geometric cooling schedule with an optional colder tail.

For single-spin updates, estimate the start as ``ln 2 / Q_0.9(sigma)``,
where ``sigma_i = sqrt(h_i^2 + sum_j J_ij^2)``. The main interval ends
at ``ln 100 / (2 Q_0.1(m))``, floored at ten times the start. Here
``m_i`` is the smallest nonzero coefficient touching spin ``i``.
Spins with no such coefficient are excluded from the cold statistics.

The tail endpoint is ``ln(N_min / 0.01) / (2 m_min)``. The minimum
group of ``N_min`` spins is counted with relative tolerance 1e-9.
When the tail endpoint is colder than the main interval, the final
10 percent of sweeps cool geometrically to it, provided there is
room for at least two sweeps in each interval. A supplied final
endpoint sets the end of a single geometric interval and caps an
automatically estimated starting beta.
Automatic endpoints that exceed float range use the largest finite beta.

The sampler omits fields within cancellation roundoff when it converts
a BINARY model to Ising. For a model supplied in SPIN form, every
nonzero coefficient contributes, including residue from an earlier
conversion.

Args:
    cxxgraph (Union[openjij.cxxjij.graph.Dense, openjij.cxxjij.graph.CSRSparse]): Ising graph, must be either `Dense` or `CSRSparse`.
    beta_max (float, optional): final inverse temperature. Estimated if None.
    beta_min (float, optional): initial inverse temperature. Estimated if None.
    num_sweeps (int, optional): number of sweeps. Defaults to 1000.
    seed (int, optional): unused. Kept for backward compatibility.
    from_qubo (bool, optional): ignore local fields within the roundoff
        of converting a binary model to Ising.
    use_quantiles (bool, optional): use the single-spin schedule.
        Cluster updates use the maximum RMS field and smallest
        nonzero coefficient for a single geometric interval.
Returns:
    List of cxxjij.utility.ClassicalSchedule and the beta range
    [final beta, initial beta].

References _estimate_initial_beta(), _geometric_schedule_segment(), and _ising_beta_range_statistics().

Referenced by openjij.sampler.sa_sampler.SASampler.sample().

Here is the call graph for this function:
Here is the caller graph for this function: