Skip to content

Latest commit

 

History

History
30 lines (30 loc) · 1.03 KB

File metadata and controls

30 lines (30 loc) · 1.03 KB

Simulated Annealing sampler

This code implements a Simulated Annealing sampler for QUBO problems. Refer to Optimization by Simulated Annealing for an overview of this method.

How to run

You will need a C++ compiler installed. Compile with make. Two executables will be under the build/bin directory. An input matrix can be solved as follows:

build/bin/simAnnSingle.out /path/to/file.txt

The solution can be written to file by specifying one more argument:

build/bin/simAnnSingle.out /path/to/input/file.txt /path/to/output/file.txt 

An example of a valid input matrix is the following one:

-1 8 8 8 0 0 0 0
0 -1 0 8 0 0 0 0
0 0 -1 8 8 0 8 0
0 0 0 -1 0 8 0 8
0 0 0 0 -1 0 8 0
0 0 0 0 0 -1 0 8
0 0 0 0 0 0 -1 8
0 0 0 0 0 0 0 -1

Expected output

If an output file is specified, the output will be in the following form:

1,0,0,0,1,1,0,0
-3

The first line contains the value of each binary variable and the second line is the energy of the best solution.