Sign inSign up

herrd1/siquan

By herrd1

•Updated over 5 years ago

A containerized SQA optimizer from http://doi.org/10.5905/ethz-1007-127 with Python support.

Image
0

569

herrd1/siquan repository overview

⁠SiQuAn Optimizer

The SiQuAn library provides a fast implementation for solving spin glasses (z-Operators only) with higher order z-Interactions. The original implementation can be found here: http://doi.org/10.5905/ethz-1007-127⁠

⁠Run the optimizer from within Python

The container includes python bindings. We can start the Python version with:

docker run -it --entrypoint python siquan:latest

In the interactive Python shell we can use the interface to the C++ solver with the following code snippet:

import siquan
dtsqa = siquan.DTSQA()
# possibility to set various parameters
dtsqa.setHSchedule("[10,iF,0]")

# first param: problem description
# second param: number of qubits
resultDict = dtsqa.minimize(
    [(1,[0]), (1.5, [0,1]), (-1., [1,2,3])],
    4)

⁠Run the standalone binary

To run the binary executable, a problem file needs to be supplied. We can mount a folder to the container. It is assumed that this folder contains a input.txt file that describes the problem.

docker run \
    --mount type=bind,source=/path/to/problem/,target=/siquan/input \
    siquan:1.0

Further possible parameters and their default values are:

  • seed: 0
  • steps: 1000
  • remap: sorted,fill,0
  • T: [0.01,0.01]
  • H: [10,iF,0.01]
  • nt: 100

The schedule can be set differently (p linearly evolves from 0 to 1):

  • [10,1] or [10,l,1]: linear ramp from 10 to 1
  • [a,iF,b]: (a * b) / (b + (a - b) * p) This is fast at the beginning and slow towards the end
  • [a,iS,b]: a + b - (a * b) / (a - (a - b) * p) This is slow at the beginning and fast towards the end
  • [a,sS,b]: a + (b - a) * p^2
  • [a,sF,b]: b + (a - b) * (p-1)^2
  • [10,l,2,2,l,1]: first a linear ramp from 10 to 2 and then in the same time a linear ramp from 2 to 1

⁠File format

The first line of the input file contains metadata.

# num_variables num_interactions

A sample input.txt file should look like:

# 3 4
0 -10
0 1 -1
1 2 -1
0 2 -1

The last element of each line is the coupling, and the previous elements are the spins that are involved in the couplings. The first coupling descripes a local field that acts on spin 0. The other couplings are interactions between pairs of spins.

Tag summary

Content type

Image

Digest

Size

166.3 MB

Last updated

over 5 years ago

docker pull herrd1/siquan