Skip to content

Commit

Permalink
New QUBO tutorial for the latest solver as of EoJuly 2024
Browse files Browse the repository at this point in the history
Signed-off-by: Risbud, Sumedh <[email protected]>
  • Loading branch information
srrisbud committed Aug 4, 2024
1 parent ceb7ecb commit d65cf88
Show file tree
Hide file tree
Showing 17 changed files with 8,067 additions and 0 deletions.
119 changes: 119 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/gen_mis_uniform.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "e81fe7c7-e7db-4d76-a211-365f79b4333f",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import numpy as np\n",
"import time\n",
"import warnings\n",
"from dataclasses import dataclass\n",
"\n",
"from lava.lib.optimization.utils.generators.mis import MISProblem\n",
"\n",
"warnings.filterwarnings('ignore')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c72fcc4d-3e04-49a3-8146-60d7414ddb97",
"metadata": {},
"outputs": [],
"source": [
"size = 6000"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "e39da1a6-a016-4fa3-b8d8-b07ffadef557",
"metadata": {},
"outputs": [],
"source": [
"q_saved = np.loadtxt(f'/home/sumedhrr/202312_qubo_benchmarking/lava-loihi-benchmarking/workloads/mis-uniform/mis-uniform-{size}-0.05-0.txt', dtype=int)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "87bcaa20-fc8a-4170-8f24-fb0e412bcb9b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generating size=4450 seed=0\n",
"Generating size=4450 seed=1\n",
"Generating size=4450 seed=2\n",
"Generating size=4450 seed=3\n",
"Generating size=4450 seed=4\n"
]
}
],
"source": [
"for size in [4450]:\n",
" for seed in range(5):\n",
" np.random.seed(seed)\n",
" print(f'Generating {size=} {seed=}')\n",
" q_gened = MISProblem.from_random_uniform(num_vertices=size, density=0.05, seed=seed).adjacency_matrix\n",
" np.savetxt(f'/home/sumedhrr/202312_qubo_benchmarking/lava-loihi-benchmarking/workloads/mis-uniform/mis-uniform-{size}-0.05-{seed}.txt', q_gened, fmt=\"%d\")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "714d5d1b-24f3-4e80-b629-5064f9a33ab7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.all(q_saved == q_gened)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1bb825fc-8f3b-43bf-ae2f-23c375403610",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
100 changes: 100 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-100-0.05-0.txt

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-100-0.05-1.txt

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-100-0.05-2.txt

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-100-0.05-3.txt

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-100-0.05-4.txt

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-1000-0.05-0.txt

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-1000-0.05-1.txt

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-1000-0.05-2.txt

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-1000-0.05-3.txt

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-1000-0.05-4.txt

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-400-0.05-0.txt

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-400-0.05-1.txt

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-400-0.05-2.txt

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-400-0.05-3.txt

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions tutorials/data/qubo/workloads/mis-uniform/mis-uniform-400-0.05-4.txt

Large diffs are not rendered by default.

Loading

0 comments on commit d65cf88

Please sign in to comment.