Closed ndo885 closed 8 months ago
Hey! I’m not a developer on this package, but I have used it in the past and I can help you interpret this error message.
The Julia error that you got says that the types of the arguments that you gave to the mk_sched
function are not correct, but it did find a candidate solution. The first arguments in black: mk_sched(::NamedTuple, ::NamedTuple,
were matched correctly. Julia would use this definition of mk_sched
if not for the remaining types, which it could not match on.
The first argument that it didn’t find (the first type in red) was something with the type ::Names
. As an example on how to create a Names
object, you can see this line from the tests: https://github.com/AlgebraicJulia/AlgebraicRewriting.jl/blob/ddce48efb155564e766db31b540e5abb7dca3259/test/schedules/Eval.jl#L38
And where it is used here: https://github.com/AlgebraicJulia/AlgebraicRewriting.jl/blob/ddce48efb155564e766db31b540e5abb7dca3259/test/schedules/Eval.jl#L70
So, we should create our Names
object here like:
N = Names(Dict("S" => S, "I" => I, "G” => G));
And pass this as the third argument to mk_sched
.
For an example of a similar dynamics, check out this docs page:
https://algebraicjulia.github.io/AlgebraicRewriting.jl/dev/generated/lotka_volterra/
You can ctrl+f in this document for Names
and mk_sched
.
I hope this helps! ~ Luke
Thanks Luke! I should note that, as of an hour ago, there's a new release of AlgebraicRewriting (0.3.1) to accompany a new release of Catlab! The docs page Luke linked is important because that file gets run automatically with the tests whenever we push code (the code in the blog post does not get run, so it can become out of date).
An important difference in this latest release so the rewriting simulation can be fast via the use of in-place rewriting (rather than Catlab's normal pushout infrastructure which is a pure, non-mutating function). For this to work, there's a keyword you need to pass in when creating your ACSet data type @acset_type MyACSetType(MySchema, part_type=BitSetParts)
.
I've added a caveat to the blog post which notes the code there could be out of date. It also links to the Lotka Volterra demo, which I have also recently added a lot more exposition to. If you still have trouble getting an ABM up and running (with AlgRewriting version 0.3.2), let me know!
Hi, Our CEPHIL team has been having trouble running block 17 of the following notebook code for "Agent-based modeling via graph rewriting" blog.
https://nbviewer.org/github/AlgebraicJulia/AlgebraicRewriting.jl/blob/compat_varacsets/docs/src/Dynamic%20Tracing.ipynb
Specifically, we get an error message indicating that "mk_sched" cannot be found. Here's the exact code and error message:
My project .toml file is attached as a txt file (so it can be attached_); is it adopted from the July7_2023 commit (reflecting the July 7 date of the associated blog post (https://blog.algebraicjulia.org/post/2023/07/graphical-schedule/#cb3-2). Project.toml.txt
I further attach my complete .ipynb file, again as a .txt file so that it can be attached. ACT-ABM-BlogExample-Jan-2023_With-July7_2023_Project_toml.ipynb.txt
Thanks so much for any guidance that can be offered!