Reference
UnitDiskMapping.CrossPattern — TypeProperties
- size
- cross_location
- source: (locs, graph, pins/auto)
- mapped: (locs, graph/auto, pins/auto)
Requires
- equivalence in MIS-compact tropical tensor (you can check it with tests),
- the size is <= [-2, 2] x [-2, 2] at the cross (not checked, requires cross offset information),
- ancillas does not appear at the boundary (not checked),
UnitDiskMapping.Pattern — TypeProvides
- visualization of mapping
- the script for generating backward mapping (project/createmap.jl)
- the script for tikz visualization (project/vizgadget.jl)
UnitDiskMapping.SimplifyPattern — TypeProperties
- size
- source: (locs, graph/auto, pins/auto)
- mapped: (locs, graph/auto, pins/auto)
Requires
- equivalence in MIS-compact tropical tensor (you can check it with tests),
- ancillas does not appear at the boundary (not checked),
UnitDiskMapping.embed_graph — Methodembed_graph([mode,] g::SimpleGraph; vertex_order=MinhThiTrick())Embed graph g into a unit disk grid, where the optional argument mode can be Weighted() or UnWeighted. The vertex_order can be a vector or one of the following inputs
* `Greedy()` fast but non-optimal.
* `MinhThiTrick()` slow but optimal.UnitDiskMapping.map_config_back — Methodmap_config_back(map_result, config)Map a solution config for the mapped MIS problem to a solution for the source problem.
UnitDiskMapping.map_configs_back — Methodmap_configs_back(res::MappingResult, configs::AbstractVector)Map MIS solutions for the mapped graph to a solution for the source graph.
UnitDiskMapping.map_factoring — Methodmap_factoring(M::Int, N::Int)Setup a factoring circuit with M-bit q register (second input) and N-bit p register (first input). The m register size is (M+N-1), which stores the output. Call solve_factoring to solve a factoring problem with the mapping result.
UnitDiskMapping.map_graph — Methodmap_graph([mode=UnWeighted(),] g::SimpleGraph; vertex_order=MinhThiTrick(), ruleset=[...])Map a graph to a unit disk grid graph that being "equivalent" to the original graph, and return a MappingResult instance. Here "equivalent" means a maximum independent set in the grid graph can be mapped back to a maximum independent set of the original graph in polynomial time.
Positional Arguments
modeis optional, it can beWeighted()(default) orUnWeighted().gis a graph instance, check the documentation ofGraphsfor details.
Keyword Arguments
vertex_orderspecifies the order finding algorithm for vertices.
Different vertex orders have different path width, i.e. different depth of mapped grid graph. It can be a vector or one of the following inputs * Greedy() fast but not optimal. * MinhThiTrick() slow but optimal.
rulesetspecifies and extra set of optimization patterns (not the crossing patterns).
UnitDiskMapping.map_qubo — Methodmap_qubo(J::AbstractMatrix, h::AbstractVector) -> QUBOResultMap a QUBO problem to a weighted MIS problem on a defected King's graph, where a QUBO problem is defined by the following Hamiltonian
\[E(z) = -\sum_{i<j} J_{ij} z_i z_j + \sum_i h_i z_i\]
The input coupling strength and onsite energies must be << 1.
A QUBO gadget is
⋅ ⋅ ● ⋅
● A B ⋅
⋅ C D ●
⋅ ● ⋅ ⋅where A, B, C and D are weights of nodes that defined as
\[\begin{align} A = -J_{ij} + 4\\ B = J_{ij} + 4\\ C = J_{ij} + 4\\ D = -J_{ij} + 4 \end{align}\]
The rest nodes: ● have weights 2 (boundary nodes have weights $1 - h_i$).
UnitDiskMapping.map_qubo_restricted — Methodmap_qubo_restricted(coupling::AbstractVector) -> RestrictedQUBOResultMap a nearest-neighbor restricted QUBO problem to a weighted MIS problem on a grid graph, where the QUBO problem can be specified by a vector of (i, j, i', j', J).
\[E(z) = -\sum_{(i,j)\in E} J_{ij} z_i z_j\]
A FM gadget is
- ⋅ + ⋅ ⋅ ⋅ + ⋅ -
⋅ ⋅ ⋅ ⋅ 4 ⋅ ⋅ ⋅ ⋅
+ ⋅ - ⋅ ⋅ ⋅ - ⋅ +where +, - and 4 are weights of nodes +J, -J and 4J.
- ⋅ + ⋅ ⋅ ⋅ + ⋅ -
⋅ ⋅ ⋅ 4 ⋅ 4 ⋅ ⋅ ⋅
+ ⋅ - ⋅ ⋅ ⋅ - ⋅ +UnitDiskMapping.map_qubo_square — Methodmap_qubo_square(coupling::AbstractVector, onsite::AbstractVector) -> SquareQUBOResultMap a QUBO problem on square lattice to a weighted MIS problem on a grid graph, where the QUBO problem can be specified by
- a vector coupling of
(i, j, i', j', J), s.t. (i', j') == (i, j+1) or (i', j') = (i+1, j). - a vector of onsite term
(i, j, h).
\[E(z) = -\sum_{(i,j)\in E} J_{ij} z_i z_j + h_i z_i\]
The gadget for suqare lattice QUBO problem is as follows
⋅ ⋅ ⋅ ⋅ ● ⋅ ⋅ ⋅ ⋅
○ ⋅ ● ⋅ ⋅ ⋅ ● ⋅ ○
⋅ ⋅ ⋅ ● ⋅ ● ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ○ ⋅ ⋅ ⋅ ⋅ where white circles have weight 1 and black circles have weight 2. The unit distance is 2.3.
UnitDiskMapping.map_simple_wmis — Methodmap_simple_wmis(graph::SimpleGraph, weights::AbstractVector) -> WMISResultMap a weighted MIS problem to a weighted MIS problem on a defected King's graph.
The input coupling strength and onsite energies must be << 1. This method does not provide path decomposition based optimization, check map_graph for the path decomposition optimized version.
UnitDiskMapping.map_weights — Methodmap_weights(r::MappingResult{WeightedNode}, source_weights)Map the weights in the source graph to weights in the mapped graph, returns a vector.
UnitDiskMapping.multiplier — Methodmultiplier()Returns the multiplier as a SimpleGridGraph instance and a vector of pins. The logic gate constraints on pins are
- x1 + x2x3 + x4 == x5 + 2x7
- x2 == x6
- x3 == x8
UnitDiskMapping.solve_factoring — Methodsolve_factoring(missolver, mres::FactoringResult, x::Int) -> (Int, Int)Solve a factoring problem by solving the mapped weighted MIS problem on a unit disk grid graph. It returns (a, b) such that $a b = x$ holds. missolver(graph, weights) should return a vector of integers as the solution.
UnitDiskMapping.unit_disk_graph — Methodunit_disk_graph(locs::AbstractVector, unit::Real)Create a unit disk graph with locations specified by locs and unit distance unit.