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

Womanium Final Assignment - Mohammadreza_Khodajou_Masouleh #321

Merged
merged 3 commits into from
Aug 5, 2024

Conversation

PhiloMathysicist
Copy link
Contributor

@PhiloMathysicist PhiloMathysicist commented Jul 26, 2024

Womanium Final Assignment

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Hi. I adjusted some mistakes in the experimental case and took care of some misspellings!
Correct format: Womanium Final Assignment - Mohammadreza_Khodajou Masouleh
@PhiloMathysicist
Copy link
Contributor Author

PhiloMathysicist commented Aug 1, 2024

Hi. I adjusted some mistakes in the experimental case and took care of some misspellings!
The correct format: Womanium Final Assignment - Mohammadreza_Khodajou Masouleh

@Nadav138 Nadav138 added the Womanium Womanium 2024 Summer Program label Aug 4, 2024
@Nadav138
Copy link
Contributor

Nadav138 commented Aug 5, 2024

Good job!
Score: 7/10; we asked for 16 nodes quantum walk graph, not 8.

@Nadav138 Nadav138 closed this Aug 5, 2024
@Nadav138 Nadav138 reopened this Aug 5, 2024
@Nadav138 Nadav138 merged commit f4f000f into Classiq:main Aug 5, 2024
4 checks passed
@PhiloMathysicist
Copy link
Contributor Author

PhiloMathysicist commented Aug 5, 2024

In the notebook, three different cases are investigated:

  1. The original 16-node case, where the resultant circuit with all the ingredients have been depicted and the analysis (e.g., the impossibility of the synthesis even with optimization in the Classiq's simulator) is demonstrated. I achieved different circuit widths in the 16-node case and reported one of them. One can easily repeat by uncommenting (on top of the notebook).

  2. I involved the explicit report of the 8-node case for better understanding of the end result and in hindsight, I think I got to wrap my head around the final bizarre 8-node bar chart in the IDE (It's an evolution through time, so every node gets to be connected eventually with a probability-in this case (meaning that if this is the correct interpretation), I found the visualization in the IDE not helpful, unlike many other instances. Maybe it would have been better to have the illustration of the counts/probs repeated for every single vertex in between [0-num_nodes-1] within the IDE. I found it confusing.

  3. The 5-node case:
    Now, one section of the task also asked for feeling free to investigate other cases:

A. Create a well-detailed Python Jupyter notebook that explains your algorithm, including the code parts covered in class, and pictures/figures where relevant.

Utilize the Python code from class: quantum_walk_circle_example.pyLinks to an external site.. It can be found directly also in the Classiq Git Library in the community/womanium/assignmentsLinks to an external site. folder.
Feel free to extend the example beyond the requirements here and what was covered in class.

I subsequently involved the following as an interesting example:

What if one wishes to investigate a case in which the number of nodes does not necessarily equate to 2^(number of qubits)? Is the implementation in the notebook correct? How can it be improved?

@PhiloMathysicist
Copy link
Contributor Author

Hi, @EdenSchirmanClassiq. Can you provide further insights?

@EdenSchirmanClassiq
Copy link
Member

Hi @PhiloMathysicist thanks for popping this.
Indeed you did some nice work here.

Is there any specific question you want to ask?

Regarding the interpretation of the histograms - I'm not sure what should be the theoretical distribution, we haven't made this analysis in class. If you want to conclude something from them, I would recommend first analyzing it theoretically in order to understand what you expect to receive and only then I would compare it.

Nonetheless, I'm regrading your submission to 9/10.

Best,
Eden

@PhiloMathysicist
Copy link
Contributor Author

PhiloMathysicist commented Aug 20, 2024

Thanks, @EdenSchirmanClassiq. I am most interested in the latest 5-node case's analysis.

About the histograms of the 8-node case, I reckon they are representative of the eventual probability distributions, meaning that after going through many walks (a relation between the uniformization of the histogram's distribution with increasing the shots and the number of walks?), there can be ultimately connections between say node 0 and node 6, even though they are not to be connected initially. In the IDE though, one can mostly observe this explicitly for node (0-7) and only adjacent nodes (0). Anyway, this is my initial understanding. Maybe incorrect.

More importantly, I wanted to know if these code pieces are correctly representative of the 5-node case?

num_nodes = 5
num_q = math.ceil(math.log2(num_nodes)) 
print(num_q)

3

the other adjustments include:

the C-operation:

def C_iteration(i: int, vertices: QNum, adjacent_vertices: QNum):
  
    probs=[0]*(2**(num_q))

    if i == 0:
        probs[i + 1] = 1.0  
    elif i == num_nodes - 1:
        probs[i - 1] = 1.0  
    elif i in range(1, num_nodes - 1):
        probs[i - 1] = probs[i + 1] = 0.5

& the edge-oracle:

@qfunc
def edge_oracle(res: Output[QBit], vertices: QNum, adjacent_vertices: QNum):
   
    res |= ((((vertices) <= num_nodes-1) & ((adjacent_vertices)  <= num_nodes-1)) & (((vertices - adjacent_vertices) == 1) | ((adjacent_vertices - vertices) == 1)))

The other parts are similar to the typical cases (4-8-16-32-etc.,)

The output probabilities:

Node=0, probs vec =[0, 1.0, 0, 0, 0, 0, 0, 0]
Node=1, probs vec =[0.5, 0, 0.5, 0, 0, 0, 0, 0]
Node=2, probs vec =[0, 0.5, 0, 0.5, 0, 0, 0, 0]
Node=3, probs vec =[0, 0, 0.5, 0, 0.5, 0, 0, 0]
Node=4, probs vec =[0, 0, 0, 1.0, 0, 0, 0, 0]

The corresponding C and S circuit details can be found in the last part of DQWalk.

Now my question is: Are these correct? There seems to be an issue, as I get a histogram after going through with these definitions, and the histogram already involves node 7! There should be no node 7 at all (or its probability should be zero)! So at the very least, something should be refined. My guess is the probability in C above, but I tried to lead those attributed to nodes 5-6-7 to zero by adjusting the oracle. It doesn't work evidently! Thanks for going through this Eden, if you have the time.

@PhiloMathysicist
Copy link
Contributor Author

Hi. Are there any updates on the inquiry above, @EdenSchirmanClassiq now that the program is concluded? Specifically, I'm most curious about the last paragraph of the comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Womanium Womanium 2024 Summer Program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants