Skip to content

Commit 2b4d07c

Browse files
committed
bump version and add more document
1 parent 4d04aec commit 2b4d07c

File tree

5 files changed

+65
-16
lines changed

5 files changed

+65
-16
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "UnitDiskMapping"
22
uuid = "1b61a8d9-79ed-4491-8266-ef37f39e1727"
33
authors = ["QuEra Computing Inc."]
4-
version = "0.4.0"
4+
version = "0.5.0"
55

66
[deps]
77
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
@@ -16,7 +16,7 @@ ProblemReductionsExt = "ProblemReductions"
1616
[compat]
1717
Graphs = "1.6"
1818
LuxorGraphPlot = "0.5"
19-
ProblemReductions = "0.1.1"
19+
ProblemReductions = "0.2"
2020
julia = "1"
2121

2222
[extras]

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@
1212
</a>
1313
&nbsp; package for reducing a <a href="https://en.wikipedia.org/wiki/Independent_set_(graph_theory)">generic maximum (weighted) independent set problem</a>, <a href="https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization"> quadratic unconstrained binary optimization (QUBO) problem</a> or <a href="https://en.wikipedia.org/wiki/Integer_factorization">integer factorization problem</a> to a maximum independent set problem on a unit disk grid graph (or hardcore lattice gas in physics), which can then be naturally encoded in neutral-atom quantum computers. To install <code>UnitDiskMapping</code>,
1414
please <a href="https://docs.julialang.org/en/v1/manual/getting-started/">open
15-
Julia's interactive session (known as REPL)</a> and press the <kbd>]</kbd> key in the REPL to use the package mode, and then type the commands below.
15+
Julia's interactive session (known as REPL)</a> and press the <kbd>]</kbd> key in the REPL to use the package mode, and then type the command below:
1616
</p>
1717

18-
For installing the current master branch, please type:
19-
20-
```julia
21-
pkg> add https://github.com/QuEraComputing/UnitDiskMapping.jl.git
22-
```
23-
24-
For stable release (not yet ready):
25-
2618
```julia
2719
pkg> add UnitDiskMapping
2820
```

notebooks/Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
99
UnitDiskMapping = "1b61a8d9-79ed-4491-8266-ef37f39e1727"
1010

1111
[compat]
12-
GenericTensorNetworks = "2"
12+
GenericTensorNetworks = "3"
1313
Graphs = "1.6"
1414
LinearAlgebra = "1"
1515
LuxorGraphPlot = "0.5"
16-
PlutoSliderServer = "0.3"
16+
PlutoSliderServer = "0.3, 0.4"
1717
PlutoUI = "0.7"
1818
Revise = "3"
19-
UnitDiskMapping = "0.4"
19+
UnitDiskMapping = "0.4, 0.5"
2020
julia = "1"

notebooks/tutorial.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.19.42
2+
# v0.20.3
33

44
using Markdown
55
using InteractiveUtils

notebooks/unweighted.jl

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### A Pluto.jl notebook ###
2-
# v0.19.42
2+
# v0.20.3
33

44
using Markdown
55
using InteractiveUtils
@@ -46,6 +46,9 @@ using UnitDiskMapping, Graphs # for mapping graphs to a King's subgraph (KSG)
4646
# ╔═╡ 31250cb9-6f3a-429a-975d-752cb7c07883
4747
using GenericTensorNetworks # for solving the maximum independent sets
4848

