Add tree-decomposition-based partitioning.#149
Conversation
|
@samuelsonric apologies for the delay. Thank you for opening the PR. This looks very interesting. I am looping in @jalving here. I am going to be unavailable until the end of April, but I will review it within the week I get back if @jalving does not get to it first. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new clique-tree (tree-decomposition) based partitioning workflow to transform an OptiGraph into a forest of subgraphs, intended for downstream decomposition algorithms (e.g., PlasmoBenders.jl).
Changes:
- Adds
apply_clique_tree!and supporting logic (CliqueTrees.jl integration) to build clique-tree bags and rewrite/link constraints across bags. - Exposes the new API from the main module and wires it into the build via
include. - Adds CliqueTrees.jl as a dependency and bumps the minimum supported Julia version to 1.10 (plus updates the docs workflow Julia version).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/Plasmo.jl |
Exports apply_clique_tree! and includes the new clique-tree implementation file. |
src/graph_functions/cliquetree.jl |
Implements clique-tree construction and an in-place graph transformation into bag subgraphs with separator-linking constraints. |
Project.toml |
Adds CliqueTrees dependency/compat and raises julia compat to 1.10. |
.github/workflows/Documentation.yml |
Updates docs build to use Julia 1.10. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| optinodes = all_nodes(graph)[perm] | ||
| optiedges = all_edges(graph) | ||
|
|
||
| empty!(graph.optinodes) | ||
| empty!(graph.optiedges) | ||
|
|
| for (e, j) in enumerate(edge_to_bag) | ||
| for con in JuMP.all_constraints(optiedges[e]) | ||
| con_obj = JuMP.constraint_object(con) | ||
| _add_substituted_constraint!(con_obj, bag_to_graph[j], bag_to_var_map[j]) | ||
| end |
There was a problem hiding this comment.
If the clique decomposition truly requires scalar constraints, I would suggest doing the check early on for whether any edges have nonlinear constraints. I think there is even a Plasmo method to do this.
There was a problem hiding this comment.
The clique decomposition does not require scalar constraints.
| """ | ||
| apply_clique_tree!(graph::OptiGraph; kw...) | ||
|
|
||
| Transform an opti-graph into a tree of subgraphs. | ||
| """ | ||
| function apply_clique_tree!(graph::OptiGraph; kw...) | ||
| perm, tree, edge_to_bag = opti_clique_tree(graph; kw...) | ||
| return apply_clique_tree!(graph, perm, tree, edge_to_bag) | ||
| end |
There was a problem hiding this comment.
At least one good unit test would great!
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hey @samuelsonric, sorry this took so long to address. Thank you for your contribution! I am wondering if it is actually possible to generate a My one request is to try adding CliqueTrees.jl to the init function the same way KaHyPar is handled. This avoids requiring it as a dependency for Plasmo.jl. |
|
Hello @jalving @dlcole3 I will address these comments today. Here is a visual description of what this code is doing in the given example. Starting with an OptiGraph shaped like the Petersen graph...
...we form a supergraph by adding extra vertices (red). We then partition the vertices of this supergraph, forming a tree of subgraphs.
|
|
@jalving There is a rough correspondence between tree decompositions and hierarchical edge-cuts (your
A tree decomposition of The code in this PR computes a tree decomposition of I chose the former because it produces OptiGraphs more amenable to Bender's decomposition. |
|
I seem to have made some assumptions. You do have the ability to partition |
I had updated the Project.toml to use CliqueTrees.jl as a dependency, but I think we should remove it then and just have it in the init section. |


This PR adds adds a partitioning feature using CliqueTrees.jl. The fuction
apply_clique_tree!transforms an opti-graph into a forest of disjoint subgraphs, which can be used by PlasmoBenders.jl.Example
We can solve this naively...
... or using nested Benders.