-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
263 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include("./counters.jl") | ||
include("./match.jl") | ||
include("./interaction.jl") | ||
include("./record.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
struct Interaction <: AbstractInteraction | ||
match_id::Int | ||
individual_id::Int | ||
other_ids::Vector{Int} | ||
score::Float32 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
struct Match <: AbstractMatch | ||
ids::Vector{Int} | ||
id::Int | ||
individuals::Vector{<:AbstractIndividual} | ||
environment_creator::AbstractCreator | ||
genotypes::Vector{<:AbstractGenotype} | ||
developers::Vector{<:AbstractCreator} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Generic record, typically used for fitness-proportional selection | ||
struct Record <: AbstractRecord | ||
id::Int | ||
fitness::Float64 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include("./environment.jl") | ||
include("./numbersgame.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
struct All_vs_All <: AbstractMatchMaker | ||
export AllVsAllMatchMaker, make_matches! | ||
struct AllVsAllMatchMaker <: AbstractMatchMaker | ||
condition::Function | ||
retriever::AbstractRetriever | ||
operator::Function | ||
updater::AbstractUpdater | ||
rng::Union{AbstractRNG, Nothing} | ||
updater::Union{AbstractUpdater, Function} | ||
data::Vector{AbstractData} | ||
end | ||
|
||
function All_vs_All() | ||
condition = (::AbstractState) -> true | ||
retriever = (::AbstractState) -> state.populations | ||
operator = (pop::AbstractPopulation) -> pop | ||
updater = add_matches! | ||
rng = StableRNG(1234) | ||
All_vs_All(condition, retriever, operator, updater, rng, AbstractData[]) | ||
function AllVsAllMatchMaker(ids::Vector{String}=String[]) | ||
condition = always | ||
retriever = PopulationRetriever(ids) | ||
operator = noop | ||
updater = make_matches! | ||
AllVsAllMatchMaker(condition, retriever, operator, updater, AbstractData[]) | ||
end | ||
|
||
|
||
function make_matches!(state::AbstractState, pops::Vector{Vector{Population}}) | ||
match_counter = get_counter(AbstractMatch, state) | ||
env_creators = get_creators(AbstractEnvironment, state) | ||
@assert length(env_creators) == 1 "There should be exactly one environment creator for the time being, found $(length(env_creators))." | ||
env_creator = env_creators[1] | ||
for i in 1:length(pops), j in i+1:length(pops) # for each pair of populations | ||
for subpopi in pops[i], subpopj in pops[j] # for each pair of subpopulations | ||
for indi in subpopi.individuals, indj in subpopj.individuals # for each pair of individuals | ||
push!(state.matches, Match(inc!(match_counter), [indi, indj], env_creator)) | ||
end | ||
end | ||
end | ||
@assert length(state.matches) > 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include("./all_vs_all.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include("./retrievers/retrievers.jl") | ||
include("./updaters/updaters.jl") | ||
include("./operator.jl") | ||
include("./initializers.jl") | ||
include("./matchmaker/matchmaker.jl") | ||
include("./performer.jl") | ||
include("./mutators/mutators.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export Performer | ||
|
||
Base.@kwdef struct Performer <: AbstractPerformer | ||
condition::Function = always | ||
retriever::Union{AbstractRetriever,Function} = (state::AbstractState) -> state.matches | ||
operator::Function = noop | ||
updater::AbstractUpdater = ComputeInteractions() | ||
data::Vector{<:AbstractData} = AbstractData[] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include("./numbersgame.jl") | ||
include("./nn.jl") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.