




已閱讀5頁,還剩33頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
問題:P-Center問題P-Center問題摘要問題:從一個點集合中選擇p個點作為中心點,并把其他分配到某個選擇的點,使得所有點到其對應(yīng)的中心點的距離加起來最小。針對問題,分析得出p-center問題實質(zhì)為選址問題。其研究背景為工廠的選址,屬于運籌學中經(jīng)典問題之一。運用智能算法中模擬退火隨機局域搜索算法進行求解最小值。具體步驟為:由于題目中未提供點集合,所以首先通過文獻查閱1和生活實際得到可靠的二維數(shù)據(jù)點分布,即表示一個點集合,存儲方式為文件存儲(data.txt);其次加載點集合數(shù)據(jù),采用模擬退火算法隨機局域搜索算法2進行處理:1) 初始化:中心點個數(shù),溫度,溫度縮減系數(shù),最大迭代次數(shù)。解釋:由于P-Center問題是以工廠的選址問題,加上編寫的二維數(shù)據(jù)的分布情況,所以建立工廠的數(shù)量為事先已知條件,即;初試溫度的設(shè)置是影響搜索性能重要因素之一。初始化溫度高,則搜索到全局最優(yōu)值的可能性大,但計算時間大幅度增加;反之,縮短了計算時間,但性能并不優(yōu)越。所以采用多次實驗的方式確定溫度;為了保證較大的搜索空間,所以讓系數(shù)接近于1;經(jīng)過多次實驗,確定迭代次數(shù),此時結(jié)果較為理想。2) 迭代次,循環(huán)第三步到第四步。3)從臨域中選擇最佳的解,即確定最優(yōu)值:產(chǎn)生新值;增量;若,則接受 作為新解,否者以概率接受作為新解。4)逐漸減少,且,最后跳至第二步。5)得到距離最小值然后通過模擬退火局部搜索算法,得迭代情況為:最后通過模擬退火局部搜索算法,得出分配圖為:得出四個粗五角星為各自的中心點,其中顏色相同的屬于各自顏色的中心點,即相同顏色距離各自中心點最短。通過Python得出最近距離為:102.401974373問題擴充:針對P-Center問題,還可以通過k-means聚類算法3進行解決,得到與最近搜索算法同樣的結(jié)果。關(guān)鍵詞: P-Center選址問題 模擬退火隨機局域搜索算法 K-Means聚類算法目錄P-Center問題2摘要21問題重述42數(shù)據(jù)預(yù)處理42.1數(shù)據(jù)來源42.2數(shù)據(jù)預(yù)處理方法42.3數(shù)據(jù)選取參考原則43問題分析43.1問題44 問題假設(shè)55 符號說明56 模型的建立與求解56.1解法一56.1.1模擬退火隨機局部搜索算法56.1.2算法求解76.2解法二86.2.1K-Means聚類算法86.2.2算法求解87模型的評價98 參考文獻9附錄10附錄一 模擬退火隨機局域搜索算法Python代碼10附錄二 聚類算法Python代碼12附錄三 迭代次數(shù)與目標函數(shù)關(guān)系15附錄四 結(jié)論圖201問題重述選址問題是運籌學中經(jīng)典的問題之一。經(jīng)典的選址問題包括連續(xù)選址問題、離散選址問題、P-Median問題以及P-Center問題等。該問題屬于P-Center問題,從一個點集合中選擇p個點作為中心點,并把其他點分配到某個選擇的點,使得所有點到其對應(yīng)中心點的距離加起來最小。2數(shù)據(jù)預(yù)處理注:數(shù)據(jù)存儲形式為:data.txt,可在附件一中查看2.1數(shù)據(jù)來源(1) 文獻查閱(2) 生活實際2.2數(shù)據(jù)預(yù)處理方法(1) 數(shù)據(jù)選?。喝コ裏o效數(shù)據(jù)以及噪聲數(shù)據(jù)。(2) 數(shù)據(jù)整合:將若干個數(shù)據(jù)庫整合成一個數(shù)據(jù)存儲結(jié)構(gòu)。(3) 數(shù)據(jù)替代:將雜亂數(shù)據(jù)替代成易處理數(shù)據(jù)。(4) 數(shù)據(jù)變換:將原始數(shù)據(jù)轉(zhuǎn)換為適合任務(wù)定價的形式。2.3數(shù)據(jù)選取參考原則(1) 統(tǒng)一數(shù)據(jù)源編碼。(2) 清除唯一屬性。(3) 清除重復屬性。(4) 清除可忽略字段。(5) 進一步處理:清除異常數(shù)據(jù),去除附帶噪聲數(shù)據(jù),填充空缺值、丟失值。3問題分析3.1問題首先,通過文獻查閱和生活實際得到可靠的二維數(shù)據(jù)點分布,將此二維分布作為數(shù)據(jù)點集合,然后通過模擬退火最近搜索算法4進行迭代優(yōu)化,最終得到所有點到其中心點的距離。4 問題假設(shè)1. 假設(shè)根據(jù)數(shù)據(jù)特征或者政策(例如工廠政策)確定,即已經(jīng)確定P-Center中的p中心個數(shù)。2.假設(shè)點集合為二維集合,不包括任何三維或者多維信息。5 符號說明符號說明可行解迭代更新后的解概率條件下更新優(yōu)化目標函數(shù)模擬退火溫度值中心點個數(shù)溫度縮減系數(shù)最大迭代次數(shù)6 模型的建立與求解選址問題目前有多種求解方法,大致分為定性和定量兩類:定性的方法主要是結(jié)合層次分析法和模糊綜合法對各方案進行指標評價,最終得出最優(yōu)選址;定量的方法主要是松弛算法和啟發(fā)式算法以及兩者的結(jié)合。而本題解決的是P-Center問題,即使用啟發(fā)式算法-智能算法模擬退火隨機局部搜索算法5進行解決。6.1解法一6.1.1模擬退火隨機局部搜索算法模擬退火算法是一種貪心算法,但是其搜索過程引入了隨機因素。在迭代更新可行解時,以一定概率來接受一個比當前解要差的解,因此有可能會跳出局部最優(yōu)解,達到全局最優(yōu)解,其搜索原理如下圖:圖1 模擬退火隨機局部搜索算法示意圖假定當前可行解為,迭代更新后的解為,那么對應(yīng)的“能量差”定義為:以相應(yīng)概率接受新值,此概率為:模擬退火隨機局域搜索算法思路為:圖2 模擬退火隨機局域搜索算法思路圖6.1.2算法求解注:詳細Python程序見附錄一與附件一根據(jù)算法思想,通過Python得到迭代與目標函數(shù)關(guān)系為:圖3 模擬退火訓練曲線圖可以看出經(jīng)過200次迭代,優(yōu)化目標函數(shù)處于相對穩(wěn)定狀態(tài)。具體的目標函數(shù)與迭代次數(shù)對應(yīng)關(guān)系見附錄,以下為部分對應(yīng)關(guān)系:圖4 部分迭代次數(shù)與目標函數(shù)關(guān)系最終得出點集合分配圖為:圖5 點集合分配圖得出四個粗五角星為各自的中心點,其中顏色相同的屬于各自顏色的中心點,即相同顏色距離各自中心點最短。通過Python得出最近距離為:102.4019743736.2解法二通過智能算法中的模擬退火隨機局域搜索算法可以得出相應(yīng)的結(jié)論,為了檢驗以及去探索更多的解決方式,使用了聚類算法,以下為模型以及過程。具體的Python代碼見附錄二以及附件一。6.2.1K-Means聚類算法算法過程如下:1) 從N個點中隨機選取p個點作為中心點2) 對剩余的點測量到其每個中心點的距離,并把它歸到中心點的類3) 重新計算已經(jīng)得到的各個類的中心點4) 迭代第二步、第三步直至新的中心點與原中心點相等或者小于指定閾值,算法結(jié)束6.2.2算法求解通過Python程序?qū)⑼ㄟ^文獻查找的點集合數(shù)據(jù)data.txt進行聚類分析,得到與局域搜索算法類似的分配圖,如下圖所示:圖6 聚類分析分配圖此圖的解釋與模擬退火隨機局域搜索算法相同,不再重復解釋。同樣可以得出所有點到對應(yīng)中心點的距離最小為:102.401974373。7模型的評價7.1模型的優(yōu)缺點模型的優(yōu)點:(1)通過模擬退火隨機局域搜索算法應(yīng)用十分廣泛,可以高效的解決NP完全問題(2)模擬退火隨機搜索算法與K-Means聚類算法相互結(jié)合,相互印證,使得數(shù)據(jù)準確性得以保證。(3)通過模擬退火算法與K-Means算法得出的點集合分配圖可以形象生動的得出二維的數(shù)據(jù)關(guān)系。模型的缺點:(1)模擬退火隨機局域搜索算法初始化設(shè)置必須準確,要經(jīng)過多次實驗才能得到合適的初始化值。8 參考文獻1CCEHC: An efficient local search algorithm for weighted partial maximum satisfiability,Artificial Intelligence,2017,2Local Search for Minimum Weight Dominating Set with Two-Level Configuration Checking and Frequency Based Scoring Function,Journal of Artificial Intelligence Research (JAIR),2017,3王守強. 多中心點聚類問題的隨機算法D.山東大學,2010.4朱泓丞. 設(shè)施選址問題的研究與應(yīng)用D.中國科學技術(shù)大學,2009.5蔣建林,徐進澎,文杰.基于單親遺傳模擬退火算法的頂點p-中心問題J.系統(tǒng)工程學報,2011,26(03):414-420.附錄注:具體代碼見附件附錄一 模擬退火隨機局域搜索算法Python代碼import numpy as npimport matplotlib.pyplot as pltimport matplotlibimport scipy.spatial.distance as DSimport randomzandaoguangfont = matplotlib.font_manager.FontProperties(fname=a.TTF)def f(x): 目標函數(shù),所有點到中心點的距離和 :param x: list 表示中心點的序號 :param dataSet: 數(shù)據(jù)集 :return: distances=DS.cdist(dataSet,dataSetx,:)#用于計算兩個輸入集合的距離 M=np.min(distances,axis=1)#得出附近點到中心點的最小值 return sum(M)#將最小值累加得到最小距離def find_next(x): 從鄰域中選擇最佳的解 :param x: :param dataSet: :return:最優(yōu)值 ind=random.sample(range(p),1) x_new=list.copy(x) tmp=random.sample(range(dataSet.shape0),1)#dataSet.shape0返回行數(shù) while tmp0 in x: tmp = random.sample(range(dataSet.shape0), 1) x_newint(ind0)=tmp0 if f(x_new)f(x): return x_new else: if random.random()np.exp(-(f(x_new)-f(x)/T):#模擬退火算法核心 return x_new else: return x#得到數(shù)據(jù)print (第一步:加載數(shù)據(jù) ) dataSet=fileIn = open(data.txt)for line in fileIn.readlines(): lineArr = line.strip().split( ) dataSet.append(float(lineArr0), float(lineArr-1)dataSet=np.array(dataSet)p=4#設(shè)定問題的p中心參數(shù)的值T=1000#模擬退火的初始溫度a=0.999#溫度減少的系數(shù),為了保證較大的搜索空間,所以非常接近于1Iter=200#最大迭代次數(shù)#模擬退火#param:history記錄距離和最優(yōu)值,方便比較最小值#param:best_x記錄當前距離和最小值x=random.sample(range(dataSet.shape0),p)#隨機產(chǎn)生初始解best_x=xhistory=for i in range(Iter): print(第%d次迭代:目標函數(shù)=%s%(i,f(x) x=find_next(x) T*=a if f(x)f(best_x): best_x=x history.append(f(best_x)print(距離和最小為%s%f(best_x)#模擬退火局部搜索訓練曲線圖#resul:t得出模擬退火的迭代次數(shù)與目標函數(shù)值的關(guān)系plt.figure(0)plt.plot(range(1,Iter+1),history,r-)plt.xlabel(迭代次數(shù),fontproperties=zandaoguangfont)plt.ylabel(目標函數(shù)值,fontproperties=zandaoguangfont)plt.title(模擬退火訓練曲線圖,fontproperties=zandaoguangfont)#數(shù)據(jù)分配圖#用紅藍黃綠等顏色代表p中心中的p類#其中經(jīng)過搜索后的p個中心點用markersize=10的五邊形表示#相同顏色的點相比較與相同顏色的加粗markersize=10的五邊形,即相同顏色以相同顏色的加粗五邊形為中心,此時距離最近。plt.figure(1)distances=DS.cdist(dataSet,dataSetbest_x,:)sorted_dist=np.argsort(distances,axis=1)color=r.,b.,y.,g.color0=rp,bp,yp,gpfor i in range(p): ind=sorted_dist:,0=i plt.plot(dataSetind,0,dataSetind,1,colori) plt.plot(dataSetbest_xi,0,dataSetbest_xi,1,color0i,markersize=10)plt.title(分配圖,fontproperties=zandaoguangfont)plt.show()附錄二 聚類算法Python代碼from numpy import * import matplotlib.pyplot as plt import KMeans # 得到數(shù)據(jù).print (第一步:加載數(shù)據(jù). ) dataSet = fileIn = open(data.txt) for line in fileIn.readlines(): temp=lineArr = line.strip().split(t) temp.append(float(lineArr0)temp.append(float(lineArr1)dataSet.append(temp)fileIn.close() # 進行聚類.print (第二步:進行聚類. )dataSet = mat(dataSet) #設(shè)置為4個中心點k = 4 #調(diào)用KMeans文件中定義的kmeans方法。centroids, clusterAssment = KMeans.kmeans(dataSet, k) # 第三步:顯示結(jié)果.#數(shù)據(jù)分配圖#用不同種顏色代表p中心中的p類#其中經(jīng)過搜索后的p個中心點用markersize=10的五邊形表示#相同顏色的點相比較與相同顏色的加粗markersize=10的五邊形,即相同顏色以相同顏色的加粗五邊形為中心,此時距離最近。print (第三步:顯示結(jié)果. )KMeans.showCluster(dataSet, k, centroids, clusterAssment)Kmeans.py# # kmeans: k-means cluster # Author :ZanDaoguang# Date :2018/03/09# HomePage : # Email : # from numpy import * import time import matplotlib.pyplot as plt # calculate Euclidean distance def euclDistance(vector1, vector2): return sqrt(sum(power(vector2 - vector1, 2) #求這兩個矩陣的距離,vector1、2均為矩陣 # init centroids with random samples #在樣本集中隨機選取k個樣本點作為初始質(zhì)心def initCentroids(dataSet, k): numSamples, dim = dataSet.shape #矩陣的行數(shù)、列數(shù) centroids = zeros(k, dim) #感覺要不要你都可以for i in range(k): index = int(random.uniform(0, numSamples) #隨機產(chǎn)生一個浮點數(shù),然后將其轉(zhuǎn)化為int型centroidsi, : = dataSetindex, : return centroids # k-means cluster #dataSet為一個矩陣#k為將dataSet矩陣中的樣本分成k個類 def kmeans(dataSet, k): numSamples = dataSet.shape0 #讀取矩陣dataSet的第一維度的長度,即獲得有多少個樣本數(shù)據(jù) # first column stores which cluster this sample belongs to, # second column stores the error between this sample and its centroid clusterAssment = mat(zeros(numSamples, 2) #得到一個N*2的零矩陣clusterChanged = True # step 1: init centroids centroids = initCentroids(dataSet, k) #在樣本集中隨機選取k個樣本點作為初始質(zhì)心 while clusterChanged: clusterChanged = False # for each sample for i in range(numSamples): #rangeminDist = 100000.0 minIndex = 0 # for each centroid # step 2: find the centroid who is closest #計算每個樣本點與質(zhì)點之間的距離,將其歸內(nèi)到距離最小的那一簇for j in range(k): distance = euclDistance(centroidsj, :, dataSeti, :) if distance minDist: minDist = distance minIndex = j # step 3: update its cluster #k個簇里面與第i個樣本距離最小的的標號和距離保存在clusterAssment中#若所有的樣本不在變化,則退出while循環(huán)if clusterAssmenti, 0 != minIndex: clusterChanged = True clusterAssmenti, : = minIndex, minDist*2 #兩個*表示的是minDist的平方 # step 4: update centroids for j in range(k): #clusterAssment:,0.A=j是找出矩陣clusterAssment中第一列元素中等于j的行的下標,返回的是一個以array的列表,第一個array為等于j的下標pointsInCluster = dataSetnonzero(clusterAssment:, 0.A = j)0 #將dataSet矩陣中相對應(yīng)的樣本提取出來 centroidsj, : = mean(pointsInCluster, axis = 0) #計算標注為j的所有樣本的平均值 print ( 聚類完成!) return centroids, clusterAssment # show your cluster only available with 2-D data #centroids為k個類別,其中保存著每個類別的質(zhì)心#clusterAssment為樣本的標記,第一列為此樣本的類別號,第二列為到此類別質(zhì)心的距離 def showCluster(dataSet, k, centroids, clusterAssment): numSamples, dim = dataSet.shape if dim != 2: print (Sorry! I can not draw because the dimension of your data is not 2!) return 1 mark = or, ob, og, ok, r, +r, sr, dr, len(mark): print (對不起,您輸入的k太大了,請聯(lián)系管理員山東科技大學昝道廣) return 1 # draw all samples for i in range(numSamples): markIndex = int(clusterAssmenti, 0) #為樣本指定顏色plt.plot(dataSeti, 0, dataSeti, 1, markmarkIndex) mark = Dr, Db, Dg, Dk, b, +b, sb, db, b, pb # draw the centroids for i in range(k): plt.plot(centroidsi, 0, centroidsi, 1, marki, markersize = 10)plt.title(Distribution diagram) plt.show()附錄三 迭代次數(shù)與目標函數(shù)關(guān)系第0次迭代:目標函數(shù)=179.115046893第1次迭代:目標函數(shù)=205.447603458第2次迭代:目標函數(shù)=179.714990497第3次迭代:目標函數(shù)=190.540746471第4次迭代:目標函數(shù)=186.205430169第5次迭代:目標函數(shù)=255.113966307第6次迭代:目標函數(shù)=237.264836994第7次迭代:目標函數(shù)=360.246463689第8次迭代:目標函數(shù)=235.13584001第9次迭代:目標函數(shù)=245.721007671第10次迭代:目標函數(shù)=247.472895118第11次迭代:目標函數(shù)=273.485021319第12次迭代:目標函數(shù)=280.851747779第13次迭代:目標函數(shù)=280.308274938第14次迭代:目標函數(shù)=198.743816875第15次迭代:目標函數(shù)=195.036904207第16次迭代:目標函數(shù)=277.824032017第17次迭代:目標函數(shù)=292.981152147第18次迭代:目標函數(shù)=190.984905364第19次迭代:目標函數(shù)=191.252223971第20次迭代:目標函數(shù)=123.059185807第21次迭代:目標函數(shù)=190.533091518第22次迭代:目標函數(shù)=189.302660621第23次迭代:目標函數(shù)=187.360273683第24次迭代:目標函數(shù)=187.360273683第25次迭代:目標函數(shù)=216.753632115第26次迭代:目標函數(shù)=264.196159321第27次迭代:目標函數(shù)=264.296840503第28次迭代:目標函數(shù)=181.742051739第29次迭代:目標函數(shù)=122.674228117第30次迭代:目標函數(shù)=186.925795284第31次迭代:目標函數(shù)=256.518821535第32次迭代:目標函數(shù)=237.353645794第33次迭代:目標函數(shù)=191.156290007第34次迭代:目標函數(shù)=216.105125507第35次迭代:目標函數(shù)=147.578774857第36次迭代:目標函數(shù)=222.828821333第37次迭代:目標函數(shù)=215.525456567第38次迭代:目標函數(shù)=204.837254851第39次迭代:目標函數(shù)=197.185551202第40次迭代:目標函數(shù)=188.580114581第41次迭代:目標函數(shù)=265.711905553第42次迭代:目標函數(shù)=163.812778837第43次迭代:目標函數(shù)=162.068177064第44次迭代:目標函數(shù)=164.368700208第45次迭代:目標函數(shù)=161.816009847第46次迭代:目標函數(shù)=204.73869345第47次迭代:目標函數(shù)=162.769100846第48次迭代:目標函數(shù)=178.51942545第49次迭代:目標函數(shù)=173.561807727第50次迭代:目標函數(shù)=169.799603435第51次迭代:目標函數(shù)=168.651134516第52次迭代:目標函數(shù)=245.443837937第53次迭代:目標函數(shù)=169.449644817第54次迭代:目標函數(shù)=116.628068242第55次迭代:目標函數(shù)=171.256461075第56次迭代:目標函數(shù)=167.716292084第57次迭代:目標函數(shù)=163.959218108第58次迭代:目標函數(shù)=167.828227585第59次迭代:目標函數(shù)=186.81606983第60次迭代:目標函數(shù)=173.885593243第61次迭代:目標函數(shù)=171.185562964第62次迭代:目標函數(shù)=165.620351515第63次迭代:目標函數(shù)=171.009592894第64次迭代:目標函數(shù)=258.202349371第65次迭代:目標函數(shù)=300.310149921第66次迭代:目標函數(shù)=245.514351498第67次迭代:目標函數(shù)=158.696269997第68次迭代:目標函數(shù)=181.751581539第69次迭代:目標函數(shù)=190.838797732第70次迭代:目標函數(shù)=245.514351498第71次迭代:目標函數(shù)=187.41644075第72次迭代:目標函數(shù)=185.529583413第73次迭代:目標函數(shù)=192.972377185第74次迭代:目標函數(shù)=203.792334694第75次迭代:目標函數(shù)=179.422114776第76次迭代:目標函數(shù)=176.565275563第77次迭代:目標函數(shù)=177.060338213第78次迭代:目標函數(shù)=261.856371227第79次迭代:目標函數(shù)=186.265589017第80次迭代:目標函數(shù)=111.762469877第81次迭代:目標函數(shù)=164.693111801第82次迭代:目標函數(shù)=199.237534931第83次迭代:目標函數(shù)=201.605152809第84次迭代:目標函數(shù)=200.117346554第85次迭代:目標函數(shù)=226.507916216第86次迭代:目標函數(shù)=162.047130232第87次迭代:目標函數(shù)=180.016930471第88次迭代:目標函數(shù)=186.524458902第89次迭代:目標函數(shù)=184.228403531第90次迭代:目標函數(shù)=175.548638845第91次迭代:目標函數(shù)=134.209706505第92次迭代:目標函數(shù)=188.793411141第93次迭代:目標函數(shù)=178.706438929第94次迭代:目標函數(shù)=179.685911322第95次迭代:目標函數(shù)=244.590852758第96次迭代:目標函數(shù)=170.495284118第97次迭代:目標函數(shù)=251.458815477第98次迭代:目標函數(shù)=170.702193198第99次迭代:目標函數(shù)=263.478662358第100次迭代:目標函數(shù)=266.230685027第101次迭代:目標函數(shù)=233.806726474第102次迭代:目標函數(shù)=236.472566702第103次迭代:目標函數(shù)=225.158342676第104次迭代:目標函數(shù)=256.998374944第105次迭代:目標函數(shù)=253.877494761第106次迭代:目標函數(shù)=192.000533947第107次迭代:目標函數(shù)=178.526999848第108次迭代:目標函數(shù)=181.81273764第109次迭代:目標函數(shù)=209.9163263第110次迭代:目標函數(shù)=213.281909621第111次迭代:目標函數(shù)=188.821519052第112次迭代:目標函數(shù)=123.867798998第113次迭代:目標函數(shù)=105.140919713第114次迭代:目標函數(shù)=170.167350969第115次迭代:目標函數(shù)=162.045708686第116次迭代:目標函數(shù)=202.011426338第117次迭代:目標函數(shù)=208.780665419第118次迭代:目標函數(shù)=199.756181363第119次迭代:目標函數(shù)=147.2914882第120次迭代:目標函數(shù)=209.490628934第121次迭代:目標函數(shù)=188.906272556第122次迭代:目標函數(shù)=254.106389312第123次迭代:目標函數(shù)=182.700159056第124次迭代:目標函數(shù)=232.691441966第125次迭代:目標函數(shù)=169.767173494第126次迭代:目標函數(shù)=170.767353772第127次迭代:目標函數(shù)=188.919334801第128次迭代:目標函數(shù)=102.401974373第129次迭代:目標函數(shù)=186.11050464第130次迭代:目標函數(shù)=188.60993634第131次迭代:目標函數(shù)=275.973278089第132次迭代:目標函數(shù)=362.569042856第133次迭代:目標函數(shù)=270.404395791第134次迭代:目標函數(shù)=250.264903731第135次迭代:目標函數(shù)=240.202115223第136次迭代:目標函數(shù)=194.996586644第137次迭代:目標函數(shù)=159.9543548第138次迭代:目標函數(shù)=113.189269431第139次迭代:目標函數(shù)=197.900262404第140次迭代:目標函數(shù)=188.860310258第141次迭代:目標函數(shù)=209.126474986第142次迭代:目標函數(shù)=177.066658993第143次迭代:目標函數(shù)=177.066658993第144次迭代:目標函數(shù)=177.760102523第145次迭代:目標函數(shù)=177.549106799第146次迭代:目標函數(shù)=123.595979237第147次迭代:目標函數(shù)=178.527727413第148次迭代:目標函數(shù)=181.015296862第149次迭代:目標函數(shù)=180.151607634第150次迭代:目標函數(shù)=179.029042954第151次迭代:目標函數(shù)=179.118700201第152次迭代:目標函數(shù)=178.492873802第153次迭代:目標函數(shù)=267.259531299第154次迭代:目標函數(shù)=177.968871038第155次迭代:目標函數(shù)=184.081387786第156次迭代:目標函數(shù)=255.078061285第157次迭代:目標函數(shù)=249.847542458第158次迭代:目標函數(shù)=307.417266779第159次迭代:目標函數(shù)=250.027959865第160次迭代:目標函數(shù)=196.970093641第161次迭代:目標函數(shù)=196.970093641第162次迭代:目標函數(shù)=209.33031066第163次迭代:目標函數(shù)=204.843807568第164次迭代:目標函數(shù)=211.044681303第165次迭代:目標函數(shù)=149.340167212第166次迭代:目標函數(shù)=192.132343418第167次迭代:目標函數(shù)=140.343956644第168次迭代:目標函數(shù)=181.94000428第169次迭代:目標函數(shù)=160.148458356第170次迭代:目標函數(shù)=160.242174974第171次迭代:目標函數(shù)=110.389926868第172次迭代:目標函數(shù)=115.708666994第173次迭代:目標函數(shù)=114.032119783第174次迭代:目標函數(shù)=114.032119783第175次迭代:目標函數(shù)=196.53638158第176次迭代:目標函數(shù)=212.763689632第177次迭代:目標函數(shù)=191.777288702第178次迭代:目標函數(shù)=202.166598824第179次迭代:目標函數(shù)=180.713134792第180次迭代:目標函數(shù)=280.696308732第181次迭代:目標函數(shù)=177.432402563第182次迭代:目標函數(shù)=277.773816476第183次迭代:目標函數(shù)=284.328371408第184次迭代:目標函數(shù)=178.922381458第185次迭代:目標函數(shù)=186.85188453第186次迭代:目標函數(shù)=186.193903261第187次迭代:目標函數(shù)=215.784785022第188次迭代:目標函數(shù)=186.998732666第189次迭代:目標函數(shù)=166.417149078第190次迭代:目標函數(shù)=224.515369868第191次迭代:目標函數(shù)=240.503650114第192次迭代:目標函數(shù)=224.599534187第193次迭代:目標函數(shù)=245.57430458第194次迭代:目標函數(shù)=331.210864758第195次迭代:目標函數(shù)=236.657697786第196次迭代:目標函數(shù)=244.844816837第197次迭代:目標函數(shù)=238.634981095第198次迭代:目標函數(shù)=267.60921475第199次迭代:目標函數(shù)=231.441025132距離和最小為102.4019743附錄四 結(jié)論圖圖7 模擬退火迭代訓練曲線圖圖8 模擬退火隨機局域搜索算法分配圖圖9 聚類算法分配圖C+代碼#include #include #include #include #include #include #include #include #include #define MAX 1e9using namespace std;struct pointdouble x;double y;int p = 4, T = 1000, Iter = 200;double a = 0.999;vector dataset;double getdis(point p1, point p2)return sqrt(pow(p1.x - p2.x), 2) + pow(p1.y - p2.y), 2);double f(vector x)double sum = 0;vectorvector dis;dis.resize(4);for (int i
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《小英雄雨來》觀后感(合集15篇)
- 年產(chǎn)200噸醫(yī)藥中間體項目可行性研究報告(模板范文)
- 家醫(yī)上門服務(wù)的政策支持與執(zhí)行策略
- 海洋科技創(chuàng)新的發(fā)展框架與路徑
- 新疆烏魯木齊市實驗學校2023-2024學年高三上學期1月月考生物含解析
- 小學均衡發(fā)展教育班會
- 珠海藝術(shù)職業(yè)學院《計算機導論》2023-2024學年第二學期期末試卷
- 皖江工學院《廣告策劃與制作》2023-2024學年第二學期期末試卷
- 心理學知識普及課件
- 開封職業(yè)學院《分離工程》2023-2024學年第二學期期末試卷
- 民法典解讀–總則編1
- 建設(shè)工程前期手續(xù)辦理程序
- 干部履歷表(中共中央組織部2015年制)
- 子宮內(nèi)膜息肉的中西醫(yī)結(jié)合治療策略
- 儀表車采集及控制
- 漏洞掃描與修復技術(shù)
- 巴以沖突的歷史和現(xiàn)狀分析
- 學校食堂食材配送服務(wù)方案(肉類、糧油米面、蔬菜水果類)(技術(shù)標)
- 中醫(yī)外科學肛腸疾病課件
- GA/T 2073-2023法庭科學血液中碳氧血紅蛋白檢驗分光光度法
- 黔靈山公園調(diào)研報告
評論
0/150
提交評論