View on GitHub

Bachelor thesis

Reinforcement learning and evolutionary algorithms for CHSH nonlocal games

Welcome

I am Jan Pastorek and this is my webpage for bachelor thesis.

Name of an assignment

Machine learning for nonlocal games

Supervisor

Mgr. Daniel Nagaj, PhD.

Anotation

Nonlocal games are a key concept in quantum information, utilized from complexity theory to certification of quantum devices. They involve two or more players that win if they provide properly correlated answers to questions. The typical example is the CHSH game, related to Bell inequalities that can be violated by quantum mechanics. In this game, quantum players have a higher winning probability than classical players. Actually determining the optimal winning probability is a difficult problem in general. In this thesis, the student will investigate a variety of nonlocal games and search for optimal quantum strategies with the help of machine learning strategies (reinforcement learning).

Goal

Optimalization of quantum strategies for non-local CHSH games via machine learning and evolutionary algorithms.

Code

see readme at Project and download project files here

Bachelor thesis

Download File

Training defense

Video

Structure of text - Main chapters

  1. Introduction (What is the problem? Why it is important and interesting?)
  2. Quantum Mechanics
  3. Non local games ( problem in details)
  4. Reinforcement machine learning (How are we going to solve this? -- Methods)
  5. Genetic algorithms
  6. Simulated annealing
  7. Implementation (How have we solved this?)
  8. Results
  9. Discussion and conclusion

Diary (in Slovak)

Click and see!
  • 16.2 - 23.2
    • Implementoval som GPU tensorflow model do trénovania môjho Reinforcement Agenta.
    • Pracoval som na funkcii, ktorá porovnáva najlepšiu klasickú a najlepšiu kvantovú taktiku. A vyberie také hry, ktoré majú najväčšie rozdiely.
    • Pridal som nové actions, ktoré vie vykonávať agent. (spomaľ, zrýchli)
    • Refactoring a väčšia abstrakcia hrier, genetických algoritmov etc.
  • 23.2 - 2.3
    • Implementoval som PyTorch Deep Reinforcement DQN Agenta
    • Pracoval som na funkcii, ktorá porovnáva najlepšiu klasickú a najlepšiu kvantovú taktiku. A vyberie také hry, ktoré majú najväčšie rozdiely - upravil som ju, aby fungovala spravne.
    • Stretol som sa so skolitelom - urcili sme si uz finalne ciele mojej bakalarky
    • Refactoring.
    • Pracoval som na kapitole NonLocal games v LaTeXu
  • 2.3 - 9.3
    • Snazil som sa optimalizovat DQN agenta
    • Implementoval som databazu, do ktorej sa budu ukladat uz preskumane hry, a ak sa znovu preskumaju, tak upsert ak sa najde lepsia hodnota.
    • Stretol som sa so skolitelom - zhodnotili sme tohtotyzdnovu pracu
    • Refactoring v triede Environment.
    • Urobil som state diagram, ako sa uci reinforcement learning, ako je to strukturovane
    • Viacere parametre som povytiahol von, nech si to pouzivatel moze sam nastavit
    • Pracoval som na kapitole NonLocal games v LaTeXe
    • Pracoval som na kapitole Reinforcement learning v LaTeXe
  • 9.3 - 16.3
    • Snazil som sa optimalizovat DQN agenta, jeho ucenia pomocou memoizacie
    • Doplnil som nove stlpce do databazy (predtym som si tam neukladal cestu, ktoru sa naucil)
    • Stretol som sa so skolitelom - zhodnotili sme tohtotyzdnovu pracu
    • Refactoring nad v podstate vsetkymi triedami.
    • Doplnil som state diagram, ktory ukazuje co robi Environemnt v jednom kroku (sluzi to nato, aby bolo vidno, ze jeden hrac je od druheho oddeleny)
    • Podarilo sa mi rozbehat PyTorch na GPU
    • Zacal som implementovat Complex PyTorch siet (lebo kvantovy stav moze byt aj komplexny)
    • Odskusal som si optimalizaciu hyperparametrov pomocou genetic algoritmu
    • Pridal som zopar dalsich testov
    • Napisal som si viacero reward funkcii a tie tiez som zahrnul ako parameter do genetic algoritmu (aby pripadne vybral tu optimalznu z nich)
    • Pracoval som na kapitole Reinforcement learning v LaTeXe
  • 16.3 - 23.3
    • Stretol som sa s panom Petrovicom a radil som sa s nim ohladom reinforcement learningu
    • Implementoval som annealing pri vybere bran
    • Stretol som sa so skolitelom - zhodnotili sme tohtotyzdnovu pracu,
    • Refactoring.
    • Zacal som implementovat Complex PyTorch siet (lebo kvantovy stav moze byt aj komplexny), ale nakoniec teda rozlozim complexny vektor na 2*taky dlhy realnych cisiel
    • Pracoval som na kapitole Reinforcement learning a Nonlocal games v LaTeXe
    • Spracoval som prezentáciu pre svoju bakalársku prácu
  • 23.3 - 30.3
    • Refactoring
    • Nechal som vypocty ist 1 den, a vysledky som spracoval a poslal skolitelovi
    • Pracoval som na kapitole Reinforcement learning a Nonlocal games v LaTeXe
  • 30.3 - 6.4
    • Refactoring
    • Prvotná analýza výsledkov.
    • Testovanie hypotéz
  • 6.4 - 13.4
    • Refactoring
    • Škálovanie hry pre 2xEPR páry pre XOR paralelne CHSH hry
    • Študoval som teóriu zložitostí, nelokálne hry = trieda zložitostí MIP*, pretože mám o tom jednu podkapitolu
    • Dopísal som kapitoly Nonlocal games a Reinforcement learning
  • 13.4 - 20.4
    • Refactoring a dokumentácia kódu
    • Postupne opisujem implementaciu
  • 20.4 - 27.4
    • Refactoring a dokumentácia kódu, už som skončil implementáciu
    • Postupne opisujem implementaciu, robím obrázky a diagramy, ako u mna prebieha vypocet a ako na seba tie algoritmy nadvazuju, tiez ako si reprezentujem dolezite hodnoty, co si ukladam a opisujem aj dolezite metody pre tento problem
  • 27.4 - 4.5
    • Refactoring a dokumentácia kódu
    • Doopisoval som implementaciu, uz zapracovavam skolitelove komentare a este pridavam nejake grafy do vysledkov, ktore opisujem
    • Už robím na závere bakalárskej práce
  • 4.5 - 11.5
    • Refactoring, dokumentácia kódu (uz som si vygeneroval dokumentaciu z kodu) a doladzovanie textu

Deadlines, Milestones

Sources

References

Presentation of sources, and, plan and progress of work