From 709b8360951dfe740772e77c7c6d93c440f9f53d Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Wed, 11 Sep 2024 14:56:18 -0700 Subject: [PATCH] Use sigma action branch --- docs/literate/game_of_life.jl | 2 +- docs/literate/lotka_volterra.jl | 13 ++++++++----- src/ABMs.jl | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/literate/game_of_life.jl b/docs/literate/game_of_life.jl index f7b3cc4..8d322ce 100644 --- a/docs/literate/game_of_life.jl +++ b/docs/literate/game_of_life.jl @@ -174,7 +174,7 @@ If we call `AddCoords` on something built out of `LifeState` instances, it will make the corresponding thing built out of `LifeStateCoords` instances. =# -AddCoords = Migrate(SchLifeGraph, LifeState, SchLifeCoords, LifeStateCoords; delta=false); +AddCoords = ΣMigration(FinFunctor(SchLifeGraph, SchLifeCoords), LifeStateCoords); # ## Initial state for the model diff --git a/docs/literate/lotka_volterra.jl b/docs/literate/lotka_volterra.jl index b8a652f..d97bc1d 100644 --- a/docs/literate/lotka_volterra.jl +++ b/docs/literate/lotka_volterra.jl @@ -219,11 +219,14 @@ migration, we can define them in terms of sheep and then migrate along `F` to obtain the analogous actions for wolves. =# -F = Migrate( - Dict(:Sheep => :Wolf, :Wolf => :Sheep), - Dict([:sheep_loc => :wolf_loc, :wolf_loc => :sheep_loc, +F = ΔMigration(FinFunctor( + Dict(:Sheep => :Wolf, :Wolf => :Sheep, :Direction => :Direction, :Eng=>:Eng, + :Time=>:Time, :V=>:V, :E=>:E), + Dict(:sheep_loc => :wolf_loc, :wolf_loc => :sheep_loc, :sheep_eng => :wolf_eng, :wolf_eng => :sheep_eng, :countdown => :countdown, - :sheep_dir => :wolf_dir, :wolf_dir => :sheep_dir,]), SchLV, LV); + :sheep_dir => :wolf_dir, :wolf_dir => :sheep_dir, + :src=>:src,:tgt=>:tgt,:inv=>:inv,:dir=>:dir,:left=>:left,:right=>:right, + ), SchLV, SchLV), LV); #= We ought to be able to take a state of the world (with no coordinate information) @@ -231,7 +234,7 @@ and obtain a state of the world with coordinates (the canonical way to do this is to assign "variables" for the values of the coordinates). =# -Viz = Migrate(SchLV, LV, SchLV_Viz, LV_Viz; delta=false); +Viz = ΣMigration(FinFunctor(SchLV, SchLV_Viz), LV_Viz); # # Representables #= diff --git a/src/ABMs.jl b/src/ABMs.jl index 98b2235..ce98806 100644 --- a/src/ABMs.jl +++ b/src/ABMs.jl @@ -239,7 +239,7 @@ basis_pattern(r::ABMRule) = isnothing(r.basis) ? codom(left(r)) : dom(basis(r)) get_matches(r::ABMRule, args...; kw...) = get_matches(getrule(r), args...; kw...) -(F::Migrate)(r::ABMRule) = +(F::SimpleMigration)(r::ABMRule) = ABMRule(F(r.rule), r.timer; basis=F(r.basis), name=r.name) """ @@ -281,7 +281,7 @@ end additions(abm::ABM) = right.(abm.rules) -(F::Migrate)(abm::ABM) = ABM(F.(abm.rules), abm.dyn) +(F::SimpleMigration)(abm::ABM) = ABM(F.(abm.rules), abm.dyn) Base.getindex(abm::ABM, i::Int) = abm.rules[i] Base.getindex(abm::ABM, n::Symbol) = abm.rules[abm.names[n]]