mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-07-31 22:16:21 +02:00
compute star before the main loop in constraint_matrix
This commit is contained in:
parent
a10132e441
commit
359e317fd9
@ -177,16 +177,17 @@ function _constraints(
|
|||||||
)
|
)
|
||||||
cnstrs = [signed(eltype(mstr))[] for _ in 1:num_constraints]
|
cnstrs = [signed(eltype(mstr))[] for _ in 1:num_constraints]
|
||||||
LI = LinearIndices(size(mstr))
|
LI = LinearIndices(size(mstr))
|
||||||
|
star_of = [mstr.basis[SA.star(mstr.basis[i])] for i in 1:size(mstr, 1)]
|
||||||
|
|
||||||
for ci in CartesianIndices(size(mstr))
|
for ci in CartesianIndices(size(mstr))
|
||||||
k = LI[ci]
|
k = LI[ci]
|
||||||
i, j = Tuple(ci)
|
i, j = Tuple(ci)
|
||||||
a_star_b = mstr[-i, j]
|
a_star_b = mstr[star_of[i], j]
|
||||||
push!(cnstrs[a_star_b], k)
|
push!(cnstrs[a_star_b], k)
|
||||||
if augmented
|
if augmented
|
||||||
# (1-a)'(1-b) = 1 - a' - b + a'b
|
# (1-a)'(1-b) = 1 - a' - b + a'b
|
||||||
push!(cnstrs[id], k)
|
push!(cnstrs[id], k)
|
||||||
a_star, b = mstr[-i, id], j
|
a_star, b = mstr[star_of[i], id], j
|
||||||
push!(cnstrs[a_star], -k)
|
push!(cnstrs[a_star], -k)
|
||||||
push!(cnstrs[b], -k)
|
push!(cnstrs[b], -k)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user