日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

图论为什么这么难_图论是什么,为什么要关心?

發(fā)布時(shí)間:2023/12/15 编程问答 58 豆豆
生活随笔 收集整理的這篇文章主要介紹了 图论为什么这么难_图论是什么,为什么要关心? 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

圖論為什么這么難

Graph theory might sound like an intimidating and abstract topic to you, so why should you even spend your time reading an article about it? However, although it might not sound very applicable, there are actually an abundance of useful and important applications of graph theory! In this article, I will try to explain briefly what some of these applications are. In doing so, I will do my best to convince you that having at least some basic knowledge of this topic can be useful in solving some interesting problems you might come across.

圖形理論對(duì)您來說聽起來像是一個(gè)令人生畏的抽象話題,那么為什么還要花時(shí)間閱讀有關(guān)它的文章? 但是,盡管聽起來可能不太適用,但實(shí)際上圖論有很多有用而重要的應(yīng)用! 在本文中,我將嘗試簡要解釋其中的一些應(yīng)用程序。 為此,我將盡力說服您,至少具有該主題的一些基本知識(shí)對(duì)于解決您可能遇到的一些有趣問題很有用。

In this article, I will through a concrete example show how a route planning/optimization task can be formulated and solved using graph theory. More specifically, I will consider a large warehouse consisting of 1000s of different items in various locations/pickup points. The challenge here is, given a list of items, which path should you follow through the warehouse to pickup all items, but at the same time minimize the total distance traveled? For those of you familiar with these kind of problems, this has quite some resemblance to the famous traveling salesman problem. (A well known problem in combinatorial optimization, important in theoretical computer science and operations research).

在本文中,我將通過一個(gè)具體示例展示如何使用圖論來制定和解決路線規(guī)劃/優(yōu)化任務(wù)。 更具體地說,我將考慮一個(gè)大型倉庫,該倉庫由位于不同位置/提貨點(diǎn)的數(shù)千種不同物品組成。 這里的挑戰(zhàn)是,給定一個(gè)物品清單,您應(yīng)該沿著該路徑走入倉庫以拾取所有物品,但同時(shí)要使總行駛距離最小化? 對(duì)于那些熟悉這類問題的人來說,這與著名的旅行推銷員問題非常相似。 ( 組合優(yōu)化中的一個(gè)眾所周知的問題,在理論計(jì)算機(jī)科學(xué)和運(yùn)籌學(xué)中很重要)。

As you might have realized, the goal of this article is not to give a comprehensive introduction to graph theory (which would be quite a tremendous task). Through a real-world example, I will rather try to convince you that knowing at least some basics of graph theory can prove to be very useful!

您可能已經(jīng)意識(shí)到,本文的目的不是全面介紹圖論(這將是一項(xiàng)艱巨的任務(wù))。 通過一個(gè)真實(shí)的例子,我寧愿說服您,至少了解圖論的一些基礎(chǔ)知識(shí)會(huì)證明是非常有用的!

I will start with a brief historical introduction to the field of graph theory, and highlight the importance and the wide range of useful applications in many vastly different fields. Following this more general introduction, I will then shift focus to the warehouse optimization example discussed above.

我將首先對(duì)圖論領(lǐng)域進(jìn)行簡要的歷史介紹,然后重點(diǎn)介紹在許多截然不同的領(lǐng)域中的重要性和廣泛的有用應(yīng)用。 在進(jìn)行了更一般的介紹之后,我將把重點(diǎn)轉(zhuǎn)移到上面討論的倉庫優(yōu)化示例。

圖論的歷史 (The history of Graph Theory)

The basic idea of graphs were first introduced in the 18th century by the Swiss mathematician Leonhard Euler, one of the most eminent mathematicians of the 18th century (and of all time, really). His work on the famous “Seven Bridges of K?nigsberg problem”, are commonly quoted as origin of graph theory.

圖的基本概念是由瑞士數(shù)學(xué)家萊昂哈德·歐拉 ( Leonhard Euler)于18世紀(jì)首次提出的, 萊昂哈德·歐拉 ( Leonhard Euler)是18世紀(jì)最杰出的數(shù)學(xué)家之一(實(shí)際上是有史以來)。 他關(guān)于著名的“ 柯尼斯堡七橋問題 ”的著作通常被認(rèn)為是圖論的起源。

