Skip to content

Commit cc16ce8

Browse files
committed
[DEV] Add functions to remove redundant cuts
1 parent 7665569 commit cc16ce8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/utils.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,29 @@ function read_polyhedral_functions(dump::AbstractString)
7373
end
7474

7575

76+
"""
77+
Remove redundant cuts in Polyhedral Value functions
78+
79+
"""
80+
function remove_cuts(V::PolyhedralFunction)
81+
Vf = hcat(V.lambdas, V.be tas)
82+
Vf = unique(Vf, 1)
83+
return PolyhedralFunction(Vf[:, end], Vf[:, 1:end-1], size(Vf)[1])
84+
end
85+
86+
87+
"""
88+
Remove redundant cuts in a vector of Polyhedral Functions.
89+
90+
"""
91+
function remove_redundant_cuts!(Vts::Vector{PolyhedralFunction})
92+
n_funct ions = length(Vts)
93+
for i in 1:n_functions
94+
Vts[i] = remove_cuts(Vts[i])
95+
end
96+
end
97+
98+
7699
"""
77100
Extract a vector stored in a 3D Array
78101

0 commit comments

Comments
 (0)