This code implements a Simulated Annealing sampler for QUBO problems. Refer to Optimization by Simulated Annealing for an overview of this method.
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.txtThe 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
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.