Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Use Julia cache
uses: julia-actions/cache@v2
- name: Install JuliaFormatter.jl
run: julia -e 'using Pkg; pkg"add JuliaFormatter@1"'
run: julia -e 'using Pkg; pkg"add JuliaFormatter@2"'
- name: Setup Python
uses: actions/setup-python@v6
with:
Expand Down
18 changes: 3 additions & 15 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
name = "GraphDynamicalSystems"
uuid = "13529e2e-ed53-56b1-bd6f-420b01fca819"
version = "0.0.7"
authors = ["Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com>"]
version = "0.0.6"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
DynamicalSystemsBase = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
HerbConstraints = "1fa96474-3206-4513-b4fa-23913f296dfc"
HerbCore = "2b23ba43-8213-43cb-b5ea-38c12b45bd45"
HerbGrammar = "4ef9e186-2fe5-4b24-8de7-9f7291f24af7"
HerbSearch = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MetaGraphsNext = "fa8bd995-216d-47f1-8a91-f3b68fbeb377"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructUtils = "ec057cc2-7a8d-4b58-b3b3-92acb9f63b42"
TermInterface = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c"

[compat]
AbstractTrees = "0.4.5"
AutoHashEquals = "2.2.0"
DocStringExtensions = "0.9.3"
DynamicalSystemsBase = "3.10"
Graphs = "1.12"
HerbConstraints = "0.4"
HerbCore = "0.3.4"
HerbGrammar = "0.6"
HerbSearch = "0.4.1"
JSON = "1"
MLStyle = "0.4.17"
MacroTools = "0.5.16"
MetaGraphsNext = "0.7"
Random = "1.10"
SciMLBase = "2.74.1"
StaticArrays = "1.9.12"
StructUtils = "2.5.1"
TermInterface = "2.0.0"
julia = "1.10"
25 changes: 1 addition & 24 deletions src/GraphDynamicalSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,9 @@ module GraphDynamicalSystems
using DocStringExtensions

include("gds_interface.jl")
export GraphDynamicalSystem,
GDS,
ScheduleStyle,
Asynchronous,
Synchronous,
get_n_entities,
entities,
get_schedule,
get_state,
get_graph

include("qualitative_networks.jl")
export QualitativeNetwork,
QN,
Entity,
build_qn_grammar,
update_functions_to_interaction_graph,
sample_qualitative_network,
get_domain,
target_functions,
interpret,
create_qn_system,
default_target_function,
set_state!,
current_parameters

include("io/bma.jl")
# include("io/bma.jl")

end
47 changes: 43 additions & 4 deletions src/gds_interface.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import DynamicalSystemsBase.get_state
import DynamicalSystemsBase as DSB
using MetaGraphsNext: labels

public ScheduleStyle,
Asynchronous,
Synchronous,
GraphDynamicalSystem,
GDS,
get_n_entities,
get_schedule,
get_graph,
get_domain,
get_fn

abstract type ScheduleStyle end
struct Asynchronous <: ScheduleStyle end
struct Synchronous <: ScheduleStyle end

abstract type GraphDynamicalSystem{N,S} end
# A GDS is a DiscreteTimeDynamicalSystem where the model is a MetaGraph with
# functions at each of the vertices in the graph. The parameters of the system
# include the ranges of each of the entities. The state of the system is just
# the current value of each of the entities

abstract type GraphDynamicalSystem{N,S} <: DSB.DiscreteTimeDynamicalSystem end
const GDS = GraphDynamicalSystem

"""
Expand Down Expand Up @@ -44,11 +60,34 @@ function entities(gds::GDS)
return collect(labels(get_graph(gds)))
end

abstract type AbstractEntity end

function get_fn end

"""
$(TYPEDSIGNATURES)

Get the state of the GDS.
"""
function get_state(gds::GDS)
return gds.state
function DSB.current_state(gds::GDS)
g = get_graph(gds)
l = labels(g)
return DSB.current_state.(getindex.((g,), l))
end

function DSB.current_state(gds::GDS, entity)
g = get_graph(gds)
return DSB.current_state(g[entity])
end

function get_fn(gds::GDS)
g = get_graph(gds)
l = labels(g)
return get_fn.(getindex.((g,), l))
end

function get_domain(gds::GDS)
g = get_graph(gds)
l = labels(g)
return get_domain.(getindex.((g,), l))
end
Loading
Loading