diff --git a/Project.toml b/Project.toml index cdde115..30f8c11 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CellularAutomata" uuid = "878138dc-5b27-11ea-1a71-cb95d38d6b29" authors = ["Francesco Martinuzzi"] -version = "0.1.0" +version = "0.1.1" [deps] ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" diff --git a/docs/pages.jl b/docs/pages.jl index 3432126..081189e 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -1,5 +1,6 @@ pages = [ "CellularAutomata.jl" => "index.md", + "Migration guide" => "migration.md", "Differentiable cellular automata" => "ad_design.md", "Examples" => [ "One dimensional CA" => "onedim/onedimensionca.md" diff --git a/docs/src/migration.md b/docs/src/migration.md new file mode 100644 index 0000000..0588817 --- /dev/null +++ b/docs/src/migration.md @@ -0,0 +1,63 @@ +# Migration guide (to 0.1) + +Version 0.1 reshapes the internals for automatic differentiation and future +neural-CA support. This page lists what changed and how to update calling code. + +## Field access replaced with accessor functions + +Struct fields are no longer public API; use the accessor functions instead. + +| Before | Now | +|:---------------------- |:------------------------------------- | +| `automaton.evolution` | `evolution_history(automaton)` | +| `automaton.rule` | `cellular_automaton_rule(automaton)` | +| `automaton.generations`| `generation_count(automaton)` | +| `dca.ruleset` | `rule_lookup_table(dca)` | +| `dca.radius` | `neighborhood_radius(dca)` | +| `dca.states` | `cell_state_count(dca)` | + +## Discrete rule states must have an `Integer` eltype + +`DCA`/`TCA` now validate the state array and reject non-integer eltypes, even +when the values are integer-valued. + +| Before | Now | +|:---------------- |:-------------------- | +| `zeros(ncells)` | `zeros(Int, ncells)` | + +## Abstract type hierarchy renamed + +Only relevant if you dispatched on these types directly. + +| Before | Now | +|:---------------------- |:------------------------------------------------ | +| `AbstractCA` | `AbstractCellularAutomaton` | +| `AbstractRule` | `AbstractCellularAutomatonRule` | +| `AbstractODRule` | dimension/kind-specific subtype (see below) | +| `AbstractTDRule` | dimension/kind-specific subtype (see below) | +| `AbstractDCARule` | `AbstractDiscreteCellularAutomatonRule` | +| `AbstractCCARule` | `AbstractContinuousCellularAutomatonRule` | +| `AbstractTCARule` | `AbstractTotalisticCellularAutomatonRule` | +| `AbstractLifeRule` | `AbstractLifeLikeCellularAutomatonRule` | + +## New functional core: `next_state`/`rollout` + +The callable interface (`dca(state)`, `life(state)`, ...) still works, but now +delegates to `next_state`/`rollout`, which are the recommended entry points +going forward and required for AD use. + +| Before | Now | +|:--------------------------------------- |:------------------------------------------------------ | +| `dca(state)` | `next_state(dca, state)` (or keep calling `dca(state)`)| +| `CellularAutomaton(rule, ic, n)` loop | `rollout(rule, ic, n; save=true)` for a bare trajectory| + +## Boundary conditions are now explicit + +Previously periodic wraparound was hardcoded. It is now the `Periodic()` +default of a new `AbstractBoundaryCondition` family, passed via the `boundary` +keyword. Default behavior is unchanged unless you relied on internal helpers. + +| Before | Now | +|:---------------------- |:-------------------------------------------------- | +| (hardcoded periodic) | `next_state(rule, state; boundary=Periodic())` | +| | `Reflecting()` and `ConstantBoundary(value)` also available |