Skip to content

[BUG] Unexpected behavior of option ConfigsMax in solving MIS #99

Description

@fliingelephant

The following code solves MIS on a 10x10 king's graph

using GenericTensorNetworks
using Graphs
using Yao.YaoBlocks

Lx = Ly = 10
N = Lx * Ly
unit = 3.0
atoms = [(unit * ((i - 1) % Lx), unit * ((i - 1) ÷ Lx)) for i in 1:Lx*Ly]

g = SimpleGraph(N)
for i=1:N, j=i+1:N
    if sum(abs2, atoms[i] .- atoms[j]) <= unit ^ 2
        add_edge!(g, i, j)
    end
end
mis_problem = IndependentSet(g, ones(N));
configs_mapped = GenericTensorNetworks.solve(GenericTensorNetwork(mis_problem;), ConfigsMax())[];
MIS_config = YaoBlocks.BitStr{length(atoms)}(configs_mapped.c[1].data[1])
for i in 1:Ly
    println(MIS_config[(i-1)*Lx+1:i*Lx])
end

with an unreasonable output (the last few rows are all zero):

[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[0, 1, 0, 1, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

It seems that the ConfigsMax() option does not operate correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions