Skip to content

Commit

Permalink
Merge pull request #3780 from JuliaReach/schillic/makie
Browse files Browse the repository at this point in the history
Update test dependencies (Polyhedra, CDDLib)
  • Loading branch information
schillic authored Jan 24, 2025
2 parents 8376f49 + 219aad1 commit a3240b3
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TaylorModels = "314ce334-5f6e-57ae-acf6-00b6e903104a"
[compat]
AbstractTrees = "0.4"
BenchmarkTools = "1"
CDDLib = "0.9"
CDDLib = "0.9 - 0.10"
Distributions = "0.25"
Documenter = "1"
ExponentialUtilities = "1"
Expand All @@ -31,7 +31,7 @@ LaTeXStrings = "1"
MiniQhull = "0.4"
Optim = "1"
Plots = "1"
Polyhedra = "0.7"
Polyhedra = "0.7 - 0.8"
RecipesBase = "1"
StaticArrays = "1"
SymEngine = "0.7 - 0.12"
Expand Down
4 changes: 2 additions & 2 deletions src/ConcreteOperations/intersection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ A `VPolytope`.
### Notes
If `prunefunc` is `nothing`, this implementation sets it to
`(X -> removevredundancy!(X; ztol=_ztol(eltype(P1))))`.
`(X -> removevredundancy!(X; tol=_ztol(eltype(P1))))`.
"""
function intersection(P1::Union{VPolygon,VPolytope},
P2::Union{VPolygon,VPolytope};
Expand Down Expand Up @@ -578,7 +578,7 @@ function intersection(P1::Union{VPolygon,VPolytope},

N = promote_type(eltype(P1), eltype(P2))
if isnothing(prunefunc)
prunefunc = (X -> removevredundancy!(X; ztol=_ztol(N)))
prunefunc = (X -> _removevredundancy!(X; N=N))
end
prunefunc(Pint)

Expand Down
3 changes: 3 additions & 0 deletions src/Initialization/init_GeometryBasics.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this file is loaded from `init_Polyhedra.jl`

eval(load_Polyhedra_GeometryBasics_triangulate())
17 changes: 16 additions & 1 deletion src/Initialization/init_Polyhedra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,20 @@ function _is_polyhedra_backend(backend::Polyhedra.Library)
return true
end

# in v0.8.0, `Polyhedra` renamed the kwarg `ztol` to `tol`
@static if hasmethod(Polyhedra.detecthlinearity, (Polyhedra.HRepresentation, Any), (:ztol,))
function _removevredundancy!(X; N)
return removevredundancy!(X; ztol=_ztol(N))
end
else
@assert hasmethod(Polyhedra.detecthlinearity, (Polyhedra.HRepresentation, Any), (:tol,))

function _removevredundancy!(X; N)
return removevredundancy!(X; tol=_ztol(N))
end
end

eval(load_polyhedra_mesh())
eval(load_polyhedra_lazyset())
eval(load_Polyhedra_polyhedron())

include("init_GeometryBasics.jl")
3 changes: 2 additions & 1 deletion src/Interfaces/AbstractPolyhedron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ function _linear_map_hrep_helper(M::AbstractMatrix, P::LazySet,
return HPolyhedron(constraints)
end

# internal functions; defined here due to dependency SymEngine and submodules
# internal functions; defined here due to optional dependencies and submodules
function isfeasible end
function remove_redundant_constraints end
function remove_redundant_constraints! end
function _ishalfspace end
function _ishyperplanar end
function _parse_linear_expression end
function _removevredundancy! end

# To account for the compilation order, other functions are defined in the file
# AbstractPolyhedron_functions.jl
12 changes: 8 additions & 4 deletions src/Interfaces/LazySet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ function chebyshev_center_radius(P::LazySet;
return c, r
end

function load_polyhedra_lazyset() # function to be loaded by Requires
function load_Polyhedra_polyhedron()
return quote
# see the interface file init_Polyhedra.jl for the imports

Expand Down Expand Up @@ -1410,7 +1410,11 @@ function load_polyhedra_lazyset() # function to be loaded by Requires
A, b = tosimplehrep(P)
return Polyhedra.polyhedron(Polyhedra.hrep(A, b), backend)
end
end
end # quote / load_Polyhedra_polyhedron()

function load_Polyhedra_GeometryBasics_triangulate()
return quote
"""
triangulate(X::LazySet)
Expand Down Expand Up @@ -1439,8 +1443,8 @@ function load_polyhedra_lazyset() # function to be loaded by Requires

