Skip to content

Commit

Permalink
Working on implementing a weightvector neighborhood
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnebro committed Sep 10, 2024
1 parent 3a28e23 commit 6f9383d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/MetaJul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export CrowdingDistanceComparator
export compare
include("util/comparator.jl")

export Neighborhood
export minFastSort
include("util/neighborhood.jl")

export NonDominatedArchive, CrowdingDistanceArchive
export add!, isEmpty, contain, getSolutions
include("util/archive.jl")
Expand Down Expand Up @@ -176,8 +180,5 @@ export AggregationFunction, WeightedSum
export compute
include("util/aggregationFunction.jl")

export Neighborhood
export minFastSort
include("util/neighborhood.jl")
end
# module metajul
2 changes: 1 addition & 1 deletion src/component/evolutionaryAlgorithm/selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ end
ARCHIVE
end

abstract type Neighborhood{S} end
#abstract type Neighborhood{S} end

struct PopulationAndNeighborhoodSelection{T} <: Selection
matingPoolSize::Int
Expand Down
2 changes: 1 addition & 1 deletion src/util/neighborhood.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
abstract type Neighborhood end
abstract type Neighborhood{S} end

function minFastSort(x::Vector{Float64}, idx::Vector{Int}, n::Int, m::Int)
for i in 1:m
Expand Down
4 changes: 1 addition & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ function createContinuousSolution(numberOfObjectives::Int)::ContinuousSolution{F
return ContinuousSolution{Float64}([1.0], objectives, [], Dict(), [Bounds{Float64}(1.0, 10.0), Bounds{Float64}(1.0, 10.0)])
end

#=
coreTests = [
"core/constraintHandlingTest.jl"
]
Expand Down Expand Up @@ -110,7 +108,7 @@ end
include("util/pointTest.jl")
include("util/aggregationFunctionTest.jl")

=#

include("util/neighborhoodTest.jl")


11 changes: 11 additions & 0 deletions test/util/neighborhoodTest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Unit Tests for method minFastSort
@testset "minFastSort Tests" begin
# Test 1
x = [2.0, 1.0]
idx = [1, 2]
n = length(x)
m = 2
minFastSort(x, idx, n, m)
@test x == [1.0, 2.0]
@test idx == [2, 1]
end

0 comments on commit 6f9383d

Please sign in to comment.