Skip to content

Commit

Permalink
Merge pull request #46 from ChitambarLab/processing-nodes-feature
Browse files Browse the repository at this point in the history
Processing nodes feature
  • Loading branch information
bdoolittle authored Nov 17, 2022
2 parents e1e3b45 + 711e1ae commit 2a69613
Show file tree
Hide file tree
Showing 28 changed files with 577 additions and 395 deletions.
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ @misc{qNetVO
title = {qNetVO: the Quantum Network Variational Optimizer},
howpublished = {\url{https://github.com/ChitambarLab/qNetVO}},
url = {https://github.com/ChitambarLab/qNetVO},
version = {v0.1.4},
version = {v0.3.0},
year = {2022},
month = {March},
doi = {10.5281/zenodo.6345834},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Note
</p>
<p>
For optimal use, qNetVO should be used with PennyLane.
QNetVO is currently compatible with PennyLane v0.26.
QNetVO is currently compatible with PennyLane v0.27.
</p>
</div>

Expand Down
64 changes: 36 additions & 28 deletions demos/magic_squares_game_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
"output_type": "stream",
"text": [
"opt score : 0.8888798713795557\n",
"CPU times: user 42.5 s, sys: 183 ms, total: 42.6 s\n",
"Wall time: 42.9 s\n"
"CPU times: user 57.9 s, sys: 777 ms, total: 58.7 s\n",
"Wall time: 1min\n"
]
}
],
Expand Down Expand Up @@ -144,8 +144,8 @@
"output_type": "stream",
"text": [
"opt score : 0.9552447018371052\n",
"CPU times: user 41.7 s, sys: 64.9 ms, total: 41.8 s\n",
"Wall time: 41.8 s\n"
"CPU times: user 1min 14s, sys: 1.11 s, total: 1min 15s\n",
"Wall time: 1min 18s\n"
]
}
],
Expand Down Expand Up @@ -184,48 +184,48 @@
"output_type": "stream",
"text": [
"iteration : 0 , score : 0.4851396844059196\n",
"elapsed time : 0.43509984016418457\n",
"elapsed time : 0.48635411262512207\n",
"iteration : 5 , score : 0.658387385514294\n",
"elapsed time : 0.416733980178833\n",
"elapsed time : 0.5488309860229492\n",
"iteration : 10 , score : 0.7032587972803017\n",
"elapsed time : 0.38210201263427734\n",
"elapsed time : 0.5276150703430176\n",
"iteration : 15 , score : 0.733221432481375\n",
"elapsed time : 0.3533799648284912\n",
"elapsed time : 0.45144104957580566\n",
"iteration : 20 , score : 0.7604316515863423\n",
"elapsed time : 0.36096906661987305\n",
"elapsed time : 0.5519330501556396\n",
"iteration : 25 , score : 0.7851542492948232\n",
"elapsed time : 0.45388293266296387\n",
"elapsed time : 0.5049970149993896\n",
"iteration : 30 , score : 0.8094369348466013\n",
"elapsed time : 0.42354393005371094\n",
"elapsed time : 0.435499906539917\n",
"iteration : 35 , score : 0.8443960620540358\n",
"elapsed time : 0.4234778881072998\n",
"elapsed time : 0.5274088382720947\n",
"iteration : 40 , score : 0.8840567175931876\n",
"elapsed time : 0.44220709800720215\n",
"elapsed time : 0.5031859874725342\n",
"iteration : 45 , score : 0.9084930323464833\n",
"elapsed time : 0.48005199432373047\n",
"elapsed time : 0.4725611209869385\n",
"iteration : 50 , score : 0.9241414919537697\n",
"elapsed time : 0.3932468891143799\n",
"elapsed time : 0.5196230411529541\n",
"iteration : 55 , score : 0.9349621587689507\n",
"elapsed time : 0.3584270477294922\n",
"elapsed time : 0.5121328830718994\n",
"iteration : 60 , score : 0.9423352194469747\n",
"elapsed time : 0.4395608901977539\n",
"elapsed time : 0.45461416244506836\n",
"iteration : 65 , score : 0.9471924325818003\n",
"elapsed time : 0.4401562213897705\n",
"elapsed time : 0.5299582481384277\n",
"iteration : 70 , score : 0.9501685822307565\n",
"elapsed time : 0.428419828414917\n",
"elapsed time : 0.49597597122192383\n",
"iteration : 75 , score : 0.9518896810653898\n",
"elapsed time : 0.43254876136779785\n",
"elapsed time : 0.42364978790283203\n",
"iteration : 80 , score : 0.9528870540918396\n",
"elapsed time : 0.4347259998321533\n",
"elapsed time : 0.5056869983673096\n",
"iteration : 85 , score : 0.953495649595287\n",
"elapsed time : 0.4202408790588379\n",
"elapsed time : 0.49240875244140625\n",
"iteration : 90 , score : 0.9538923772165894\n",
"elapsed time : 0.35238194465637207\n",
"elapsed time : 0.40073585510253906\n",
"iteration : 95 , score : 0.9541664852530811\n",
"elapsed time : 0.38740015029907227\n",
"elapsed time : 0.5333349704742432\n",
"opt score : 0.9543647120506318\n",
"CPU times: user 45.3 s, sys: 154 ms, total: 45.4 s\n",
"Wall time: 45.6 s\n"
"CPU times: user 53.5 s, sys: 293 ms, total: 53.8 s\n",
"Wall time: 54 s\n"
]
}
],
Expand Down Expand Up @@ -264,8 +264,8 @@
"output_type": "stream",
"text": [
"opt score : 0.9998940339308672\n",
"CPU times: user 44.3 s, sys: 236 ms, total: 44.6 s\n",
"Wall time: 44.9 s\n"
"CPU times: user 46.8 s, sys: 235 ms, total: 47 s\n",
"Wall time: 47.4 s\n"
]
}
],
Expand Down Expand Up @@ -340,6 +340,14 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "debb82c5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
102 changes: 51 additions & 51 deletions demos/mermin-klyshko_nonlocality_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@
"quantum bound : 8.0 \n",
"\n",
"classical optimzation\n",
"iteration : 0 , score : 1.6513055781271406\n",
"elapsed time : 0.06955909729003906\n",
"iteration : 5 , score : 3.9999604053418363\n",
"elapsed time : 0.019002914428710938\n",
"iteration : 10 , score : 3.9999998934802883\n",
"elapsed time : 0.019855737686157227\n",
"iteration : 15 , score : 3.9999999993561457\n",
"elapsed time : 0.015079975128173828\n",
"max score : 3.9999999999961067\n",
"iteration : 0 , score : 2.269478144611965\n",
"elapsed time : 0.023085832595825195\n",
"iteration : 5 , score : 3.988660074519093\n",
"elapsed time : 0.022394180297851562\n",
"iteration : 10 , score : 3.9973656038596777\n",
"elapsed time : 0.01487588882446289\n",
"iteration : 15 , score : 3.99919889361163\n",
"elapsed time : 0.014913082122802734\n",
"max score : 3.9997376080773637\n",
"\n",
"quantum optimization\n",
"iteration : 0 , score : -5.158868986983439\n",
"elapsed time : 0.01626300811767578\n",
"iteration : 10 , score : 7.968255599118695\n",
"elapsed time : 0.01659393310546875\n",
"max score : 7.99999883318393\n",
"[tensor(3.07519597, requires_grad=True), tensor(1.50464739, requires_grad=True), tensor(3.06688246, requires_grad=True), tensor(1.49509518, requires_grad=True), tensor(-1.42949351, requires_grad=True), tensor(3.2832468, requires_grad=True)]\n"
"iteration : 0 , score : -1.9692253268465407\n",
"elapsed time : 0.024997711181640625\n",
"iteration : 10 , score : 7.996703574883997\n",
"elapsed time : 0.028477907180786133\n",
"max score : 7.999999879407054\n",
"[tensor(2.30289106, requires_grad=True), tensor(3.87357333, requires_grad=True), tensor(-2.11046267, requires_grad=True), tensor(-0.53976483, requires_grad=True), tensor(1.37831778, requires_grad=True), tensor(-3.33375833, requires_grad=True)]\n"
]
}
],
Expand Down Expand Up @@ -175,25 +175,25 @@
"quantum bound : 22.627416997969522 \n",
"\n",
"classical\n",
"iteration : 0 , score : -0.10021150911505239\n",
"elapsed time : 0.07665300369262695\n",
"iteration : 5 , score : 7.880605211399187\n",
"elapsed time : 0.15471100807189941\n",
"iteration : 10 , score : 7.9812192836653075\n",
"elapsed time : 0.09177589416503906\n",
"iteration : 15 , score : 7.99258190598585\n",
"elapsed time : 0.10307717323303223\n",
"max score 7.996102513699257\n",
"iteration : 0 , score : 2.9165756157510945\n",
"elapsed time : 0.16971588134765625\n",
"iteration : 5 , score : 7.9985747733693895\n",
"elapsed time : 0.12235498428344727\n",
"iteration : 10 , score : 7.999999662006812\n",
"elapsed time : 0.10654401779174805\n",
"iteration : 15 , score : 7.999999998625014\n",
"elapsed time : 0.11244797706604004\n",
"max score 7.999999999991739\n",
"\n",
"quantum optimization\n",
"iteration : 0 , score : 12.10269187921348\n",
"elapsed time : 0.08192992210388184\n",
"elapsed time : 0.11647891998291016\n",
"iteration : 10 , score : 22.62727936273091\n",
"elapsed time : 0.09756183624267578\n",
"elapsed time : 0.09160113334655762\n",
"iteration : 20 , score : 22.62741695961418\n",
"elapsed time : 0.10313200950622559\n",
"elapsed time : 0.17101383209228516\n",
"iteration : 30 , score : 22.627416997411604\n",
"elapsed time : 0.10974502563476562\n",
"elapsed time : 0.10201191902160645\n",
"max score : 22.627416997961234\n",
"[tensor(-0.32305202, requires_grad=True), tensor(1.24774431, requires_grad=True), tensor(-2.94596631, requires_grad=True), tensor(-1.37516999, requires_grad=True), tensor(-3.14499394, requires_grad=True), tensor(-1.57419762, requires_grad=True), tensor(-2.22536667, requires_grad=True), tensor(-0.65457034, requires_grad=True)]\n"
]
Expand Down Expand Up @@ -253,22 +253,22 @@
"\n",
"classical optimization\n",
"iteration : 0 , score : 5.022995939689165\n",
"elapsed time : 0.09735512733459473\n",
"elapsed time : 0.1285238265991211\n",
"iteration : 5 , score : 15.904093925941835\n",
"elapsed time : 0.13842296600341797\n",
"elapsed time : 0.1396007537841797\n",
"max score : 15.990299319049566\n",
"\n",
"quantum optimization\n",
"iteration : 0 , score : -30.816320489400397\n",
"elapsed time : 0.1145029067993164\n",
"elapsed time : 0.12016606330871582\n",
"iteration : 7 , score : 28.41431365691741\n",
"elapsed time : 0.10351085662841797\n",
"elapsed time : 0.1295170783996582\n",
"iteration : 14 , score : 63.60623389257651\n",
"elapsed time : 0.10725879669189453\n",
"elapsed time : 0.20027685165405273\n",
"iteration : 21 , score : 63.99820398612704\n",
"elapsed time : 0.1532289981842041\n",
"elapsed time : 0.13167476654052734\n",
"iteration : 28 , score : 63.99999188193693\n",
"elapsed time : 0.10921216011047363\n",
"elapsed time : 0.14500212669372559\n",
"max score : 63.99999996330749\n",
"[tensor(-0.28875605, requires_grad=True), tensor(1.28205151, requires_grad=True), tensor(-2.91167017, requires_grad=True), tensor(-1.34086296, requires_grad=True), tensor(0.03087215, requires_grad=True), tensor(-4.68146053, requires_grad=True), tensor(-2.19105414, requires_grad=True), tensor(-0.6202797, requires_grad=True), tensor(-0.9225922, requires_grad=True), tensor(0.64817781, requires_grad=True)]\n"
]
Expand Down Expand Up @@ -329,24 +329,24 @@
"\n",
"classical optimziation\n",
"iteration : 0 , score : 4.2033679594592765\n",
"elapsed time : 0.5753090381622314\n",
"elapsed time : 0.5950510501861572\n",
"iteration : 5 , score : 31.2285079287877\n",
"elapsed time : 0.668921947479248\n",
"elapsed time : 0.7105286121368408\n",
"iteration : 10 , score : 31.926902578106233\n",
"elapsed time : 0.4852778911590576\n",
"elapsed time : 0.6552371978759766\n",
"max score : 31.973110623871396\n",
"\n",
"quantum optimization\n",
"iteration : 0 , score : 91.75782099682029\n",
"elapsed time : 0.5629787445068359\n",
"elapsed time : 0.6196279525756836\n",
"iteration : 5 , score : 178.64468783281944\n",
"elapsed time : 0.5353968143463135\n",
"elapsed time : 0.6625587940216064\n",
"iteration : 10 , score : 180.99226193770355\n",
"elapsed time : 0.48822021484375\n",
"elapsed time : 0.660351037979126\n",
"iteration : 15 , score : 181.01902889455243\n",
"elapsed time : 0.4367411136627197\n",
"elapsed time : 0.6850917339324951\n",
"iteration : 20 , score : 181.01930963936746\n",
"elapsed time : 0.49780988693237305\n",
"elapsed time : 0.8958969116210938\n",
"max score : 181.0192234215522\n",
"[tensor(-0.3544713, requires_grad=True), tensor(1.21633266, requires_grad=True), tensor(-2.97738552, requires_grad=True), tensor(-1.40658171, requires_grad=True), tensor(-3.17639242, requires_grad=True), tensor(-1.60563007, requires_grad=True), tensor(-2.25677572, requires_grad=True), tensor(-0.68599221, requires_grad=True), tensor(-0.98831485, requires_grad=True), tensor(0.58246636, requires_grad=True), tensor(-0.45792908, requires_grad=True), tensor(1.11286955, requires_grad=True)]\n"
]
Expand Down Expand Up @@ -407,24 +407,24 @@
"\n",
"classical optimziation\n",
"iteration : 0 , score : -3.4948874818977407\n",
"elapsed time : 0.548940896987915\n",
"elapsed time : 0.847909688949585\n",
"iteration : 5 , score : 0.7846902985560518\n",
"elapsed time : 0.5974001884460449\n",
"elapsed time : 0.7731490135192871\n",
"iteration : 10 , score : 8.55250284548391\n",
"elapsed time : 0.7349109649658203\n",
"elapsed time : 0.8968138694763184\n",
"iteration : 15 , score : 56.608638814998166\n",
"elapsed time : 0.7158291339874268\n",
"elapsed time : 0.9868419170379639\n",
"max score : 63.99978211246262\n",
"\n",
"quantum optimization\n",
"iteration : 0 , score : -59.532891596932146\n",
"elapsed time : 0.5783298015594482\n",
"elapsed time : 0.9196150302886963\n",
"iteration : 5 , score : 489.15933006814913\n",
"elapsed time : 0.5588128566741943\n",
"elapsed time : 0.8337159156799316\n",
"iteration : 10 , score : 463.1114030501951\n",
"elapsed time : 0.6466021537780762\n",
"elapsed time : 1.0076501369476318\n",
"iteration : 15 , score : 454.78665174428113\n",
"elapsed time : 0.5944042205810547\n",
"elapsed time : 1.0648231506347656\n",
"max score : 505.9050309836782\n",
"[tensor(-1.26844742, requires_grad=True), tensor(0.30551241, requires_grad=True), tensor(-3.8913305, requires_grad=True), tensor(-2.3174331, requires_grad=True), tensor(-4.08255988, requires_grad=True), tensor(-2.52425897, requires_grad=True), tensor(-3.16655379, requires_grad=True), tensor(-1.60101052, requires_grad=True), tensor(-1.89763927, requires_grad=True), tensor(-0.3330056, requires_grad=True), tensor(-1.37082385, requires_grad=True), tensor(0.20096795, requires_grad=True), tensor(-4.57415114, requires_grad=True), tensor(3.26704327, requires_grad=True)]\n"
]
Expand Down
Loading

0 comments on commit 2a69613

Please sign in to comment.