Closed AtiyahElsheikh closed 1 year ago
The code was initially designed to cope with an experimental attempt for providing a specification language for ABMs. While Create module correspondingly describes creation or a declaration of (a set of) agents, Initialize module describes a sophisticated initialisation process that need to be carried out separately from the initialisation process.
W.r.t. Initialize functions, apparently there are two patterns of initialisation process:
# initialziation of single-type of agents
initializeX(Vector{AgentsX}, parX)
...
# initialziation of two types of agents
initializeY(Vecotr{AgentsY1}, Vector{AgentsY2}, pary1,pary2, pary3)
Similarly to create* functions, it is desired to unify the API of initialise functions.
A proposed solution is to have generic functions:
initialize!(::Vector{Agents},pars)
# and
initialConnect!(::Vector{AgentT1}, ::Vector{AgentT2}, pars )
connect implies visual components in a graphical editor that can be connected together.
Since it is potentially possible for the client to select / neglect (a combination of) initialisation processes, the Port concept is introduced:
abstract type AbsPort end
...
struct InitProcessXPort <: AbsPrt end
initialConnect!( ::Vector{AgentT1}, ::Vector{AgentT2}, pars , ::InitProcessXPort)
# and / or
initialConnect!( ::Vector{AgentT1}, ::Vector{AgentT2}, pars , ::InitProcessYPort)
...
The same initialisation concept for initialisation process with one type of agents can be thought.
Also it is thinkable to make connection symmetric. However, common conventions implies that the first argument should be modified (while the second may or may not be modified).
Currently, when there is no more than one possible initialisation process for a connection between two specific types of agents, a default behavior is offered, e.g.:
initialConnect!(houses::Vector{House},
towns::Vector{Town},
pars) =
initialConnect!(houses,towns,pars,InitHousesInTownsPort())
initialConnect! is going to be symmetric w.r.t. its first argumetns, i.e.
initialConnect!(x, y, pars ) # is the same as initialConnect!(y,x,pars)
It is up to the client to following the convention that first argument or (arguments) shall be modified.
Related to #15 (i.e. the prototype for the initialise module shall be unified)
Initialise* functions in mainHelpers.jl within LPM.jl version 0.1.3 clearly belongs to SE as