Define the problem as a mathematical programming model
This commit is contained in:
parent
1c82d1716a
commit
3a2dc40ce5
5 changed files with 89 additions and 0 deletions
15
test/optim.jl
Normal file
15
test/optim.jl
Normal file
|
@ -0,0 +1,15 @@
|
|||
using GardenOptim
|
||||
using LinearAlgebra
|
||||
using Test
|
||||
|
||||
@testset "optim" begin
|
||||
mask = zeros(Bool, 5, 7)
|
||||
mask[[1, 2, 6, 7]] .= 1
|
||||
@test GardenOptim.neighbourindices(mask, 1) == [6, 2]
|
||||
@test GardenOptim.neighbourindices(mask, 2) == [7, 1]
|
||||
@test GardenOptim.neighbourindices(mask, 3) == []
|
||||
neighbourcount = sum([length(GardenOptim.neighbourindices(mask, i)) for i = 1:length(mask)])
|
||||
@test sum(GardenOptim.neighbourmatrix(mask)) == neighbourcount
|
||||
@test issymmetric(GardenOptim.neighbourmatrix(mask))
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue