Giter Club home page Giter Club logo

Comments (7)

djohnson-dwavesys avatar djohnson-dwavesys commented on July 30, 2024 1

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.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

Definitions from the D-Wave Docs.

Screen Shot 2023-01-07 at 7 38 55 AM

Screen Shot 2023-01-07 at 7 38 47 AM

Screen Shot 2023-01-07 at 7 38 33 AM

Screen Shot 2023-01-07 at 7 38 23 AM

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

I am still working through this problem. I wrote out some math that needs reformulated as a QUBO or ISING problme.

Screen Shot 2023-01-08 at 6 53 53 PM

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

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.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

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

Screen Shot 2023-01-10 at 12 40 26 PM

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

How do I include code blocks in the Leap Community forum? @djohnson-dwavesys

from dwave-ocean-sdk.

Bhaney44 avatar Bhaney44 commented on July 30, 2024

Link to the problem in the community forum.

from dwave-ocean-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.