Skip to content

Instantly share code, notes, and snippets.

@aa25desh
Last active April 27, 2019 09:30
Show Gist options
  • Save aa25desh/a14ebdaf27f8b8f765fa3a672d688144 to your computer and use it in GitHub Desktop.
Save aa25desh/a14ebdaf27f8b8f765fa3a672d688144 to your computer and use it in GitHub Desktop.
Task. Add a new section in the LazySets manual
using LazySets
Z1=rand(Zonotope,dim=1,num_generators=2)
Z2=rand(Zonotope,dim=3,num_generators=5)
using Plots
Z=rand(Zonotope,dim=2,num_generators=4)
plot(Z)
ZP = Zonotope([1.0, 0.0], [0.1 0.0; 0.0 0.1])
[1.0, 0.2] ∈ ZP
∈([1.0, 0.1], ZP)
Z.center
Z.generators
dim(Z)
constraints_list(Z)
ngens(Z)
Z = rand(Zonotope)
Z ⊆ Z
[Singleton(vi) ⊆ Z for vi in vertices_list(Z)]
Zonotope(Z.center, Z.generators/2) ⊆ Z
BallInf(zeros(2), 0.1) ⊕ Z.center ⊆ Z
BallInf(zeros(2), 1.0) ⊕ Z.center ⊆ Z
Z2=rand(Zonotope,dim=1,num_generators=1)
Z1=rand(Zonotope,dim=2,num_generators=1)
CartesianProduct(Z1,Z2)
A1=rand(Zonotope,dim=3,num_generators=5)
A2=rand(Zonotope,dim=2,num_generators=7)
Plot(A2)
Z1 = rand(Zonotope)
Z2 = rand(Zonotope)
minkowski_sum(Z1,Z2) isa Zonotope
scale(4,Z1)
translate(Z1,[1.,2.])
convert(HPolytope,Z1)
Z = rand(Zonotope)
rand(2, 2) * Z # linear map
rand(2, 2) * Z ⊕ rand(2) # affine map
using LazySets.Approximations
Z1=Zonotpe([0.,0.],[[1.,0],[0.,1.],[1.,1.]])
plot(Z1)
C=overapproximate(Z1,Zonotope)
plot!(C)
Z=Zonotope([0.,0.],[[1.,0.],[0.,1.]])
plot(Z)
Z1=Zonotope([0.,0.],[[1.,0],[0.,1.],[1.,1.]]) #add line joining [-[1.,1.] ,[1.,1.]]
plot!(Z1)
L1 = LineSegment(-[1., 0.], [1.0, 0.0])
plot(L1)
L2 = LineSegment(-[0., 1.], [0., 1.])
plot!(L2)
L3 = LineSegment(-[1.,1.] ,[1.,1.])
plot!(L3)
plot!(L1 ⊕ L2 ⊕ L3, 1e-3) # Zonotope
d=rand(1,2)
d = [0. 1.; 1. 0.]
ZL=Zonotope([0.,0.],[[1.,1.],[1.,0.]])
T= linear_map(d,ZL)
plot(d)
plot!(ZL)
S=rand(Zonotope,dim=2,num_generators=10)
reduce_order(S, 4)
plot(S)
E=reduce_order(S,3)
plot!(E)
reduce_order(S,2)
Z=Zonotope([0.,0.],[[1.,0.],[0.,1.]])
plot(Z)
Z1=Zonotpe([0.,0.],[[1.,0],[0.,1.],[1.,1.]])
plot!(Z1)
D=CH(Z1,Z2)
plot!(D)
M,N=split(S,1)
plot(M)
plot!(N)
M,N=split(S,3)
plot(M)
plot!(N)
M,N=split(S,5)
plot(M)
plot!(N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment