-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
Signed-off-by: Risbud, Sumedh <[email protected]>
- Loading branch information
There are no files selected for viewing
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 | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.