Comments (7)
Hello,
We would like to ask you to please post these questions in the Leap Community forums:
https://support.dwavesys.com/hc/en-us/community/topics
This is a great way to connect with other users, browse available information, and get help from our Support team.
The Practical Applications or Coding Tips and Tricks sections might be good spots to ask some of these questions.
The GitHub Issues section is more geared towards code changes and bugs.
Thank you for your understanding and interest!
from dwave-ocean-sdk.
Definitions from the D-Wave Docs.
from dwave-ocean-sdk.
I am still working through this problem. I wrote out some math that needs reformulated as a QUBO or ISING problme.
from dwave-ocean-sdk.
The objective function is a minimization problem. Any given variable x
is a binary variable. I need to find the value of x
at which y
takes its minimum value. Then, the issue is solving for f
. So I will need to formulate f
as a series of QUBOs.
from dwave-ocean-sdk.
One solution is Grover's Algorithm. I was able to run Grover's algorithm on the D-wave machine. I'm not sure if this has been done before, but I am worried I still need a logical breakthrough for full convergence.
In:
import matplotlib.pyplot as plt
import numpy as np
import string
import hashlib
from math import sqrt, pi
from collections import OrderedDict
from statistics import mean
def ShowGraph(amplitude_value, n):
y_position = np.arange(n)
plt.bar(y_position, amplitude_value.values(), align='center', color='g')
plt.xticks(y_position, amplitude_value.keys())
plt.ylabel('Amplitude Value')
plt.title('Grovers Algorithm')
plt.show()
def GetOracle(xvalue):
return hashlib.sha256(bytes(xvalue, 'utf-8')).hexdigest()
def ExecuteGrover(target, objects, nvalue, rounds):
y_pos = np.arange(nvalue)
amplitude = OrderedDict.fromkeys(objects, 1/sqrt(nvalue))
for i in range(0, rounds, 2):
for k, v in amplitude.items():
if GetOracle(k) == target:
amplitude[k] = v * -1
average = mean(amplitude.values())
for k, v in amplitude.items():
if GetOracle(k) == target:
amplitude[k] = (2 * average) + abs(v)
continue
amplitude[k] = v-(2*(v-average))
return amplitude
target_algorithm = '1'
objects_grover = ('4', '5', '1', '7','9','11','97')
number = len(objects_grover)
amplitude_grover = OrderedDict.fromkeys(objects_grover, 1/sqrt(number))
amplitude_grover[target_algorithm] = amplitude_grover[target_algorithm] * -1
print(amplitude_grover)
average_grover = mean(amplitude_grover.values())
print("Mean is {}".format(average_grover))
for k, v in amplitude_grover.items():
if k == target_algorithm:
amplitude_grover[k] = (2 * average_grover) + abs(v)
continue
amplitude_grover[k] = v-(2*(v-average_grover))
print(amplitude_grover)
needle_value = "#000000000000000000068983c42ee2e725ea9f07a2ec71ea7d7b2df133077ee2"
haystack_value = string.ascii_lowercase
num = len(haystack_value)
num_rounds = int((pi / 4) * sqrt(num))
print("number of rounds are {}".format(num_rounds))
Out:
Leap IDE /workspace/rna-folding/tests $ python3 tests.py
OrderedDict([('4', 0.3779644730092272), ('5', 0.3779644730092272), ('1', -0.3779644730092272), ('7', 0.3779644730092272), ('9', 0.3779644730092272), ('11', 0.3779644730092272), ('97', 0.3779644730092272)])
Mean is 0.26997462357801943
OrderedDict([('4', 0.16198477414681167), ('5', 0.16198477414681167), ('1', 0.9179137201652661), ('7', 0.16198477414681167), ('9', 0.16198477414681167), ('11', 0.16198477414681167), ('97', 0.16198477414681167)])
number of rounds are 4
from dwave-ocean-sdk.
How do I include code blocks in the Leap Community forum? @djohnson-dwavesys
from dwave-ocean-sdk.
Link to the problem in the community forum.
from dwave-ocean-sdk.
Related Issues (20)
- Deprecate dwave-greedy, dwave-neal and dwave-tabu in favor of dwave-samplers
- The 'Getting Started' section of README doesn't explain where to put the API key HOT 1
- How to count time ? HOT 2
- Please allow to do task submission and any other operations using C++
- Switch quadratic interaction in diet example to ints
- Look into migrating from sphinx-panels to sphinx-design
- REAL variables (e.g. 'rice') cannot have interactions error in Diet Planning example HOT 2
- Consider splitting the "test_individual_pkgs" test in CI into multiple jobs
- Drop support for Python 3.7 HOT 1
- We should redirect old individual package docs to the main Ocean docs
- multi objective framing
- Unable to install due to failed building wheel for rectangle-packer HOT 5
- Sphinx>4.5.0 does not render :code: with single backslash HOT 2
- File I/O
- dwave.conf issue HOT 1
- Collision of libraries at HPC Forschungszentrum Jülich HOT 2
- Error: Invalid configuration when using Sampler() HOT 4
- Error in one Diet Planning code line
- Upgrade CI to use Apple silicon resources only
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwave-ocean-sdk.