To compare quantum annealing with traditional way, I created this example code.
- Python 3.x
Optional
if you want to use GPU(CUDA), get libraries as followings:
pip install cupy
pip install chainer
https://qnncloud.com/index-jp.html
-
Put code and inputdata(*.jij) in same directory
-
just run
python SimulatedAnnealing.py
no argument. Non :(
Change code directly
#Definition
T_MAX = 100.0
T_MIN = 0.001
MAX_STEMPS = 20
T_LOOP = 600
- T_MAX A starting temperature for a simulation
- T_MIN A final temperature for a simulation
- MAX_STEMPS How many numbers do you chop between T_MAX and T_MIN
- T_LOOP How many time do you try to change a status on each temperature
You can use data which is donwloaded from QNNCloud web page.
#f = open('201712030215556824-Jij.json', 'r') # for 100 CHANGE PERSON =100
f = open('201711282214561557-Jij.json', 'r') # for 1000 CHANGE PERSON =1000
#f = open('201712052235195895-Jij.json', 'r') # for 2000 CHANGE PERSON =2000
Adjust "PERSON" to fit a problem size. (equal to input data)
PERSONS = 1000
- PERSONS You can change this variable to fit Input data size
TRIAL=1
- TRIAL How many times do you wanna repeat Simulated Annealing?