Preferences

Solvers in sqaod has preferences, which are defined as values with keywords. In v1.0.x, following preferences are defined.

keyword access type description
common preferences
algorithm R/W str select algorithm.
precision RO str numerical precision (double/float)
device RO str computing device an annlaer is using
preference available on annealers
n_trotters R/W positive integer number of trotters for annealers.
preference available on brute-force searcher
tile_size R/W positive integer tile size for dense graph brute-force searchers
tile_size_0 R/W positive integer tile size 0 for bipartite graph brute-force searchers
tile_size_1 R/W positive integer tile size for bipartite graph brute-force searchers

algorithm

algorithm is a R/W preference to select sovler algorithm. You can select algorithm by passing sqaod.algorithm to annealers’ set_preference() method.

ex.

import sqaod as sq
import sqoad.algorithm as algo

W = create QUBO ...

# create a dense graph annealer to minimize QUBO(W) energy.
ann = sq.cuda.dense_graph_annealer(W, sqaod.minimize)

# select algorithm.
ann.set_preferences(algorithm = algo.coloring)

Note

  • Each solver has its default SQA algorithm and SA algorithm. If you set sqaod.default as algorith, an annealer selects its default one.
  • For cases of n_trotters == 1, an annealer will select its SA default algorithms because SQA algorithms do not work in these cases.
  • If an user selects an unsupported algorithm, solver will select its default algorithm, and log it.

Dense Graph Annealer Algorithms

Annealres in sqaod implements algorithms shown below.

Annealer class naive coloring sa_naive sa_coloring
sqaod.py.DenseGraphAnnealer D x x  
sqaod.cpu.DenseGraphAnnealer x D d  
sqaod.cuda.DenseGraphAnnealer   D d  
sqaod.py.BipartiteGraphAnnealer D x D x
sqaod.cpu.BipartiteGraphAnnealer x D x d
sqaod.cuda.BipartiteGraphAnnealer   D   d

D = default SQA algorithm, d = default SA algorithm, x = selectable.

Bipartite Graph Annealer Algorithms

The only algorithm that brute-force searcher has sqaod.algorithm.brute_force_search.

Users are not able to select any other algorithms. If you try to select other algorithms, brute-force searchers simplly ignore it.

sqaod.algorithm

Module level attributes, sqaod.algorithm, is used to select solver algorithm. sqaod.algorithm is defined in sqaod.common, and its atribute is accessible as sqaod.algorithm.default as an example.

sqaod.common.preference.algorithm = <sqaod.common.preference.Algorithm object>

signatures to select algorithms

algorithm signatures are provided as attributes shown below:

default:
select default algorithm. Each solver class has its default algorithm. By specifying algorithm.default, the default algirhtm will be chosen,
naive :
Naive version of SQA algorithm,
coloring :
SQA algorithm is parallelized by using color-coding,
brute_force_search :
Brute-force search. All brute-force searchers have ‘brute_force_search’ algorithm,
sa_default :
select default algorithm for SA(simulated annealing, not SQA),
sa_naive :
naive version of SA,
sa_coloring :
color-code version of SA.
Type:sqaod.common.Algorithm

precision

precision is a read-only attribute to show solver numerical precision.

Value
“float” or “double”.

Note

Solvers in sqaod.py package does not return precision.

device

device is a read-only preference, representing device type used by solvers.

Value

‘CPU’ for solvers in sqaod.cpu package

‘CUDA’ for solvers in sqaod.cuda package.

Note

Solvers in sqaod.py package does not return device.

n_trotters

n_trotters is a read-write preference available in annealers.

Value
positive integer.

For SQA algorithms, n_trotters works to specify number of trotters as the name tells. For SA algorithms, n_trotters works as number of qubit arrays parallelly annealed.

tile_size

tile_size is a read-write preference available in dense graph brute-force searchers.

Value
positive integer.

Brute-force searchers do batched calculation of QUBO energy, and the tile_size preference specifies batch size.

Typically larger tile_size will give better performance.

Some brute-force searchers may correct given values to more optimal ones.

tile_size_0, tile_size_1

The tile_size_0 and tile_size_1 are read-write preferences available in bipartite graph brute-force searchers.

Value
positive integer.

Brute-force searchers do batched calculation of QUBO energy, and the tile_size_0 and tile_size_1 preferences specifie batch size.

Typically larger tile_size will give better performance.

Some brute-force searchers may correct given values to more optimal ones.

sqaod.maximize, sqaod.minimize

Module level attributes, sqaod.maximize and sqaod.minimize are used to specify optimize direction to maximize or minimize QUBO energy. Though these attributes are originally defined in sqaod.common.preference module, they’re imported directly under sqaod package for ease of use.

preference.maximize = <sqaod.common.preference.Maximize object>
preference.minimize = <sqaod.common.preference.Minimize object>