The city of K?nigsberg in Prussia (now Kaliningrad, Russia) was set on both sides of the Pregel River, and included two large islands — Kneiphof and Lomse — which were connected to each other, or to the two mainland portions of the city, by seven bridges (as illustrated in the below figure to the left). The problem was to devise a walk through the city that would cross each of those bridges once and only once.

普魯士的克尼格斯堡市(現(xiàn)為俄羅斯加里寧格勒)位于普雷格爾河的兩側(cè),包括兩個(gè)大島,克奈普霍夫和隆塞,它們相互連接,或者與該市的兩個(gè)大陸部分相連,七個(gè)橋(如下圖左圖所示)。 問題是要設(shè)計(jì)一條穿過城市的步行路線,一次只能穿過一次這些橋梁。

Euler, recognizing that the relevant constraints were the four bodies of land & the seven bridges, drew out the first known visual representation of a modern graph. A modern graph, as seen in bottom-right image, is represented by a set of points, known as vertices or nodes, connected by a set of lines known as edges.

歐拉認(rèn)識(shí)到相關(guān)的約束條件是四塊土地和七座橋梁,因此得出了現(xiàn)代圖形的第一個(gè)已知視覺表示。 一個(gè)現(xiàn)代的曲線圖,如在右下方圖像,是由一組點(diǎn),公知的為v ertices或節(jié)點(diǎn),由一組被稱為邊緣線的連接來表示。

Wikipedia維基百科

This abstraction from a concrete problem concerning a city and bridges etc. to a graph makes the problem tractable mathematically, as this abstract representation includes only the information important for solving the problem. Euler actually proved that this specific problem has no solution. However, the difficulty he faced was the development of a suitable technique of analysis, and of subsequent tests that established this assertion with mathematical rigor. From there, the branch of math known as graph theory lay dormant for decades. In modern times, however, it’s applications are finally exploding.

從有關(guān)城市和橋梁等具體問題的抽象到圖表,使該問題在數(shù)學(xué)上易于處理,因?yàn)檫@種抽象表示僅包含解決問題的重要信息。 歐拉實(shí)際上證明了這個(gè)特定問題沒有解決方案。 但是,他面臨的困難是開發(fā)一種合適的分析技術(shù)以及隨后的測試,這些測試以嚴(yán)格的數(shù)學(xué)方法確立了這一主張。 從那里開始,數(shù)十年來一直處于Hibernate狀態(tài)的稱為圖論的數(shù)學(xué)分支。 然而,在現(xiàn)代,它的應(yīng)用終于爆炸了。

圖論概論 (Introduction to Graph Theory)

As mentioned previously, I do not aim to give a comprehensive introduction to graph theory. The following section still contains some of the basics when it comes to different kind of graphs etc., which is of relevance to the example we will discuss later on path optimization.

如前所述,我并不打算對(duì)圖論進(jìn)行全面介紹。 以下部分仍包含有關(guān)不同種類的圖等的一些基礎(chǔ)知識(shí),這與我們稍后將討論路徑優(yōu)化的示例相關(guān)。

Graph Theory is ultimately the study of relationships. Given a set of nodes & connections, which can abstract anything from city layouts to computer data, graph theory provides a helpful tool to quantify & simplify the many moving parts of dynamic systems. Studying graphs through a framework provides answers to many arrangement, networking, optimization, matching and operational problems.

圖論最終是對(duì)關(guān)系的研究。 給定一組節(jié)點(diǎn)和連接,可以抽象化從城市布局到計(jì)算機(jī)數(shù)據(jù)的所有內(nèi)容,圖論提供了一個(gè)有用的工具,可以量化和簡化動(dòng)態(tài)系統(tǒng)的許多移動(dòng)部分。 通過框架研究圖形可為許多布置,網(wǎng)絡(luò),優(yōu)化,匹配和操作問題提供答案。

Graphs can be used to model many types of relations and processes in physical, biological, social and information systems, and has a wide range of useful applications such as e.g.

