NaiveNASlib.jl icon indicating copy to clipboard operation
NaiveNASlib.jl copied to clipboard

Incorrect outputs selected by PostSelectOutputs and remove_edge! of SizeStack

Open DrChainsaw opened this issue 6 years ago • 0 comments

Reason is basically that the edge is removed before outputs are selected.

Mwe to run in structure.jl:

            @testset "PostSelectOutputs SizeStack" begin
                v0 = inpt(3, "v0")
                v1 = av(v0, 3, name="v1")
                v2 = av(v0, 4, name="v2")
                v3 = av(v0, 5, name="v3")
                v4 = sv(v1,v2,v3, name = "v4")
                v5 = av(v4, 3, name="v5")

                remove_edge!(v2, v4, strategy=PostSelectOutputs(valuefun = v -> 1:nout_org(v)))

                @test inputs(v4) == [v1, v3]
                @test nin(v4) == nout.([v1, v3]) == [3,5]
                @test out_inds(op(v1)) == 1:3
                @test out_inds(op(v2)) == 1:4
                @test out_inds(op(v3)) == 1:5
                # This would be better if it was [1:3;8:12] but remove_vertex removes the edge before PostSelectOutputs has a chance to see it :(
                @test out_inds(op(v4)) == 1:8
                @test in_inds(op(v5)) == [1:8]
            end

DrChainsaw avatar Oct 30 '19 23:10 DrChainsaw