P = polyhedron(X)
mes = Mesh(P)
coords = Polyhedra.GeometryBasics.coordinates(mes)
connec = Polyhedra.GeometryBasics.faces(mes)
coords = GeometryBasics.coordinates(mes)
connec = GeometryBasics.faces(mes)

ntriangles = length(connec)
npoints = length(coords)
Expand All @@ -1456,7 +1460,7 @@ function load_polyhedra_lazyset() # function to be loaded by Requires
return points, connec_tup
end
end
end # quote / load_polyhedra_lazyset()
end # quote / load_Polyhedra_GeometryBasics_triangulate()

"""
# Extended help
Expand Down
3 changes: 2 additions & 1 deletion src/Sets/HPolytope/HPolytopeModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ using Reexport, Requires
using ..LazySets: AbstractPolytope, LazySet, AbstractLinearMapAlgorithm,
default_polyhedra_backend, vertices_list_1d,
_infeasible_constraints_list, _linear_map_hrep,
_minkowski_sum_hrep_preprocess, _normal_Vector
_minkowski_sum_hrep_preprocess, _normal_Vector,
_removevredundancy!
using ..HalfSpaceModule: HalfSpace
using Random: AbstractRNG, GLOBAL_RNG
using ReachabilityBase.Distribution: reseed!
Expand Down
2 changes: 1 addition & 1 deletion src/Sets/HPolytope/vertices_list.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function vertices_list(P::HPolytope; backend=nothing, prune::Bool=true)
end
Q = Polyhedra.polyhedron(P; backend=backend)
if prune
Polyhedra.removevredundancy!(Q; ztol=_ztol(N))
_removevredundancy!(Q; N=N)
end
return collect(Polyhedra.points(Q))
end
3 changes: 2 additions & 1 deletion src/Sets/VPolytope/VPolytopeModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ using Reexport, Requires
using ..LazySets: AbstractPolytope, LazySet, LinearMapVRep, default_lp_solver,
default_lp_solver_polyhedra, default_polyhedra_backend,
is_lp_infeasible, is_lp_optimal, linprog, _extrema_vlist,
_high_vlist, _low_vlist, _minkowski_sum_vrep_nd
_high_vlist, _low_vlist, _minkowski_sum_vrep_nd,
_removevredundancy!
using LinearAlgebra: dot
using Random: AbstractRNG, GLOBAL_RNG
using ReachabilityBase.Arrays: projection_matrix
Expand Down
2 changes: 1 addition & 1 deletion src/Sets/VPolytope/remove_redundant_vertices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function remove_redundant_vertices(P::VPolytope; backend=nothing, solver=nothing
vQ = Polyhedra.vrep(Q)
Polyhedra.setvrep!(Q, Polyhedra.removevredundancy(vQ, solver))
else
Polyhedra.removevredundancy!(Q; ztol=_ztol(N))
_removevredundancy!(Q; N=N)
end
return VPolytope(Q)
end
2 changes: 2 additions & 0 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ function __init__()
@require Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" include("Initialization/init_Distributions.jl")
@require Expokit = "a1e7a1ef-7a5d-5822-a38c-be74e1bb89f4" include("Initialization/init_Expokit.jl")
@require ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18" include("Initialization/init_ExponentialUtilities.jl")
# the includes for `GeometryBasics` are loaded when `Polyhedra` is loaded
@require GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" (nothing,)
@require Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" (nothing,)
@require Javis = "78b212ba-a7f9-42d4-b726-60726080707e" include("Initialization/init_Javis.jl")
@require Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("Initialization/init_Makie.jl")
Expand Down
4 changes: 2 additions & 2 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"

[compat]
Aqua = "0.8.9"
CDDLib = "0.6 - 0.9"
CDDLib = "0.6 - 0.10"
Distributions = "0.19 - 0.25"
Expokit = "0.2"
ExponentialUtilities = "1"
Expand All @@ -47,7 +47,7 @@ Makie = "0.9 - 0.21"
MiniQhull = "0.1 - 0.4"
Optim = "0.15 - 0.22, 1"
PkgVersion = "0.3"
Polyhedra = "0.6 - 0.7"
Polyhedra = "0.6 - 0.8"
RangeEnclosures = "0.1.1, 0.2"
RecipesBase = "0.6 - 0.8, 1"
SCS = "1, 2"
Expand Down

0 comments on commit a3240b3

Please sign in to comment.