Optimal routing for building feeders in the form of a radial network

5 ビュー (過去 30 日間)
SNM Nima 2022 年 12 月 22 日

Hi,
I want to write a code in MATLAB to determine the optimal route for the construction of feeders in the radial network. I don't have an algorithm to start my work and write it. Can anyone guide me to write it?
For example, I want to show the bottom right figure in the output!

サインインしてコメントする。

回答 (1 件)

John D'Errico 2023 年 1 月 23 日

You probably need to use tools from graph theory. And there are a nice set of such tools in MATLAB.
help graph
help minspantree
--- help for graph/minspantree --- MINSPANTREE Minimum spanning tree of a graph [T, PRED] = minspantree(G) returns the minimum spanning tree T of graph G, and the vector PRED of predecessors: PRED(I) is the node index of the predecessor of node I. [T, PRED] = minspantree(G, 'Method', METHODNAME) specifies the method used to compute the minimum spanning tree: 'dense' starts at node rootVertex and adds edges to the tree while traversing the graph. This is the default. 'sparse' Sorts all edges by weight, and adds them to the tree if they don't cause any cycles. [T, PRED] = minspantree(G, 'Root', rootVertex) specifies the root vertex. If 'Method' is 'dense', this is the starting vertex; if 'Method' is 'sparse', the root vertex is only used to compute the PRED vector. Default: rootVertex is Node 1 [T, PRED] = minspantree(G, 'Type', TYPE) specifies what is done if G is not connected: 'tree' only one tree is returned, which contains rootVertex. This is the default. 'forest' a forest of minimum spanning trees is returned. Example: % Create and plot a graph. Compute and highlight its minimum % spanning tree. s = [1 1 1 2 5 3 6 4 7 8 8 8]; t = [2 3 4 5 3 6 4 7 2 6 7 5]; weights = [100 10 10 10 10 20 10 30 50 10 70 10]; G = graph(s,t,weights); G.Edges p = plot(G,'EdgeLabel',G.Edges.Weight); tree = minspantree(G); tree.Edges highlight(p,tree) See also GRAPH, SHORTESTPATH, CONNCOMP Documentation for graph/minspantree doc graph/minspantree Other uses of minspantree digraph/minspantree
For example,
xy = randn(20,2);
Dxy = squareform(pdist(xy));
Gxy = graph(Dxy);
tree = minspantree(Gxy);
plot(tree)
The above tree was built purely based on the interpoint distances between nodes.
In the end though, no, you don't want to write the code yourself. Learn to find and use the tools in MATLAB. Here all you needed to know is how to use the tools for working with graphs.

サインインしてコメントする。

カテゴリ

Find more on Traveling Salesman (TSP) in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by