Skip to content

Commit

Permalink
Merge pull request #28 from JuliaReach/schillic/update
Browse files Browse the repository at this point in the history
Format code and v0.1.2
  • Loading branch information
schillic committed May 25, 2024
2 parents efc5f41 + 5915afd commit 56855ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/ForwardAlgorithms/PolyZonoForward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Util/ConvSet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions test/ForwardAlgorithms/forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

2 comments on commit 56855ac

@schillic
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/107659

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" 56855ac72d6cb06026d04f3a63cc04dbaad4e706
git push origin v0.1.2

Please sign in to comment.