Skip to content

Commit

Permalink
Solver tests updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
shinmorino committed Nov 7, 2018
1 parent 45682fc commit ec20518
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
15 changes: 11 additions & 4 deletions sqaodpy/tests/test_bipartite_graph_annealer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,16 @@ def anneal(self, an) :
an.prepare()
an.randomize_spin()

Ginit, Gfin = 5, 0.01
beta = 1. / 0.0001
prefs = an.get_preferences()
algo = prefs['algorithm']

if algo == sq.algorithm.sa_naive or algo == sq.algorithm.sa_coloring :
Ginit, Gfin = 10, 0.02
beta = 1. # not used.
else :
Ginit, Gfin = 5, 0.02
beta = 1. / 0.03

nSteps = 100

G = Ginit
Expand All @@ -181,7 +189,6 @@ def anneal(self, an) :
G *= tau
an.make_solution()


def _test_anneal_minimize(self, algorithm, m) :
N0, N1 = 10, 8
an = self.anpkg.bipartite_graph_annealer(dtype=self.dtype)
Expand Down Expand Up @@ -264,7 +271,7 @@ def test_set_algorithm(self) :

def test_anneal_sa_naive(self) :
self._test_anneal_minimize(sq.algorithm.sa_naive, 1)
self._test_anneal_maximize(sq.algorithm.sa_naive, 2)
self._test_anneal_maximize(sq.algorithm.sa_naive, 1)
self._test_anneal_hamiltonian(sq.algorithm.sa_naive, 1)

def test_anneal_sa_coloring(self) :
Expand Down
13 changes: 10 additions & 3 deletions sqaodpy/tests/test_dense_graph_annealer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,17 @@ def anneal(self, an) :
an.prepare()
an.randomize_spin()

Ginit, Gfin = 5, 0.01
beta = 1. / 0.005
prefs = an.get_preferences()
algo = prefs['algorithm']

if algo == sq.algorithm.sa_naive or algo == sq.algorithm.sa_coloring :
Ginit, Gfin = 10, 0.02
beta = 1. # not used.
else :
Ginit, Gfin = 5, 0.02
beta = 1. / 0.03

nSteps = 100

G = Ginit
tau = exp(log(Gfin / Ginit) / nSteps)
for loop in range(0, nSteps) :
Expand Down

0 comments on commit ec20518

Please sign in to comment.