Reference
ProblemReductions.AbstractReductionResult
ProblemReductions.BoolVar
ProblemReductions.BruteForce
ProblemReductions.CNF
ProblemReductions.CNFClause
ProblemReductions.Circuit
ProblemReductions.ConcatenatedReduction
ProblemReductions.GridGraph
ProblemReductions.HyperGraph
ProblemReductions.LargerSizeIsBetter
ProblemReductions.LocalConstraint
ProblemReductions.LocalSolutionSize
ProblemReductions.LogicGadget
ProblemReductions.ReductionCircuitToSpinGlass
ProblemReductions.ReductionFactoringToSat
ProblemReductions.ReductionGraph
ProblemReductions.ReductionIndependentSetToSetPacking
ProblemReductions.ReductionIndependentSetToVertexCovering
ProblemReductions.ReductionMatchingToSetPacking
ProblemReductions.ReductionMaxCutToSpinGlass
ProblemReductions.ReductionPath
ProblemReductions.ReductionQUBOToSpinGlass
ProblemReductions.ReductionSATToCircuit
ProblemReductions.ReductionSATToDominatingSet
ProblemReductions.ReductionSATToIndependentSet
ProblemReductions.ReductionSATToKSAT
ProblemReductions.ReductionSatToColoring
ProblemReductions.ReductionSetPackingToIndependentSet
ProblemReductions.ReductionSpinGlassToMaxCut
ProblemReductions.ReductionSpinGlassToQUBO
ProblemReductions.ReductionVertexCoveringToSetCovering
ProblemReductions.SmallerSizeIsBetter
ProblemReductions.SolutionSize
ProblemReductions.StaticBitVector
ProblemReductions.StaticElementVector
ProblemReductions.TruthTable
ProblemReductions.UnitDiskGraph
ProblemReductions.UnitWeight
ProblemReductions.:¬
ProblemReductions.:∧
ProblemReductions.:∨
ProblemReductions.config2name
ProblemReductions.constraints
ProblemReductions.cut_size
ProblemReductions.energy
ProblemReductions.energy_mode
ProblemReductions.extract_multiple_solutions
ProblemReductions.extract_solution
ProblemReductions.findbest
ProblemReductions.flavor_names
ProblemReductions.flavors
ProblemReductions.is_dominating_set
ProblemReductions.is_independent_set
ProblemReductions.is_matching
ProblemReductions.is_maximal_independent_set
ProblemReductions.is_satisfied
ProblemReductions.is_set_covering
ProblemReductions.is_set_packing
ProblemReductions.is_vertex_coloring
ProblemReductions.is_vertex_covering
ProblemReductions.is_weighted
ProblemReductions.name2config
ProblemReductions.num_flavors
ProblemReductions.num_paint_shop_color_switch
ProblemReductions.num_variables
ProblemReductions.objectives
ProblemReductions.onehotv
ProblemReductions.paint_shop_coloring_from_config
ProblemReductions.problem_size
ProblemReductions.problem_size
ProblemReductions.reduce_size
ProblemReductions.reduceto
ProblemReductions.reduction_graph
ProblemReductions.reduction_paths
ProblemReductions.satisfiable
ProblemReductions.set_weights
ProblemReductions.solution_size
ProblemReductions.solution_size
ProblemReductions.solution_size_multiple
ProblemReductions.spinglass_gadget
ProblemReductions.target_problem
ProblemReductions.truth_table
ProblemReductions.variables
ProblemReductions.weight_type
ProblemReductions.weights
ProblemReductions.@bools
ProblemReductions.@bv_str
ProblemReductions.@circuit
ProblemReductions.AbstractReductionResult
— Typeabstract type AbstractReductionResult
The base type for a reduction result.
ProblemReductions.BoolVar
— TypeBoolVar{T}
BoolVar(name, neg)
Boolean variable for constructing CNF clauses.
ProblemReductions.BruteForce
— Typestruct BruteForce{T} <: AbstractSolver
A brute force method to find the best configuration of a problem.
ProblemReductions.CNF
— TypeCNF{T}
CNF(clauses)
Boolean expression in conjunctive normal form. clauses
is a vector of CNFClause
, if and only if all clauses are satisfied, this CNF is satisfied.
Example
Under development
ProblemReductions.CNFClause
— TypeCNFClause{T}
CNFClause(vars)
A clause in CNF
, its value is the logical or of vars
, where vars
is a vector of BoolVar
.
ProblemReductions.Circuit
— Typestruct Circuit
A circuit expression is a sequence of assignments.
Fields
exprs::Vector{Assignment}
: The assignments in the circuit.
ProblemReductions.ConcatenatedReduction
— Typestruct ConcatenatedReduction
A sequence of reductions.
Fields
sequence::Vector{Any}
: The sequence of reductions.
ProblemReductions.GridGraph
— TypeGridGraph is a unit disk graph with integer coordinates.
ProblemReductions.HyperGraph
— Typestruct HyperGraph <: Graphs.AbstractGraph{Int64}
A hypergraph is a generalization of a graph in which an edge can connect any number of vertices.
Fields
n::Int
: the number of verticesedges::Vector{Vector{Int}}
: a vector of vectors of integers, where each vector represents a hyperedge connecting the vertices with the corresponding indices.
ProblemReductions.LargerSizeIsBetter
— TypeLargerSizeIsBetter <: EnergyMode
The energy is defined as the negative size of the solution, which is the larger size the lower energy.
ProblemReductions.LocalConstraint
— Typestruct LocalConstraint
A constraint for specifying a ConstraintSatisfactionProblem
, which is defined on finite domain variables.
Fields
num_flavors
: the number of flavors (domain) of a degree of freedom.variables
: the indices of the variables involved in the constraint.specification
: a boolean vector of lengthnum_flavors^length(variables)
, specifying whether a configuration is valid.strides
: the strides of the variables, to index the specification vector.
ProblemReductions.LocalSolutionSize
— Typestruct LocalSolutionSize{T}
Problem size defined on a subset of variables of a ConstraintSatisfactionProblem
.
Fields
num_flavors
: the number of flavors (domain) of a degree of freedom.variables
: the indices of the variables involved in the constraint.specification
: a vector of sizenum_flavors^length(variables)
, specifying the local solution sizes.strides
: the strides of the variables, to index the specification vector.
ProblemReductions.LogicGadget
— Typestruct LogicGadget{PT<:AbstractProblem}
The logic gadget defined on an computational model.
Fields
problem::PT
: the computational model, e.g.,SpinGlass
.inputs::Vector{Int}
: the input variables.outputs::Vector{Int}
: the output variables.
References
- What are the cost function for NAND and NOR gates?
- Nguyen, M.-T., Liu, J.-G., Wurtz, J., Lukin, M.D., Wang, S.-T., Pichler, H., 2023. Quantum Optimization with Arbitrary Connectivity Using Rydberg Atom Arrays. PRX Quantum 4, 010316.
ProblemReductions.ReductionCircuitToSpinGlass
— Typestruct ReductionCircuitToSpinGlass{GT, T} <: AbstractReductionResult
The reduction result of a circuit to a spin glass problem.
Fields
num_source_vars::Int
: the number of variables in the source circuit.spinglass::SpinGlass{GT, T}
: the spin glass problem.variables::Vector{Int}
: the variables in the spin glass problem.
ProblemReductions.ReductionFactoringToSat
— Typestruct ReductionFactoringToSat <: AbstractReductionResult
The reduction result of a factoring problem to a CircuitSAT problem.
Fields
circuit::CircuitSAT
: the CircuitSAT problem.p::Vector{Int}
: the first number to multiply (store bit locations)q::Vector{Int}
: the second number to multiply.m::Vector{Int}
: the result of the multiplication.
ProblemReductions.ReductionGraph
— Typestruct ReductionGraph
A directed graph representing the reduction paths between different problems. A node represents a problem type, and an edge represents a reduction rule from one problem type to another.
Fields
graph::Graphs.SimpleGraphs.SimpleDiGraph{Int64}
nodes::Vector{Any}
method_table::Dict{Pair{Int64, Int64}, Function}
ProblemReductions.ReductionIndependentSetToSetPacking
— Typestruct ReductionIndependentSetToSetPacking{ET} <: AbstractReductionResult
The reduction result of an Independent Set problem to a Set Packing problem.
Fields
target::SetPacking
vertices_list::Vector{Int64}
ProblemReductions.ReductionIndependentSetToVertexCovering
— Typestruct ReductionIndependentSetToVertexCovering{T, WT} <: AbstractReductionResult
The reduction result of reducing an independent set problem to a vertex covering problem.
Fields
vertexcovering::VertexCovering
: the vertex covering problem.
ProblemReductions.ReductionMatchingToSetPacking
— Typestruct ReductionMatchingToSetPacking{ET, T, WT<:AbstractArray{T, 1}} <: AbstractReductionResult
The reduction result of a vertex matching to a set packing problem.
Fields
SetPacking{WT<:AbstractVector{Int}}
: the target set packing problem
ProblemReductions.ReductionMaxCutToSpinGlass
— Typestruct ReductionMaxCutToSpinGlass{GT, T} <: AbstractReductionResult
The reduction result of a maxcut to a spin glass problem.
Fields
spinglass::SpinGlass{GT, T}
: the spin glass problem.
We only consider a simple reduction from MaxCut to SpinGlass(the graph must be SimpleGraph
).
ProblemReductions.ReductionPath
— Typestruct ReductionPath
A sequence of reductions.
Fields
nodes::Vector{AbstractProblem}
: The sequence of problem types.methods::Vector{Function}
: The sequence of methods used to reduce the problems.
ProblemReductions.ReductionQUBOToSpinGlass
— Typestruct ReductionQUBOToSpinGlass{GT, T} <: AbstractReductionResult
The reduction result of a qubo to a spin glass problem.
Fields
spinglass::SpinGlass{GT, T}
: the spin glass problem.
We only consider a simple reduction from QUBO to SpinGlass(the graph must be SimpleGraph
).
ProblemReductions.ReductionSATToCircuit
— Typestruct ReductionSATToCircuit <: AbstractReductionResult
The reduction result of an SAT problem o a Circuit SAT problem.
Fields
target::CircuitSAT
: the target problem.target::CircuitSAT
sat_symbols::Vector{Symbol}
ProblemReductions.ReductionSATToDominatingSet
— Typestruct ReductionSATToDominatingSet{GT<:Graphs.AbstractGraph} <: AbstractReductionResult
The reduction result of a general SAT problem to an Dominating Set problem.
Fields
target::DominatingSet
num_literals::Int64
num_clauses::Int64
ProblemReductions.ReductionSATToIndependentSet
— Typestruct ReductionSATToIndependentSet{S, GT<:Graphs.AbstractGraph, T, WT<:AbstractArray{T, 1}} <: AbstractReductionResult
The reduction result of a general SAT problem to an Independent Set problem.
Fields
target::IndependentSet
literals::Array{BoolVar{S}, 1} where S
source_variables::Vector
num_clauses::Int64
ProblemReductions.ReductionSATToKSAT
— TypeThe reduction result of a general SAT problem to a 3-SAT problem.
ProblemReductions.ReductionSatToColoring
— Typestruct ReductionSatToColoring{K, T, WT<:AbstractArray{T, 1}} <: AbstractReductionResult
The reduction result of a Sat problem to a Coloring problem.
Fields
Coloring{K, T, WT<:AbstractVector{T}}
: the coloring problem, where K is the number of colors and WT is the weights type.posvertices
, a map from literal to vertex indexnegvertices
, a map from negative literal to vertex index
Note: The coloring problem is a 3 coloring problem, in which a auxiliary color is used Auxiliary color => 2.
ProblemReductions.ReductionSetPackingToIndependentSet
— Typestruct ReductionSetPackingToIndependentSet{GT, ET} <: AbstractReductionResult
The reduction result of a Set Packing problem to an Independent Set problem.
Fields
target::IndependentSet{GT, T} where {GT, T}
subset_list::Array{Vector{ET}, 1} where ET
ProblemReductions.ReductionSpinGlassToMaxCut
— Typestruct ReductionSpinGlassToMaxCut{WT} <: AbstractReductionResult
The reduction result of a spin glass to a maxcut problem.
Fields
maxcut::MaxCut{WT}
: the MaxCut problem.ancilla::Int
: the ancilla vertex.
ProblemReductions.ReductionSpinGlassToQUBO
— Typestruct ReductionSpinGlassToQUBO{WT} <: AbstractReductionResult
The reduction result of a spin glass to a QUBO problem.
Fields
qubo::QUBO{WT}
: the QUBO problem.
ProblemReductions.ReductionVertexCoveringToSetCovering
— Typestruct ReductionVertexCoveringToSetCovering{ET, T, WT<:AbstractArray{T, 1}} <: AbstractReductionResult
The reduction result of a vertex covering to a set covering problem.
Fields
setcovering::SetCovering{Int,T,WT}
: the set covering problem, where ET is the sets type and WT is the weights type.edgelabel
: map each edge to a number in order to identify the edge (otherwise the vector would be cluttering)
ProblemReductions.SmallerSizeIsBetter
— TypeSmallerSizeIsBetter <: EnergyMode
The energy is defined as the size of the solution, which is the smaller size the lower energy.
ProblemReductions.SolutionSize
— Typestruct SolutionSize{T}
The size of the problem given a configuration.
Fields
size
: the size of the problem.is_valid
: whether the configuration is valid.
ProblemReductions.StaticBitVector
— TypeStaticBitVector{N,C} = StaticElementVector{N,1,C}
StaticBitVector(x::AbstractVector)
Examples
julia> sb = StaticBitVector([1,0,0,1,1])
10011
julia> sb[3]
0x0000000000000000
julia> collect(Int, sb)
5-element Vector{Int64}:
1
0
0
1
1
ProblemReductions.StaticElementVector
— TypeStaticElementVector{N,S,C}
StaticElementVector(nflavor::Int, x::AbstractVector)
N
is the length of vector, C
is the size of storage in unit of UInt64
, S
is the stride defined as the log2(# of flavors)
. When the number of flavors is 2, it is a StaticBitVector
.
Fields
data
is a tuple ofUInt64
for storing the configuration of static elements.
Examples
julia> ev = StaticElementVector(3, [1,2,0,1,2])
12012
julia> ev[2]
0x0000000000000002
julia> collect(Int, ev)
5-element Vector{Int64}:
1
2
0
1
2
ProblemReductions.TruthTable
— Typestruct TruthTable{N, T}
The truth table.
Fields
inputs::Vector{T}
: The input values.outputs::Vector{T}
: The output values.values::Vector{BitStr{N, Int}}
: The truth table values.
Examples
julia> tt = TruthTable(['a', 'b'], ['c'], [bit"0", bit"0", bit"0", bit"1"])
┌───┬───┬───┐
│ a │ b │ c │
├───┼───┼───┤
│ 0 │ 0 │ 0 │
│ 1 │ 0 │ 0 │
│ 0 │ 1 │ 0 │
│ 1 │ 1 │ 1 │
└───┴───┴───┘
ProblemReductions.UnitDiskGraph
— Typestruct UnitDiskGraph{D, T} <: Graphs.AbstractGraph{Int64}
A unit disk graph is a graph in which the vertices are points in a plane and two vertices are connected by an edge if and only if the Euclidean distance between them is at most a given radius.
Fields
locations::Vector{NTuple{D, T}}
: the locations of the verticesradius::Float64
: the radius of the unit disk
ProblemReductions.UnitWeight
— TypeUnitWeight <: AbstractVector{Int}
The unit weight vector of length n
.
ProblemReductions.:¬
— Method¬(var::BoolVar)
Negation of a boolean variables of type BoolVar
.
ProblemReductions.:∧
— MethodProblemReductions.:∨
— MethodProblemReductions.config2name
— Methodconfig2name(problem::AbstractProblem, config)
Convert the configuration to the names of the flavors.
ProblemReductions.constraints
— Functionconstraints(problem::AbstractProblem) -> Vector{LocalConstraint}
The constraints of the problem.
ProblemReductions.cut_size
— Methodcut_size(g::AbstractGraph, config; weights=UnitWeight(ne(g)))
Return the size of the cut of the graph g
with configuration config
. The configuration is a vector of boolean numbers as the group indices of vertices. Edges between vertices in different groups are counted as a cut.
ProblemReductions.energy
— Methodenergy(problem::AbstractProblem, config) -> Number
The energy of the problem
given the configuration config
. Please check the energy_mode
for the definition of the energy function.
ProblemReductions.energy_mode
— Methodenergy_mode(problem::AbstractProblem) -> EnergyMode
The definition of the energy function, which can be LargerSizeIsBetter
or SmallerSizeIsBetter
. If will be used in the energy based modeling of the target problem.
ProblemReductions.extract_multiple_solutions
— Methodextract_multiple_solutions(reduction::AbstractReductionResult, solution_set)
Extract multiple solutions together solution_set
of the target problem to the original problem.
Arguments
reduction
: The reduction result.solution_set
: The set of multiple solutions of the target problem.
ProblemReductions.extract_solution
— Functionextract_solution(reduction::AbstractReductionResult, solution)
Extract the solution solution
of the target problem to the original problem.
Arguments
reduction
: The reduction result.solution
: The solution of the target problem.
ProblemReductions.findbest
— Functionfindbest(problem::AbstractProblem, method) -> Vector
Find the best configurations of the problem
using the method
.
ProblemReductions.flavor_names
— Methodflavor_names(::Type{<:AbstractProblem}) -> Vector
Returns a vector as the names of the flavors (domain) of a degree of freedom. It falls back to flavors
if no method is defined. Use ProblemReductions.name2config
and ProblemReductions.config2name
to convert between the names and the configuration.
ProblemReductions.flavors
— Methodflavors(::Type{<:AbstractProblem}) -> UnitRange
flavors(::GT) where GT<:AbstractProblem -> UnitRange
Returns a vector of integers as the flavors (domain) of a degree of freedom.
Flavors is defined a 0:num_flavors-1
. To access the previous version of the flavors, use flavor_names
.
ProblemReductions.is_dominating_set
— Methodis_dominating_set(g::SimpleGraph, config)
Return true if config
(a vector of boolean numbers as the mask of vertices) is a dominating set of graph g
.
ProblemReductions.is_independent_set
— Methodis_independent_set(g::SimpleGraph, config)
Return true if config
(a vector of boolean numbers as the mask of vertices) is an independent set of graph g
.
ProblemReductions.is_matching
— Methodis_matching(graph::SimpleGraph, config)
Returns true if config
is a valid matching on graph
, and false
if a vertex is double matched. config
is a vector of boolean variables, which has one to one correspondence with edges(graph)
.
ProblemReductions.is_maximal_independent_set
— Methodis_maximal_independent_set(g::SimpleGraph, config)
Return true if config
(a vector of boolean numbers as the mask of vertices) is a maximal independent set of graph g
.
ProblemReductions.is_satisfied
— Methodis_satisfied(constraint::LocalConstraint, config) -> Bool
is_satisfied(problem::ConstraintSatisfactionProblem, config) -> Bool
Check if the constraint
is satisfied by the configuration config
.
ProblemReductions.is_set_covering
— Methodis_set_covering(c::SetCovering, config)
Return true if config
(a vector of boolean numbers as the mask of sets) is a set covering of sets
.
ProblemReductions.is_set_packing
— Methodis_set_packing(sp::SetPacking, config)
Return true if config
(a vector of boolean numbers as the mask of sets) is a set packing of sp
.
ProblemReductions.is_vertex_coloring
— Methodis_vertex_coloring(graph::SimpleGraph, config)
Returns true if the coloring specified by config is a valid one, i.e. does not violate the contraints of vertices of an edges having different colors.
ProblemReductions.is_vertex_covering
— Methodis_vertex_covering(graph::SimpleGraph, config)
return true if the vertex configuration config
is a vertex covering of the graph. Our judgement is based on the fact that for each edge, at least one of its vertices is selected.
ProblemReductions.is_weighted
— Methodis_weighted(problem::ConstraintSatisfactionProblem) -> Bool
Check if the problem is weighted. Returns true
if the problem has non-unit weights.
ProblemReductions.name2config
— Methodname2config(problem::AbstractProblem, config)
Convert the names of the flavors to the configuration.
ProblemReductions.num_flavors
— Methodnum_flavors(::Type{<:AbstractProblem}) -> Int
num_flavors(::GT) where GT<:AbstractProblem -> Int
Returns the number of flavors (domain) of a degree of freedom.
ProblemReductions.num_paint_shop_color_switch
— Methodnum_paint_shop_color_switch(sequence::AbstractVector, coloring)
Returns the number of color switches.
ProblemReductions.num_variables
— Functionnum_variables(problem::AbstractProblem) -> Int
The number of variables in the computational problem.
ProblemReductions.objectives
— Functionobjectives(problem::AbstractProblem) -> Vector{<:LocalSolutionSize}
The constraints related to the size of the problem. Each term is associated with weights.
ProblemReductions.onehotv
— Methodonehotv(::Type{<:StaticElementVector}, i, v)
onehotv(::Type{<:StaticBitVector}, i)
Returns a static element vector, with the value at location i
being v
(1 if not specified).
ProblemReductions.paint_shop_coloring_from_config
— Methodpaint_shop_coloring_from_config(p::PaintShop, config)
Returns a valid painting from the paint shop configuration (given by the configuration solvers). The config
is a sequence of 0 and 1, where 0 means painting the first appearence of a car in red, and 1 means painting the first appearence of a car in blue.
ProblemReductions.problem_size
— Functionproblem_size(problem::AbstractProblem) -> NamedTuple
The size of the computational problem, which is problem dependent.
ProblemReductions.problem_size
— MethodDefined as the number of sets.
ProblemReductions.reduce_size
— Methodreduce_size(::Type{T}, ::Type{S}, size)
Return the size of the target problem T
after reducing the source problem S
to T
.
The problem size measure is problem dependent. Please check problem_size
for the problem size measure.
Arguments
T
: The target problem type.S
: The source problem type.size
: The size of the source problem.
ProblemReductions.reduceto
— Functionreduceto(problem_type::Type{<:AbstractProblem}, problem::AbstractProblem) -> AbstractReductionResult
reduceto(path::ReductionPath, problem::AbstractProblem) -> ConcatenatedReduction
Reduce the problem problem
to a target problem. If the target problem is a single problem type, reduce the problem problem
to a target problem of type. Then the result is an instance of AbstractReductionResult
. Otherwise, if the target problem is a reduction path, implement a reduction path on a problem. Then the result is a ConcatenatedReduction
instance.
Arguments
problem_type::Type{<:AbstractProblem}
orpath::ReductionPath
: The target problem type or a reduction path.problem::AbstractProblem
: The original problem.
ProblemReductions.reduction_graph
— Method reduction_graph()
Returns a ReductionGraph
instance from the reduction rules defined with method reduceto
.
ProblemReductions.reduction_paths
— Methodreduction_paths([rg::ReductionGraph, ]S::Type, T::Type)
Find all reduction paths from problem type S
to problem type T
. Returns a list of paths, where each path is a sequence of problem types.
Arguments
rg::ReductionGraph
: The reduction graph of typeReductionGraph
.S::Type
: The source problem type.T::Type
: The target problem type.
ProblemReductions.satisfiable
— Methodsatisfiable(expr, config::AbstractDict{T}) where T
Check if the boolean expression expr
is satisfied by the configuration config
.
ProblemReductions.set_weights
— Functionset_weights(problem::ConstraintSatisfactionProblem, weights) -> ConstraintSatisfactionProblem
Change the weights for the problem
and return a new problem instance.
ProblemReductions.solution_size
— Methodsolution_size(problem::AbstractProblem, config) -> SolutionSize
Size of the problem
given the configuration config
. If you have multiple configurations, use ProblemReductions.solution_size_multiple
instead for better performance.
ProblemReductions.solution_size
— Methodsolution_size(spec::LocalSolutionSize{WT}, config) where {WT}
The local solution size of a local solution configuration.
ProblemReductions.solution_size_multiple
— Methodsolution_size_multiple(problem::ConstraintSatisfactionProblem, configs) -> Vector{SolutionSize}
Size of the problem
given multiple configurations.
ProblemReductions.spinglass_gadget
— Methodspinglass_gadget(::Val{:arraymul})
The array multiplier gadget.
s_{i+1,j-1} p_i
\ |
q_j ------------ q_j
|
c_{i,j} ------------ c_{i-1,j}
| \
p_i s_{i,j}
- variables: pi, qj, pq, c{i-1,j}, s{i+1,j-1}, c{i,j}, s{i,j}
- constraints: 2 * c{i,j} + s{i,j} = pi qj + c{i-1,j} + s{i+1,j-1}
ProblemReductions.target_problem
— Functiontarget_problem(res::AbstractReductionResult) -> AbstractProblem
Return the target problem of the reduction result.
ProblemReductions.truth_table
— Methodtruth_table(ga::LogicGadget; variables=1:num_variables(ga.problem), solver=BruteForce())
Compute the truth table of a logic gadget.
Arguments
ga::LogicGadget
: the logic gadget.
Keyword Arguments
variables::Vector{Int}
: the variables to be displayed.solver::AbstractSolver
: the solver to be used.
ProblemReductions.variables
— Methodvariables(problem::AbstractProblem) -> Vector
The degrees of freedoms in the computational problem. e.g. for the maximum independent set problems, they are the indices of vertices: 1, 2, 3..., while for the max cut problem, they are the edges.
ProblemReductions.weight_type
— Methodweight_type(problem::AbstractProblem) -> Type
The data type of the weights in the computational problem.
ProblemReductions.weights
— Functionweights(problem::ConstraintSatisfactionProblem) -> Vector
The weights of the constraints in the problem.
ProblemReductions.@bools
— Macro@bools(syms::Symbol...)
Create some boolean variables of type BoolVar
in current scope that can be used in create a CNF
.
Example
Under Development
ProblemReductions.@bv_str
— MacroConstructing a static bit vector.
ProblemReductions.@circuit
— Macro@circuit circuit_expr
Construct a circuit expression from a block of assignments.
Examples
julia> @circuit begin
x = a ∨ b
y = x ∧ c
end
Circuit:
| x = ∨(a, b)
| y = ∧(x, c)