-
-
Notifications
You must be signed in to change notification settings - Fork 232
dependency graphs for JumpSystems #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think this may be able to be done at the abstract system level, which would be nice because #281 could then be solved at the same time. I think there could be an Also, I wonder if we should go all of the way at this point to making that return a LightGraphs Then solving #281 is just |
Jumps will also need an eq to eq dependency graph, which you can build using the eq to state and state to eq graphs. Just to be clear, you are suggesting the default dep graph be a map from eqs to states each eq depends on, as opposed to states to eqs that depend on them. Before I work on this more there are a few questions that would be good to settle (to avoid rewriting this too much):
I'll take a look at LightGraphs tonight before I work on this more as I haven't used it much. |
eq -> states is the rows of the Jacobian and states -> eq is the column. states -> eq might be the most performant one for building sparsity patterns. eq -> eq is needed for SSAs, and states-> states is probably what people want to plot most of the time. So it would be nice to have a whole section of the docs on these different dependency graphs and maybe have four functions, or one function with switches on what to create and output?
The simplest version of the graph should probably just go to
That makes a lot of sense for type reasons as well. Or make it an
Yeah, and I don't think it can specialize on that, so it might need to ignore vrjs in the SSA side. That might be a deep and hard issue to solve though...
I believe so. |
I had a vague memory you had a way to have a heterogeneous tuple of arrays look like one array, but couldn’t remember the type/package name. Thanks for the pointer to Arraypartitions. |
I looked at the Lightgraphs docs yesterday some; my impression is it doesn't out of the box nicely support bipartite graphs in the sense that it seems to me, and correct me if this is wrong, we would need. That is, we'd have to merge the eqs and states into one set of (neqs+nstates) vertices by renumbering one of them. (We could use metagraph on top to specify the type of each vertex.) So this wouldn't be directly passable to SSAs. I guess the question is whether we want our own internal representation that mixes vertices labelled 1:neqs that are eqs and vertices labelled 1:nstates that are states, for which it would be easy to create a Lightgraph conversion, or whether the preference is to use Lightgraphs as the default and then convert to SSA format when making a JumpProblem. For the latter, if we number eqs and then states, I think we'd just have to copy the |
Do the bipartite graphs with the special representation that we need. We can always find the right way to convert to LightGraphs for plotting and such later. |
9a60530
to
e87ade5
Compare
How does this look for the API? It works for both states and parameters currently (for jumps). Next I can add eq-eq and state-state graphs, for which I'll use LightGraphs. (The BipartiteGraph I defined is basically their same structure as DiGraph, but splits the two graph component indices instead of merging them.) |
Looks great. We should just keep consistency in our variable extraction utils. |
Need to add |
@ChrisRackauckas Assuming tests pass I think this is done. |
Adding ODEs should be pretty easy I'd think and can be a separate PR. |
SDEs will need a dispatch for |
Actually, there seems to be an issue when testing with RSSA so something is not quite right yet. |
@ChrisRackauckas Tests seem to be failing from a DiffEqJump error? |
yeah I'm looking at it. |
it's all good now |
Still needs: