Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting binary initial_state results in wrong solution #231

Closed
j-i-k-o opened this issue Dec 28, 2021 · 1 comment
Closed

setting binary initial_state results in wrong solution #231

j-i-k-o opened this issue Dec 28, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@j-i-k-o
Copy link
Collaborator

j-i-k-o commented Dec 28, 2021

Describe the bug
setting initial_state keyword of sample_qubo with binary variables (0, 1) results in weird answer.

To Reproduce

>>> import openjij as oj
>>> a = oj.SASampler()
>>> a.sample_qubo(Q={(2, 2): -68.55, (0, 2): 0.1, (1, 3): 0.1, (3, 4): 0.1, (1, 4): 0.1, (4, 4): -66.55, (2, 3): 0.1, (1, 1): -69.55, (0, 0): -70.55, (0, 4): 0.1, (0, 3): 0.1, (2, 4): 0.1, (0, 1): 0.1, (3, 3): -67.55, (1, 2): 0.1}, num_sweeps=1000, initial_state=[1,1,0,1,1])
Response(rec.array([([1, 1, 0, 1, 1], -273.6, 1)],
          dtype=[('sample', 'i1', (5,)), ('energy', '<f8'), ('num_occurrences', '<i8')]), Variables([0, 1, 2, 3, 4]), {'system': [], 'sampling_time': 1059.5160019875038, 'execution_time': 900.4790008475538, 'list_exec_times': array([900.47900085]), 'schedule': {'beta_max': 184.20680743952366, 'beta_min': 0.01964981376498782, 'num_sweeps': 1000}}, 'BINARY')

Expected behavior
Result binary array should be [1,1,1,1,1]

Additional context
This error comes from the missing conversion of the binary initial_state array to spin array.

@j-i-k-o j-i-k-o added the bug Something isn't working label Dec 28, 2021
@j-i-k-o
Copy link
Collaborator Author

j-i-k-o commented Jan 18, 2022

solved in the latest version

@j-i-k-o j-i-k-o closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant