diff --git a/Project.toml b/Project.toml index 4e52d26..05b41c1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "NeuralNetworkReachability" uuid = "5de1e908-2f08-45bf-a571-ac88a54f7e7f" -version = "0.1.1" +version = "0.1.2" [deps] ControllerFormats = "02ac4b2c-022a-44aa-84a5-ea45a5754bcc" diff --git a/src/ForwardAlgorithms/PolyZonoForward.jl b/src/ForwardAlgorithms/PolyZonoForward.jl index 0ec16b4..29ee14c 100644 --- a/src/ForwardAlgorithms/PolyZonoForward.jl +++ b/src/ForwardAlgorithms/PolyZonoForward.jl @@ -187,7 +187,7 @@ function _polynomial_image(c::N, G, GI, E, polynomial, ::QuadraticApproximation) Ḡ = _Ḡ(G, GI, h, q, a₁, N) Ǧ2(i) = [GI[i] * GI[j] for j in (i + 1):q] Ǧ = iszero(q) ? N[] : - vcat((0.5 * a₁) .* GI .^ 2, vcat([2 * a₁ * Ǧ2(i) for i in 1:(q - 1)]...)) + vcat((0.5 * a₁) .* GI .^ 2, vcat([2 * a₁ * Ǧ2(i) for i in 1:(q - 1)]...)) cq = a₁ * c^2 + a₂ * c + a₃ if !isempty(GI) diff --git a/src/Util/ConvSet.jl b/src/Util/ConvSet.jl index 85eb5bf..28eb193 100644 --- a/src/Util/ConvSet.jl +++ b/src/Util/ConvSet.jl @@ -14,7 +14,7 @@ struct ConvSet{T<:LazySet} function ConvSet(set::T, dims::NTuple{3,Int}; validate=Val(true)) where {T} if validate isa Val{true} && (dim(set) != dims[1] * dims[2] * dims[3] || - dims[1] <= 0 || dims[2] <= 0 || dims[3] <= 0) + dims[1] <= 0 || dims[2] <= 0 || dims[3] <= 0) throw(ArgumentError("invalid dimensions $(dim(set)) and $dims")) end return new{T}(set, dims) diff --git a/test/ForwardAlgorithms/forward.jl b/test/ForwardAlgorithms/forward.jl index 5d09555..ee4b8ac 100755 --- a/test/ForwardAlgorithms/forward.jl +++ b/test/ForwardAlgorithms/forward.jl @@ -198,10 +198,11 @@ end return (0.0, 1.0, 0.0) end end - PZ5 = forward(PZ, L, PolyZonoForward(; polynomial_approximation=PaperQuadratic(true), - reduced_order=4)) - @test PZ5 == SparsePolynomialZonotope([1/8, 1], [1/4 -1/4 1/16 1/16 -1/8; 0 1 0 0 0], - hcat([1/8, 0]), [1 0 2 0 1; 0 1 0 2 1]) + PZ5 = forward(PZ, L, + PolyZonoForward(; polynomial_approximation=PaperQuadratic(true), + reduced_order=4)) + @test PZ5 == SparsePolynomialZonotope([1 / 8, 1], [1/4 -1/4 1/16 1/16 -1/8; 0 1 0 0 0], + hcat([1 / 8, 0]), [1 0 2 0 1; 0 1 0 2 1]) # fixed approximation is more precise in this case @test overapproximate(PZ5, Zonotope) ⊆ overapproximate(PZ4, Zonotope)