Skip to content

Commit

Permalink
Merge pull request nojhan#59 from IOHprofiler/Ising-Models
Browse files Browse the repository at this point in the history
correction of ising models
  • Loading branch information
FurongYe authored Sep 21, 2020
2 parents 2a708c9 + 7a9097b commit 72f838b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Problems/PBO/f_ising_ring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class Ising_Ring : public IOHprofiler_problem<int> {
double internal_evaluate(const std::vector<int> &x) {
int result = 0, n = x.size();

int neig;
int neighbor;
for (int i = 0; i < n; ++i) {
neig = x[modulo_ising_ring((i - 1) , n)];
result += (x[i] * neig) - ((1 - x[i]) * (1 - neig));
neighbor = x[modulo_ising_ring((i - 1) , n)];
result += (x[i] * neighbor) + ((1 - x[i]) * (1 - neighbor));
}
return (double)result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Problems/PBO/f_ising_torus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Ising_Torus : public IOHprofiler_problem<int> {
neighbors[0] = x[modulo_ising_torus(i + 1, lattice_size) * lattice_size + j];
neighbors[1] = x[i * lattice_size + modulo_ising_torus((j + 1) , lattice_size)];
for (neig = 0; neig < 2; neig++) {
result += (x[i*lattice_size + j] * neighbors[neig]) - ((1 - x[i * lattice_size + j]) * (1 - neighbors[neig]));
result += (x[i*lattice_size + j] * neighbors[neig]) + ((1 - x[i * lattice_size + j]) * (1 - neighbors[neig]));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Problems/PBO/f_ising_triangular.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Ising_Triangular : public IOHprofiler_problem<int> {
neighbors[2] = x[modulo_ising_triangular((i + 1) , lattice_size) * lattice_size + modulo_ising_triangular((j + 1), lattice_size)];

for (neig=0; neig < 3; neig++) {
result += (x[i * lattice_size + j] * neighbors[neig]) - ((1 - x[i * lattice_size + j]) * (1 - neighbors[neig]));
result += (x[i * lattice_size + j] * neighbors[neig]) + ((1 - x[i * lattice_size + j]) * (1 - neighbors[neig]));
}
}
}
Expand Down

0 comments on commit 72f838b

Please sign in to comment.