圖形可用于對(duì)物理,生物,社會(huì)和信息系統(tǒng)中的許多類型的關(guān)系和過程進(jìn)行建模,并且具有廣泛的有用應(yīng)用,例如

  • Finding communities in networks, such as social media (friend/connection recommendations), or in the recent days for possible spread of COVID19 in the community through contacts.

    在社交媒體等網(wǎng)絡(luò)中查找社區(qū)(朋友/關(guān)系推薦),或者在最近幾天內(nèi)通過聯(lián)系在社區(qū)中傳播COVID19。
  • Ranking/ordering hyperlinks in search engines.

    在搜索引擎中對(duì)超鏈接進(jìn)行排名/排序。
  • GPS/Google maps to find the shortest path home.

    GPS / Google地圖可找到最短路徑。
  • Study of molecules and atoms in chemistry.

    研究化學(xué)中的分子和原子。
  • DNA sequencing

    DNA測序
  • Computer network security

    計(jì)算機(jī)網(wǎng)絡(luò)安全
  • ….. and many more….

    ….. 還有很多…。
  • A simple example of a graph with 6 nodes具有6個(gè)節(jié)點(diǎn)的圖的簡單示例 WikimediaWikimedia

    As mentioned, there are several types of graphs that describe different kind of problems (and the constraints within them). A nice walk-through of various types of graphs can also be found in a previous article by Kelvin Jose, and the below section represents a subset of that article.

    如前所述,有幾種類型的圖描述了不同類型的問題(以及其中的約束)。 凱爾文·何塞 ( Kelvin Jose)的上一篇文章中也可以找到各種圖形的很好的演練,下面的部分代表該文章的子集。

    圖的類型 (Types of Graphs)

    There are different types of graph representations available and we have to make sure that we understand the kind of graph we are working with when programmatically solving a problem which includes graphs.

    有不同類型的圖表示形式,當(dāng)以編程方式解決包括圖的問題時(shí),我們必須確保我們了解要使用的圖的類型。

    • Undirected Graphs

      無向圖

    As the name shows, there won’t be any specified directions between nodes. So an edge from node A to B would be identical to the edge from B to A.

    顧名思義,節(jié)點(diǎn)之間不會(huì)有任何指定的方向。 因此,從節(jié)點(diǎn)A到B 的邊緣 將 從B到A的邊緣 相同

    In the above graph, each node could represent different cities and the edges show the bidirectional roads.

    在上圖中,每個(gè)節(jié)點(diǎn)可以代表不同的城市,邊緣顯示雙向道路。

    • Directed Graphs (DiGraphs)

      有向圖(DiGraphs)

    Unlike undirected graphs, directed graphs have orientation or direction among different nodes. That means if you have an edge from node A to B, you can move only from A to B.

    與無向圖不同,有向圖 在不同節(jié)點(diǎn)之間 具有方向或 方向 。 這意味著,如果從節(jié)點(diǎn)A到B有一條邊,則只能從A移到B。

    WIkiMediaWIkiMedia

    Like the previous example, if we consider nodes as cities, we have a direction from city 1 to 2. That means, you can drive from city 1 to 2 but not back to city 1, because there is no direction back to city 1 from 2. But if we closely examine the graph, we can see cities with bi-direction. For example cities 3 and 4 have directions to both sides.

    像前面的示例一樣,如果我們將節(jié)點(diǎn)視為城市,則我們有一個(gè)從城市1到2的方向。這意味著,您可以從城市1到2行駛,但不能返回城市1,因?yàn)闆]有從該方向返回城市1的方向。 2.但是,如果我們仔細(xì)檢查圖表,我們會(huì)看到雙向的城市。 例如,城市3和4向兩側(cè)都有方向。

    • Weighted Graphs

      加權(quán)圖

    Many graphs can have edges containing a weight associated to represent a real world implication such as cost, distance, quantity etc …

    許多圖的邊緣可能包含權(quán)重,以表示真實(shí)世界的含義,例如成本,距離,數(shù)量等。

    Credit: Estefania Cassingena Navone viafreecodecamp.org 圖片來源 : Estefania Cassingena Navone通過freecodecamp.org

    Weighted graphs could be either directed or undirected graph. The one we have in this example is an undirected weighted graph. The cost (or distance) from the green to the orange node (and vice versa) is 3. Like our previous example, if you want to travel between two cities, say city green and orange, we would have to drive 3 miles. These metrics are self-defined and could be changed according to the situations. For a more elaborated example, consider you have to travel to city pink from green. If you look at the city graph, we can’t find any direct roads or edges between the two cities. So what we can do is to travel via another city. The most promising routes would be starting from green to pink via orange and blue. If the weights are costs between cities, we would have to spend 11$ to travel via blue to reach pink but if we take the other route via orange, we would only have to pay 10$ for the trip.

    加權(quán)圖 可以是有向圖或無向圖。 在此示例中,我們得到的是無向加權(quán)圖。 從綠色節(jié)點(diǎn)到橙色節(jié)點(diǎn)(反之亦然)的成本(或距離)為3。像我們前面的示例一樣,如果您要在兩個(gè)城市之間旅行,例如綠色和橙色,則必須行駛3英里。 這些指標(biāo)是自定義的,可以根據(jù)情況進(jìn)行更改。 對(duì)于更詳細(xì)的示例,請(qǐng)考慮您必須從綠色到粉紅色的城市。 如果您查看城市圖,我們?cè)趦蓚€(gè)城市之間找不到任何直接的道路或邊緣。 因此,我們可以做的是穿越另一個(gè)城市。 最有希望的路線將是從綠色到粉紅色,再到橙色和藍(lán)色。 如果權(quán)重是城市之間的成本,那么我們將不得不花費(fèi)11美元通過藍(lán)色旅行到達(dá)粉紅色,但是如果我們通過橙色乘坐另一條路線,那么我們只需為這次旅行支付10美元。

    There may be several weights associated with each edge, including distance, travel time, or monetary cost. Such weighted graphs are commonly used to program GPS’s, and travel-planning search engines that compare flight times and costs.

    每個(gè)邊緣可能有多個(gè)權(quán)重,包括距離,行駛時(shí)間或金錢成本。 這樣的加權(quán)圖通常用于對(duì)GPS進(jìn)行編程,并比較旅行時(shí)間和費(fèi)用的旅行計(jì)劃搜索引擎。

    圖論→路線優(yōu)化 (Graph Theory → Route optimization)

    Having (hopefully) convinced you that graph theory is worth knowing something about, it is now time to focus on our example case of route planning when picking items in our warehouse.

    (希望)使您相信圖論值得一讀,現(xiàn)在是時(shí)候在我們的倉庫中揀選項(xiàng)目時(shí)關(guān)注路線規(guī)劃的示例案例。

    挑戰(zhàn): (Challenge:)

    The challenge here is that given a “picking list” as input, we should find the shortest route that passes all the pickup points, but also complies to the restrictions with regard to where it is possible/allowed to drive. The assumptions and constraints here are that crossing between corridors in the warehouse is only allowed at marked “turning points”. Also, the direction of travel must follow the specified legal driving direction for each corridor.

    這里的挑戰(zhàn)是,在輸入“揀選清單”的情況下,我們應(yīng)該找到經(jīng)過所有揀選點(diǎn)的最短路線,而且還要遵守關(guān)于可能/允許行駛的地點(diǎn)的限制。 這里的假設(shè)和約束條件是,僅允許在標(biāo)記的“轉(zhuǎn)折點(diǎn)”處穿越倉庫的走廊。 另外,每個(gè)走廊的行駛方向必須遵循指定的合法行駛方向。

    解: (Solution:)

    This problem can be formulated as an optimization problem in graph theory. All pickup points in the warehouse form a “node” in the graph, where the edges represent permitted lanes/corridors and distances between the nodes. To introduce the problem more formally, let us start from a simplified example.

    這個(gè)問題可以用圖論的形式表達(dá)為優(yōu)化問題。 倉庫中的所有取貨點(diǎn)都在圖中形成一個(gè)“節(jié)點(diǎn)”,其邊緣表示允許的車道/走廊以及節(jié)點(diǎn)之間的距離。 為了更正式地介紹這個(gè)問題,讓我們從一個(gè)簡化的例子開始。

    The graph below represents 2 corridors with 5 shelves/pickup-points per corridor. All shelves are here represented as a node in the graph, with an address ranging from 1–10. The arrows indicate the permitted driving direction, where the double arrows indicate that you can drive either way. Simple enough, right?

    下圖顯示了2條走廊,每個(gè)走廊有5個(gè)擱板/拾取點(diǎn)。 在此,所有架子都表示為圖中的節(jié)點(diǎn),地址范圍為1-10。 箭頭指示允許的行駛方向,雙箭頭指示您可以兩種方式行駛。 很簡單,對(duì)不對(duì)?

    Being able to represent the permitted driving routes in the form of a graph, means that we can use mathematical techniques known from graph theory to find the optimal “driving route” between the nodes (i.e., the stock shelves in our warehouse).

    能夠以圖形的形式表示允許的行駛路線,這意味著我們可以使用圖形理論中已知的數(shù)學(xué)技術(shù)來找到節(jié)點(diǎn)(即,我們倉庫中的貨架)之間的最佳“行駛路線”。

    The example graph above can be described mathematically through an ?adjacency matrix?. The adjacency matrix to the right in the below figure is thus a representation of our ?warehouse graph?, which indicates all permitted driving routes between the various nodes.

    上面的示例圖可以通過《 鄰接矩陣 》進(jìn)行數(shù)學(xué)描述。 因此,下圖右側(cè)的鄰接矩陣是我們“倉庫圖”的表示,該圖表示各個(gè)節(jié)點(diǎn)之間所有允許的行駛路線。

    • Example 1: You are allowed to travel from node 2 → 3, but not from 3 → 2. This is indicated by the “1” in the adjacency matrix to the right.

      示例1:允許您從節(jié)點(diǎn)2→3出發(fā),但不能從3→2出發(fā)。這由右側(cè)鄰接矩陣中的“ 1”指示。

    • Example 2: You are allowed to go from both node 8 → 3, and from 3 → 8, again indicated by the “1”`s in the adjacency matrix (which in this case is symmetric when it comes to travel direction).

      示例2:允許您從節(jié)點(diǎn)8→3和3→8出發(fā),再次由鄰接矩陣中的“ 1”表示(在這種情況下,關(guān)于行駛方向是對(duì)稱的)。

    回到我們的倉庫問題: (Back to our warehouse problem:)

    A real warehouse is of course bigger and more complex than the above example. However, the main principles of how to represent the problem through a graph remains the same. To make the real problem slightly simpler (and more visually suitable for this article), I have reduced the total number of shelves/pickup-points (approximately every 50th shelf included, marked with black squares in the below figure). All pickup points are given an address (“node number”) from 1–74. The other relevant constraints mentioned earlier, such as permitted driving directions in each of the corridors, as well as the allowed “turning points” and shortcuts between the corridors are also indicated in the figure..

    實(shí)際的倉庫當(dāng)然比上面的示例更大,更復(fù)雜。 但是,如何通過圖形表示問題的主要原理保持不變。 為了使實(shí)際問題更簡單(并且更直觀地適合本文),我減少了架子/拾取點(diǎn)的總數(shù)(大約每50個(gè)架子中有一個(gè),在下圖中用黑色正方形標(biāo)記)。 將為所有拾取點(diǎn)分配一個(gè)1到74之間的地址(“節(jié)點(diǎn)號(hào)”)。 圖中還標(biāo)出了前面提到的其他相關(guān)約束,例如每個(gè)走廊中的允許行駛方向以及走廊之間的允許“轉(zhuǎn)彎點(diǎn)”和捷徑。

    Graph representation of our simplified warehouse我們簡化倉庫的圖形表示

    The next step is then to represent this graph in the form of a adjacency matrix. Since we are here interested in finding both the optimal route and total distance, we must also include the driving distance between the various nodes in the matrix.

    然后,下一步就是以鄰接矩陣的形式表示該圖。 由于我們對(duì)尋找最佳路線和總距離感興趣,因此我們還必須在矩陣中包括各個(gè)節(jié)點(diǎn)之間的行駛距離。

    Adjacency matrix for the “warehouse graph”“倉庫圖”的鄰接矩陣

    This matrix indicates all constraints with regard to both the permitted direction of travel, which “shortcuts” are permitted, any other restrictions as well as the driving distance between the nodes (illustrated through the color). As an example, the “shortcut” between nodes 21 and 41 shown in the graph representation can clearly be identified also in the adjacency matrix. The “white areas” of the matrix represents the paths that are not allowed, indicated through an “infinite” distance between those nodes.

    該矩陣指示關(guān)于允許的行進(jìn)方向(允許使用“快捷方式”),所有其他限制以及節(jié)點(diǎn)之間的行駛距離(通過顏色顯示)的所有限制。 作為示例,在圖形表示中所示的節(jié)點(diǎn)21和41之間的“快捷方式”也可以在鄰接矩陣中清楚地識(shí)別。 矩陣的“白色區(qū)域”表示不允許的路徑,通過這些節(jié)點(diǎn)之間的“無限”距離表示。

    從圖表示到路徑優(yōu)化 (From graph representation to path optimization)

    Just having an abstracted representation of our warehouse in the form of a graph, does of course not solve our actual problem. The idea is rather that through this graph representation, we can now use the mathematical framework and algorithms from graph theory to solve it!

    僅僅以圖表的形式對(duì)我們的倉庫進(jìn)行抽象表示,當(dāng)然并不能解決我們的實(shí)際問題。 想法是通過這種圖形表示,我們現(xiàn)在可以使用圖形理論中的數(shù)學(xué)框架和算法來解決它!

    Since graph optimization is a well-known field in mathematics, there are several methods and algorithms that can solve this type of problem. In this example case, I have based the solution on the “Floyd-Warshall algorithm”, which is a well known algorithm for finding shortest paths in a weighted graph. A single execution of the algorithm will find the lengths (summed weights) of shortest paths between all pairs of nodes. Although it does not return details of the paths themselves, it is possible to reconstruct the paths with simple modifications to the algorithm.

    由于圖優(yōu)化是數(shù)學(xué)領(lǐng)域的眾所周知的領(lǐng)域,因此有幾種方法和算法可以解決此類問題。 在此示例情況下,我基于“ Floyd-Warshall算法 ”解決方案,這是一種用于在加權(quán)圖中找到最短路徑的眾所周知的算法 。 算法的一次執(zhí)行將找到所有節(jié)點(diǎn)對(duì)之間最短路徑的長度(總權(quán)重)。 盡管它不返回路徑本身的詳細(xì)信息,但可以通過對(duì)算法的簡單修改來重建路徑。

    If you give this algorithm as input a “picking order list” where you go through a list of items you want to pick, you should then be able to obtain the optimal route which minimize the total driving distance to collect all items on the list.

    如果您將此算法作為輸入輸入“領(lǐng)料單列表”,然后在該列表中瀏覽要領(lǐng)料的物品列表,則應(yīng)該能夠獲得最佳路線,該路線將使總行駛距離最小化以收集清單上的所有物品。

    Example: Let us start by visualizing the results for a (short) picking list as follows: Start from node ?0?, pick up items at location/node 15, 45, 58 and 73 (where these locations are illustrated in the figure below). The algorithm finds the shortest allowable route between these points through calculating the “distance matrix”, D, which can then be used to determine the total driving distance between all locations/nodes in the picking list.

    示例:讓我們首先以可視化方式顯示一個(gè)(簡短的)揀貨清單,如下所示:從節(jié)點(diǎn)?0?開始,在位置/節(jié)點(diǎn)15、45、58和73處揀貨(這些位置如下圖所示) )。 該算法通過計(jì)算“距離矩陣” D找到這些點(diǎn)之間的最短允許路線,然后將其用于確定領(lǐng)料單中所有位置/節(jié)點(diǎn)之間的總行駛距離。

    • Step 1: D[0][15] → 90 m

      步驟1: D [0] [15]→90 m

    • Step 2: D[15][45] →52 m

      步驟2: D [15] [45]→52 m

    • Step 3: D[45][58] → 34 m

      步驟3: D [45] [58]→34 m

    • Step 4: D[58][73] → 92 m

      步驟4: D [58] [73]→92 m

    Total distance = 268m

    總距離= 268m

    Optimized driving route from picking list從揀貨清單優(yōu)化駕駛路線

    Have tested several “picking lists” as input and verifying the proposed driving routes and calculated distance, the algorithm has been able to find the optimal route in all cases. The algorithm respects all the imposed constraints, such as the permitted direction of travel, and uses all permitted “shortcuts” to minimize the total distance.

    測試了多個(gè)“揀選清單”作為輸入,并驗(yàn)證了建議的行駛路線和計(jì)算出的距離,該算法已能夠在所有情況下找到最佳路線。 該算法遵守所有強(qiáng)加的約束條件,例如允許的行進(jìn)方向,并使用所有允許的“快捷方式”來最小化總距離。

    從路徑優(yōu)化到有用的見解 (From path optimization to useful insights)

    As shown through the above example, we have developed an optimization algorithm that calculates the optimal driving route via all points on a picking order list (for a simplified version of the warehouse). By providing a list of picking orders as input, one can thus relatively easily calculate statistics on typical mileage per. picking order. These statistics can then also be filtered on various information such as item type, customer, date, etc. In the following section, I have thus picked a few examples on how one can extract interesting statistics from such a path optimization tool.

    如上面的示例所示,我們開發(fā)了一種優(yōu)化算法,該算法可通過揀貨訂單列表上的所有點(diǎn)(針對(duì)倉庫的簡化版本)計(jì)算最佳行駛路線。 通過提供一列提貨單作為輸入,因此可以相對(duì)輕松地計(jì)算出每人平均行駛里程的統(tǒng)計(jì)數(shù)據(jù)。 領(lǐng)料單。 然后,還可以根據(jù)各種信息(例如項(xiàng)目類型,客戶,日期等)過濾這些統(tǒng)計(jì)信息。因此,在以下部分中,我選擇了一些示例,說明如何從這種路徑優(yōu)化工具中提取有趣的統(tǒng)計(jì)信息。

    In doing this, I first generated 10.000 picking order lists where the number of items per list ranges from 1–30 items, located at random pickup points in the warehouse (address 3–74 in the figure above). By performing the path optimization procedure over all these picking list, we can then extract some interesting statistics.

    為此,我首先生成了10.000個(gè)揀貨訂單清單,其中每個(gè)清單的物品數(shù)量在1至30件之間,位于倉庫中的隨機(jī)取貨點(diǎn)(上圖中的地址3–74)。 通過對(duì)所有這些選擇列表執(zhí)行路徑優(yōu)化過程,我們可以提取一些有趣的統(tǒng)計(jì)信息。

    Example 1: Calculate mileage as a function of the number of units per. picking order list. Here, you would naturally assume that the total mileage increases the more items you have to pick. But, at some level, this will start to flatten out. This is due to the fact that one eventually has to stop by all the corridors in the warehouse to pick up goods, which then prevents us from making use of clever “shortcuts” to minimize the total driving distance. This tendency can be illustrated in the figure below to the left, which illustrates that for more than approximately 15–20 units per picking order, adding extra items does not make the total mileage much longer (as you have to drive through all corridors of the warehouse anyway). Note that the figures show a “density plot” of the distribution of typical mileage per. picking orders list

    示例1:根據(jù)每單位數(shù)量計(jì)算里程。 領(lǐng)料單清單。 在這里,您自然會(huì)假設(shè)總里程數(shù)增加了您必須選擇的項(xiàng)目。 但是,在某種程度上,這將開始趨于平緩。 這是由于這樣一個(gè)事實(shí),即最終必須在倉庫的所有走廊停下來取貨,這又使我們無法利用巧妙的“捷徑”來最小化總行駛距離。 這種趨勢(shì)可以在左下圖中說明,該圖說明,對(duì)于每個(gè)揀配訂單,大約15-20個(gè)單位以上,添加額外的物品并不會(huì)使總行駛里程更長(因?yàn)槟仨氶_車穿過貨車的所有走廊)倉庫)。 注意,這些圖顯示了每英里典型行駛里程分布的“密度圖”。 領(lǐng)料單清單

    Another interesting statistic, which shows the same trend, is the distribution of driving distance per picked item in the figure to the right. Here, we see that for picking lists with few items, the typical mileage per. item is relatively high (with a large variance, depending on how “l(fā)ucky” we are with some items being located in the same corridor etc.). For picking lists with several items though, the mileage per. item is gradually decreasing. This type of statistic can thus be interesting to investigate closer, in order to optimize how many items each picking order list should contain in order to minimize the mileage per picked item.

    另一個(gè)有趣的統(tǒng)計(jì)數(shù)字,顯示了相同的趨勢(shì),是右圖中每個(gè)被拾取項(xiàng)目的行駛距離分布。 在這里,我們看到,對(duì)于揀選清單少的物品,每英里的典型行駛里程。 物品相對(duì)較高(差異很大,取決于一些物品位于同一走廊等情況下的“幸運(yùn)”程度)。 對(duì)于帶有多個(gè)項(xiàng)目的揀貨清單,每英里的里程數(shù)。 項(xiàng)目正在逐漸減少。 因此,為了進(jìn)一步優(yōu)化每個(gè)揀貨訂單列表應(yīng)包含的物品數(shù)量,以使每個(gè)揀選物品的里程數(shù)最小化,這種統(tǒng)計(jì)數(shù)據(jù)可能會(huì)更有趣地進(jìn)行深入研究。

    Estimating driving distance per list/item vs. number of items per list.估算每個(gè)列表/項(xiàng)目的行駛距離與每個(gè)列表的項(xiàng)目數(shù)。

    Example 2: Here I have used real-world data that also contains additional information in the form of a customer ID (here shown for only two customers). We can then take a closer look at the distribution in mileage per. picking order list for the two customers. For example, do you typically have to drive longer distances to pick the goods of one customer versus another? And, should you charge that customer extra for this additional cost?

    示例2:在這里,我使用了真實(shí)數(shù)據(jù),其中還包含客戶ID形式的附加信息(此處僅針對(duì)兩個(gè)客戶顯示)。 然后,我們可以仔細(xì)查看每公里里程的分布。 挑選兩個(gè)客戶的訂單清單。 例如,您通常需要開車較長距離來挑選一位客戶與另一位客戶的商品嗎? 而且,您是否應(yīng)該向該客戶額外收取這筆額外費(fèi)用?

    The below figure to the left shows the distribution in mileage for ?Customer 1? and ?Customer 2? respectively. One of the things we can interpret from this is that for customer 2, most picking order lists have a noticeably shorter driving distance compared to customer 1. This can also be shown by calculating the average mileage per. picking order list for the two customers (figure to the right).

    左下圖分別顯示了“客戶1”和“客戶2”的里程分布。 我們可以從中得出的解釋之一是,對(duì)于客戶2,大多數(shù)揀貨訂單列表的行駛距離比客戶1短得多。這也可以通過計(jì)算每人的平均里程來顯示。 兩個(gè)客戶的揀貨訂單清單(右圖)。

    This type of information can e.g. be used to implement pricing models where the product price to the customer is also based on mileage per order. For customers where the order involves more driving (and thus also more time and higher cost) you can consider invoicing extra compared to orders that involve short driving distances.

    此類信息可以例如用于實(shí)施定價(jià)模型,其中對(duì)客戶的產(chǎn)品價(jià)格也基于每個(gè)訂單的里程。 對(duì)于訂單涉及更多駕駛(因此也需要更多時(shí)間和更高成本)的客戶,您可以考慮比涉及短途駕駛距離的訂單多開票。

    摘要: (Summary:)

    In the end, I hope I have convinced you that graph theory is not just some abstract mathematical concept, but that it actually has many useful and interesting applications! Hopefully, the examples above will be useful for some of you in solving similar problems later, or at least satisfy some of your curiosity when it comes to graph theory and some of its applications.

    最后,我希望我已經(jīng)說服了您,圖論不僅是一些抽象的數(shù)學(xué)概念,而且它實(shí)際上具有許多有用且有趣的應(yīng)用程序! 希望上面的示例對(duì)某些人在以后解決類似問題時(shí)很有用,或者至少滿足您對(duì)圖論及其某些應(yīng)用的好奇。

    The cases discussed in the article covers just a few examples that illustrate some of the possibilities that exist. If you have previous experience and ideas on the topic, it would be interesting to hear your thoughts in the comments below!

    本文討論的案例僅涵蓋了一些示例,這些示例說明了存在的一些可能性。 如果您以前有關(guān)于該主題的經(jīng)驗(yàn)和想法,那么在下面的評(píng)論中聽聽您的想法會(huì)很有趣!

    Did you find the article interesting? If so, you might also like some of my other articles on topics such as AI, Machine Learning, physics, etc., which you can find here: https://medium.com/@vflovik

    您覺得這篇文章有趣嗎? 如果是這樣,您可能還會(huì)喜歡我的其他一些有關(guān)AI,機(jī)器學(xué)習(xí),物理等主題的文章,您可以在這里找到: https : //medium.com/@vflovik

    翻譯自: https://towardsdatascience.com/what-is-graph-theory-and-why-should-you-care-28d6a715a5c2

    圖論為什么這么難

    總結(jié)

    以上是生活随笔為你收集整理的图论为什么这么难_图论是什么,为什么要关心?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。