退火算法 貪婪算法_算法貪婪策略簡介

退火算法 貪婪算法

介紹 (Introduction)

The solution is determined by a sequence of steps each step has given a particular solution and later a complete solution to given the problem can be achieved. In short, while making a choice there should be a greed for the optimum solution. Some points about Greedy strategy:

該解決方案由一系列步驟確定,每個步驟都給出了特定的解決方案,隨后可以實現針對給定問題的完整解決方案。 簡而言之,在做出選擇時,應該有一個貪婪的最佳解決方案。 有關貪婪策略的一些要點

  • Look for the optimal solution and assumes it as best.

    尋找最佳解決方案,并假定它是最佳解決方案。

  • Solves the sub-problems in Top-down manner.

    以自上而下的方式解決子問題。

  • This approach is less powerful programming techniques.

    這種方法是功能較弱的編程技術。

  • It is not applicable to a wider area like dynamic programming approach.

    它不適用于動態編程方法等更廣泛的領域。

  • It is useful for solving optimization problems.

    這對于解決優化問題很有用。

  • It generates only one solution sequences.

    它僅生成一個解決方案序列。

In greedy Strategy following activities are performed,

在貪婪策略中,執行以下活動,

  1. First, select some solutions from input domain.

    首先,從輸入域中選擇一些解決方案。

  2. Then check whether the solution is feasible or not.

    然后檢查該解決方案是否可行。

  3. In this, we find an optimum solution which satisfies the objective of the function and it can be obtained from a particular solution out of the set of feasible solution.

    在此,我們找到了一個滿足函數目標的最優解,并且可以從可行解集中的特定解中獲得。

  4. As greedy method works in stages only one stage is considered at a time. Based on this input it is decided whether a particular input is given the optimal solution or not.

    由于貪婪方法分階段進行,因此一次只考慮一個階段。 基于此輸入,確定是否為特定輸入提供了最佳解決方案。

貪婪策略算法 (Algorithm for Greedy Strategy)

In greedy approach D is domain, from which solution is to be obtained of size n...

在貪婪方法中, D是域,將從中獲得大小為n的解 。

    Initially assume
Solution  ← 0
For i ← 1 to n do
{
S ← select(D) // section of solution from D
If (Feasible (solution) then
Solution ← Union (solution, s);
}
Return solution

貪婪策略的要素 (Elements of Greedy Strategy)

Greedy Choice property

貪婪選擇酒店

  • A global optimal solution can be arrived by local optimal choice.

    全局最優解可以通過局部最優選擇來獲得。

  • For finding the solutions to the problem the subproblems are solved and best from these sub-problems is considered.

    為了找到問題的解決方案,解決了子問題,并考慮了這些子問題中的最佳問題。

  • This choice may depend upon the previously made choices but it does not depend on any future choice.

    該選擇可能取決于先前做出的選擇,但并不取決于任何將來的選擇。

  • Thus in the greedy method, greedy choices are made one after the another, reducing each given problem instances to smaller one.

    因此,在貪婪方法中,貪婪的選擇是一個接一個地做出的,從而將每個給定的問題實例減少為較小的一個。

Optimal sub-structure

最佳子結構

  • If an optimal solution to the problem containing the optimal solution to the subproblem then the problem shows an optimal substructure.

    如果問題的最優解包含子問題的最優解,那么問題將顯示最優子結構。

  • A problem has optimal substructure if has been next choices always leads to an optimal solution.

    如果問題一直存在,則問題具有最佳的子結構,這通常會導致最佳解決方案。

貪心法的應用 (Applications of greedy method)

Problems that can be solved by greedy approach,

貪婪方法可以解決的問題,

  1. Knapsack problem

    背包問題

  2. Prim’s algorithm for minimum spanning tree.

    Prim的最小生成樹算法。

  3. Kruskal’s algorithm for minimum spanning tree.

    最小生成樹的Kruskal算法。

  4. Finding shortest job

    尋找最短的工作

  5. Job sequencing with deadlines

    有期限的工作排序

  6. Optimal storage on taps

    水龍頭的最佳存儲

  7. Huffman coding

    霍夫曼編碼

Feasible solution

可行的解決方案

The set of values for the decision problem which satisfies all of the constraints of an optimization problem then the solution is called feasible solution. Feasible solution satisfy all linear and non-linear constraints. The set of all feasible solution defines the feasible region of the problem. To solve a problem first find anyone feasible solution and then try to find another feasible solution which satisfies the values of the objective functions. The whole process is repeated until when no further improvement is achieved or other criteria are met.

滿足優化問題所有約束的決策問題的值集,然后將該解決方案稱為可行解。 可行的解決方案滿足所有線性和非線性約束。 所有可行解的集合定義了問題的可行區域。 為了解決問題,首先找到任何可行的解決方案,然后嘗試找到另一種滿足目標函數值的可行解決方案。 重復整個過程,直到沒有進一步的改善或滿足其他標準為止。

翻譯自: https://www.includehelp.com/algorithms/introduction-to-greedy-strategy-in-algorithms.aspx

退火算法 貪婪算法

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542103.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542103.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542103.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

windows 2008 R2系統安裝撥號v p n詳細配置

windows 2008 R2系統單網卡安裝撥號v p n系統環境:windows 2008 R2操作步驟首先設置服務端在服務器管理器中添加角色“網絡策略和訪問服務”,并安裝以下角色服務右擊路由與遠程訪問,選擇“配置并啟用路由和遠程訪問”右擊路由與遠程訪問&…

python—函數

1. 函數的定義: 1 . 含義:我們把實現某一功能的代碼定義為一個函數,在需要使用時,隨時調用,十分方便。對于函數,簡單理解就是可以完成某功能的代碼塊,可反復使用。 Python提供了許多內建函數&a…

word打開老是配置進度_小白教程 | office出現配置進度框,怎么辦?

最近很多同學在備考二級時候,自己的電腦上office軟件Word或者Excel出問題了,每次打開都會出現配置進度框。這種情況怎么辦呢?這種情況都是注冊表的問題,馬上安排解決之前在 右鍵菜單沒有office新建怎么辦(點擊即可閱讀)也是用注冊…

【踩坑速記】開源日歷控件,順便全面解析開源庫打包發布到Bintray/Jcenter全過程(新),讓開源更簡單~...

一、寫在前面 自使用android studio開始,就被它獨特的依賴方式:compile com.android.support:appcompat-v7:25.0.1所深深吸引,自從有了它,麻麻再也不用擔心依賴第三方jar包繁瑣無趣啦。而,如果自己寫一個開源庫是一種怎…

scala集合中添加元素_如何在Scala中獲得列表的第一個元素?

scala集合中添加元素清單 (List) A list is a linear data structure. It is a collection of elements of the same data types. 列表是線性數據結構。 它是相同數據類型的元素的集合。 Scala libraries have many functions to support the functioning of lists. Methods l…

python—列表、字典生成式

1 列表生成式 Python內置的一種極其強大的生成列表 list 的表達式。返回結果必須是列表。 示例: 需求1:接收變量 k a b s 51 5000 10000 a s.split() li [] for item in s.split():li.append(int(item)) k,a,b li print(k,a,b)運行結果:…

excel數據平均分配給多人_excel表格 怎樣均分數據-用Excel怎么才能將組數據平均分配給幾個人...

怎樣在Excel表格中求平均數?在excel中怎樣自動生成各班各科的平均成績可以調用Excel函數庫的函實現。步驟如下:1. 在單元格內點擊上公式-平均值”。2. 點擊需要參與計算的單元格數據,符號用鍵盤輸入,最后回車即可。百度百科-Excel函數exce…

Java中List和Map接口之間的區別

列表與地圖界面 (List vs Map interface) Here, we will see how List differs from Map interface in Java and we will see the points given below, 在這里,我們將看到List與Java中的Map接口有何不同,并且我們將看到以下幾點, 列表界面 (…

python—高階函數

什么是內置高階函數: 一個函數可以作為參數傳給另外一個函數,或者一個函數的返回值為另外一個函數(若返回值為該函數本身,則為遞歸),滿足其一則為高階函數。 Python中內置了幾個常用的高階函數,…

功能區不顯示工具條_【新老客戶必知】軟件支持超高清屏顯示器了

隨著計算機硬件的不斷更新換代顯示設備的不斷更新從原來的分辨率640 X 480啥原來分辨這么低呀?還記得DOS嗎?或者Win95,win98嗎當時顯示器分辨率能調到800X 600很好了2000年左右隨著純平顯示器的推出也有了高清顯示器的概念那么一般我們說的高清顯示器分辨…

nginx1.10.2源碼安裝配置參數參考

[rootlocalhost nginx-1.10.2]# ./configure --help--help print this message--prefixPATH set installation prefix #Nginx安裝的根路徑,默認為 /usr/local/nginx。--sbin-pathPATH set nginx binary pathname #指定nginx二進制文件的路徑,默認為PATH/sbin/n…

c ++查找字符串_C ++朋友功能| 查找輸出程序| 套裝1

c 查找字符串Program 1: 程序1&#xff1a; #include <iostream>using namespace std;class Sample {int A, B;friend void fun();};void fun(){Sample S;S.A 10;S.B 20;cout << S.A << " " << S.B << endl;}int main(){fun();retu…

Spring定時器的運用

為什么80%的碼農都做不了架構師&#xff1f;>>> 一、spring4定時器任務配置如下&#xff1a; <bean id"jsapiTask" class"chan.ye.dai.wexin.JsapiTicketTimeTask" /><bean id"jobDetail"class"org.springframework.s…

python—裝飾器

裝飾器概念&#xff1a; 把一個函數當作參數傳遞給一個函數&#xff0c;返回一個替代版的函數 本質上就是一個返回函數的函數 在不改變原函數的基礎上&#xff0c;給函數增加功能 python 中裝飾器做的事情&#xff01;它們封裝一個函數&#xff0c;并且用這樣或者那樣的方式來修…

ad18原理圖器件批量修改_Altium Designer 15原理圖設計基礎

Altium Designer 15成為越來越多電子設計開發工程師EDA電路設計軟件的首選&#xff0c;在學校學習Altium Designer的也越來較多&#xff0c;像單片機開發學習一樣&#xff0c;EDA設計只要學會了&#xff0c;再學其他的設計軟件就容易多了。上一節分享了《Altium Designer 15集成…

c++freopen函數_使用示例的C語言中的freopen()函數

cfreopen函數C語言中的freopen()函數 (freopen() function in C) Prototype: 原型&#xff1a; FILE* freopen(const char *str, const char *mode, FILE *stream);Parameters: 參數&#xff1a; const char *str, const char *mode, FILE *streamReturn type: FILE* 返回類型…

python—文件

1 . 文件的基本操作&#xff1a; 文件讀取三部曲&#xff1a; 打開操作關閉&#xff08;如果不關閉會占用文件描述符&#xff09; 打開文件&#xff1a; f open(/tmp/passwdd,w)操作文件&#xff1a; 1 . 讀操作&#xff1a; f.read()content f.read()print(content) 2 …

基本概念學習(7000)--P2P對等網絡

對等網絡&#xff0c;即對等計算機網絡&#xff0c;是一種在對等者&#xff08;Peer&#xff09;之間分配任務和工作負載的分布式應用架構[1] &#xff0c;是對等計算模型在應用層形成的一種組網或網絡形式。“Peer”在英語里有“對等者、伙伴、對端”的意義。因此&#xff0c;…

c語言for循環++_C ++程序使用循環查找數字的冪

c語言for循環Here, we are going to calculate the value of Nth power of a number without using pow function. 在這里&#xff0c;我們將不使用pow函數來計算數字的N 次冪的值 。 The idea is using loop. We will be multiplying a number (initially with value 1) by t…

廈門one_理想ONE真是“500萬內最好的車”?

提起羅永浩&#xff0c;不少人還停留在“砸冰箱、造手機”等早期事件。隨著網絡直播的興起&#xff0c;羅永浩轉戰直播帶貨行業&#xff0c;但老羅畢竟是老羅&#xff0c;雷人語錄一點沒比以前少。前一段時間&#xff0c;羅永浩在微博中稱&#xff1a;“理想ONE是你能在這個價位…