49+
# ╔═╡ e9a94e5a-274f-4740-ac05-bd3bb613df4d
50+
using GenericTensorNetworks.ProblemReductions
51+
4952
# ╔═╡ 9017a42c-9791-4933-84a4-9ff509967323
5053
md"""
5154
# Unweighted KSG reduction of the independent set problem
@@ -213,6 +216,48 @@ count(isone, mis_petersen)
213216
# ╔═╡ 8c1d46e8-dc36-41bd-9d9b-5a72c380ef26
214217
md"The number printed should be consistent with the MIS size of the petersen graph."
215218

219+
# ╔═╡ fba5edd7-e5b7-4631-94cc-0c49240917ff
220+
md"""
221+
## Extension: ProblemReductions
222+
Unit-disk mapping implements the unified interface for reduction in package [ProblemReductions.jl](https://github.com/GiggleLiu/ProblemReductions.jl) as an extension.
223+
"""
224+
225+
# ╔═╡ 0f12b761-fb74-455b-9123-6d1b720aaf52
226+
md"""
227+
Step 1: perform the problem reduction.
228+
"""
229+
230+
# ╔═╡ 1113d5b9-8ebe-46fd-b24e-03e5fbc79435
231+
source_problem = IndependentSet(smallgraph(:petersen))
232+
233+
# ╔═╡ 333a8123-1683-491e-8891-83987bad16eb
234+
# the Independent set problem with 2D GridGraph topology, unweighted.
235+
target_problem_type = IndependentSet{ProblemReductions.GridGraph{2}, Int, UnitWeight}
236+
237+
# ╔═╡ 339fd327-a594-4460-9e00-8b3304aa0a78
238+
# the result not only contains the target problem, but also the intermediate information
239+
reduction_result = reduceto(target_problem_type, source_problem)
240+
241+
# ╔═╡ 0e2f9caa-d84e-411f-ad5d-64c10cdaa028
242+
target_problem(reduction_result)
243+
244+
# ╔═╡ 077045b9-3b88-4c41-a88c-354b8b30c31f
245+
md"Step 2: solve the target problem."
246+
247+
# ╔═╡ d7562423-06cd-4949-a1fd-92d8e5c31280
248+
# get single maximum independent set of the mapped problem
249+
config = solve(GenericTensorNetwork(target_problem(reduction_result)), SingleConfigMax())[].c.data
250+
251+
# ╔═╡ 51a9d53b-b92f-41c4-a60e-d8ceedd3fead
252+
md"Step 3. Extract the solution back"
253+
254+
# ╔═╡ 6ad557b1-04d3-4c7e-a350-20408c09b960
255+
extracted_config = extract_solution(reduction_result, config)
256+
257+
# ╔═╡ f685ed77-151f-4778-8342-112903255932
258+
# finally, we check the validity of the solution.
259+
UnitDiskMapping.is_independent_set(source_problem.graph, extracted_config)
260+
216261
# ╔═╡ Cell order:
217262
# ╟─f55dbf80-8425-11ee-2e7d-4d1ad4f693af
218263
# ╟─9017a42c-9791-4933-84a4-9ff509967323
@@ -265,3 +310,15 @@ md"The number printed should be consistent with the MIS size of the petersen gra
265310
# ╠═0297893c-c978-4818-aae8-26e60d8c9e9e
266311
# ╠═5ffe0e4f-bd2c-4d3e-98ca-61673a7e5230
267312
# ╟─8c1d46e8-dc36-41bd-9d9b-5a72c380ef26
313+
# ╟─fba5edd7-e5b7-4631-94cc-0c49240917ff
314+
# ╠═e9a94e5a-274f-4740-ac05-bd3bb613df4d
315+
# ╟─0f12b761-fb74-455b-9123-6d1b720aaf52
316+
# ╠═1113d5b9-8ebe-46fd-b24e-03e5fbc79435
317+
# ╠═333a8123-1683-491e-8891-83987bad16eb
318+
# ╠═339fd327-a594-4460-9e00-8b3304aa0a78
319+
# ╠═0e2f9caa-d84e-411f-ad5d-64c10cdaa028
320+
# ╟─077045b9-3b88-4c41-a88c-354b8b30c31f
321+
# ╠═d7562423-06cd-4949-a1fd-92d8e5c31280
322+
# ╟─51a9d53b-b92f-41c4-a60e-d8ceedd3fead
323+
# ╠═6ad557b1-04d3-4c7e-a350-20408c09b960
324+
# ╠═f685ed77-151f-4778-8342-112903255932

0 commit comments

Comments
 (0)