Skip to content
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

Updated PlasmoPlots to work with v0.6.0+ #6

Merged
merged 3 commits into from
Dec 22, 2024

Conversation

dlcole3
Copy link
Contributor

@dlcole3 dlcole3 commented Dec 14, 2024

PlasmoPlots had not been updated to work with the new release of Plasmo (v0.6). I updated the source code to handle the new version, including upding some of the function calls (e.g., num_all_variables is replaced by num_variables or replaced getnodes with local_nodes). I also updated the label calls (which need to access label.x instead of label since label.x results in BaseRefValue{Symbol} being included in the label) and the call to the clique projection. The tests and Project.toml files have been updated.

I did not update the PlasmoPlots.jl version number in the Project.toml file, which I think should be updated to 0.2.0. @jalving do you normally do that as a separate PR, or should I have included that in this PR?

@dlcole3
Copy link
Contributor Author

dlcole3 commented Dec 14, 2024

I did not see that there was already another PR open (#5) for this same thing. I am going to close this one and instead look at that other one. I see the tests here work, but the tests on #5 are failing, so I will take a look and see if I can figure out why that is. Apologies for duplicating the PR.

@dlcole3 dlcole3 closed this Dec 14, 2024
@jalving
Copy link
Member

jalving commented Dec 15, 2024

@dlcole3 I forgot I had opened the other PR. If your implementation works, we can close the other one in favor of this.
The version number can be updated here or afterwards. It just has to get incremented before we register.

@dlcole3 dlcole3 reopened this Dec 16, 2024
@dlcole3
Copy link
Contributor Author

dlcole3 commented Dec 16, 2024

@dlcole3 I forgot I had opened the other PR. If your implementation works, we can close the other one in favor of this. The version number can be updated here or afterwards. It just has to get incremented before we register.

Sounds good. I copied over the examples and tests from your PR (#5) and followed a couple of the formatting things from your source code. On my local machine, the tests all run, but the overlapping matrix_plot example does not work as I expected. I will try to look into the code more tomorrow. layout_plot works as expected, and matrix_plot seems to work okay for the non-overlapping case, but I have to go deeper in the code to address the overlapping problem I think. I believe the constraints are not tracked properly in the overlapping case because some of the node labels go below the xaxis of the plot. Was this a problem on the old version of PlasmoPlots as well? I see there was not a test for the overlapping case before.


n_all_cons_total = n_cons_total + n_linkcons_total #n_link_edges_total
n_all_cons_total = n_cons_total + n_linkcons_total
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jalving I noticed one difference between #5 and #6 is that #5 uses n_cons_total for n_all_cons_total. This makes sense to me, but when I removed the n_linkcons_total from this line, the resulting spy matrix has node labels that run off the plot, and I don't think the number of constraints on the y axis is being mapped correctly. Consequently, I put the n_linkcons_total back into this equation and the plots look better. I can try to dive into the code mroe to figure out why this is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the issue has to do with inconsistencies with how constraints used to be tracked versus how they are now. There are likely a few kinks to work through here.

@jalving
Copy link
Member

jalving commented Dec 17, 2024

overlapping used to work. i suspect issues have to do with erroneous tracking due to the v0.6 updates.

@dlcole3
Copy link
Contributor Author

dlcole3 commented Dec 17, 2024

overlapping used to work. i suspect issues have to do with erroneous tracking due to the v0.6 updates.

It looks like it was not strictly an issue with the overlapping case. The num_constriants(node) was not using the include_variable_constraints argument, so it was counting more node constraints than were initially being counted for the graph. In addition, plotting the link constraints for the non overlapping case was calling all_link_constraints instead of local_link_constraints. For the overlapping case, it also offset the column by 1 (it started at 1 instead of 0), which does not appear to be consistent with the non-overlapping case, and this resulted in there being one node that was being placed outside the plot. The plots now look about like I expected for the three examples. I did plot the three examples with the old version of Plasmo/PlasmoPlots, and the matrix plots look the same.

@dlcole3
Copy link
Contributor Author

dlcole3 commented Dec 17, 2024

For the overlapping case, it does look like both the old and new (i.e., this PR) versions of PlasmoPlots do not directly overlap the matrix_plot. For instance, the plot from example 3 looks like this

image

which says it has 33 variables listed on the x axis. The graph technically only has 19 variables on it (the additional 14 come from the overlap). Is that the expected behavior from plotting? It seems like there is an alternative visualization where the x-axis only has 19 variables on it. However, the current approach seems okay because it highlights the variables that are "overlapping"

@jalving
Copy link
Member

jalving commented Dec 22, 2024

Is that the expected behavior from plotting? It seems like there is an alternative visualization where the x-axis only has 19 variables on it. However, the current approach seems okay because it highlights the variables that are "overlapping"

Yes, IIRC, I never produced a visual that directly overlaps the matrix plot. I think this version was meant to show the 'size' of the overlapped problems, but a direct representation would also be nice to have.

See issue #7

@jalving
Copy link
Member

jalving commented Dec 22, 2024

The num_constriants(node) was not using the include_variable_constraints argument, so it was counting more node constraints than were initially being counted for the graph

I think Plasmo needs to change the default such that include_variable_constraints is always false. I believe JuMP makes that their default as well.

@jalving jalving merged commit ac46f12 into plasmo-dev:master Dec 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants