1. 程式人生 > >清華大學肖勇波梁湧老師的宏篇譯著中的問題實踐之003 - 選址問題

清華大學肖勇波梁湧老師的宏篇譯著中的問題實踐之003 - 選址問題

off 簡述 imu 分享 rom 規劃 位數 where div

清華大學肖勇波梁湧老師的宏篇譯著中的問題實踐之003 - 選址問題

清華大學肖勇波梁湧老師翻譯的Rardin教授的《運籌學》[1]已於今年年中出版,感謝機械工業出版社張有利老師的推薦和贈書,讓我能看到如此完美的千頁級宏篇譯著。該書的翻譯質量非常高,書中內容深入淺出,附有大量的應用案例(Application)和練習題庫。尤其讓人欣喜的是該著作能與計算實踐密切結合,凡有計算機圖案標記的練習都是與計算和軟件應用相關的,彰顯了運籌學的應用數學本質。有鑒於此,筆者計劃對該書中的問題進行大量實踐,爭取達到雙位數的規模。

選址問題

此問題是該書中的一個練習,見原書第二章,練習2-39。此問題是第二章練習中比較復雜的一個。

問題簡述:有五個地點(區域,Region)需要派員工作,擬在五個地點中選擇若幹個地點建立辦公室,從辦公室到工作地點的旅行根據遠近不同有不同的耗費,在各地建立辦公室的一次性花費也不同。已知各地的派員需求量,規劃在何處建址以及各辦公室到不同地點的派員數量,以使得總花費最小。數據如下:

技術分享圖片

+Leapms生成的模型摘錄

對任何問題,+Leapms都建議直接用+Leapms建模語言直接寫出模型,並進行模型調試。

我們的經驗是,模型調試能夠發現模型的不足、促進建模的完美性,甚至可以促進對問題的更加深入的了解。

當模型調試完畢,對模型的正確性有充分的信心後,+Leapms系統可生成模型摘錄,包括數學概念模型(即使用標引符號表示的數學模型)和+Leapms源碼供思路交流使用。

使用x[i][j]表示從區域 i向區域j派員的數量,顯然如果x[i][j]>0則在區域i必須建立辦公室。使用0-1變量y[i]表示是否在區域i建立辦公室。

以下是問題的+Leapms模型摘錄(pdf屏幕截圖):

技術分享圖片

技術分享圖片

+Leapms模型求解結果

+Leapms>load
 Current directory is "ROOT".
 .........
        02-01.leap
        02-02.leap
        02-03.leap
        02-39.leap
 .........
please input the filename:02-39
================================================================
1
: //2-39 To improve tax compliance the Texas 2: //Comptroller’s staff regularly audits at corporate 3: //home offices the records of out-of-state corporations 4: //doing business in Texas. Texas is considering 5: //the opening of a series of small offices near 6: //these corporate locations to reduce the travel 7: //costs now associated with such out-of-state audits. 8: //The following table shows the fixed cost (in 9: //thousands of dollars) of operating such offices at 10: //5 sites i, the number of audits required in each 11: //of 5 states j, and the travel cost (in thousands of 12: //dollars) per audit performed in each state from a 13: //base at any of the proposed office sites. 14: //======================================================= 15: //TaxSite|FixedCost|Costa 16: //======================================================= 17: // 1 2 3 4 5 18: // 1 160 0 0.4 0.8 0.4 0.8 19: // 2 49 0.7 0 0.8 0.4 0.4 20: // 3 246 0.6 0.4 0 0.5 0.4 21: // 4 86 0.6 0.4 0.9 0 0.4 22: // 5 100 0.9 0.4 0.7 0.4 0 23: //Audits 200 100 300 100 200 24: //======================================================= 25: //We seek a minimum total cost auditing plan. 26: 27: min sum{i=1,..m;j=1,..,n}c[i][j]a[j]x[i][j] + --> 28: sum{i=1,..m}f[i]y[i] 29: subject to 30: sum{i=1,..,m}x[i][j]= 1 | j=1,..,n 31: sum{j=1,..,n}x[i][j] <= M*y[i] |i=1,..,m 32: where 33: m,n are integers 34: M is a number 35: f[i] is a number|i=1,..,m 36: a[j] is a number|j=1,..,n 37: c[i][j] is a number|i=1,..,m;j=1,..,m 38: y[j] is a variable of binary|j=1,...,n 39: x[i][j] is a variable of nonnegative number --> 40: |i=1,..,m;j=1,..,n 41: data_relation 42: M=sum{j=1,..,n}a[j] 43: data 44: m=5 45: n=5 46: f={160 49 246 86 100} 47: c={ 48: 0 0.4 0.8 0.4 0.8 49: 0.7 0 0.8 0.4 0.4 50: 0.6 0.4 0 0.5 0.4 51: 0.6 0.4 0.9 0 0.4 52: 0.9 0.4 0.7 0.4 0 53: } 54: a={200 100 300 100 200} ================================================================ >>end of the file. Parsing model: 1D 2R 3V 4O 5C 6S 7End. .................................. number of variables=30 number of constraints=10 .................................. +Leapms>mip relexed_solution=0.712222; number_of_nodes_branched=0; memindex=(2,2) The Problem is solved to optimal as an MIP. 找到整數規劃的最優解.非零變量值和最優目標值如下: ......... x2_2* =1 x2_4* =1 x3_1* =1 x3_3* =1 x3_5* =1 y2* =1 y3* =1 ......... Objective*=535 ......... +Leapms>

討論

以上求解的變量結果與原著中給出的變量結果不一致,其原因是問題存在多解。

參考文獻

[1] Rardin R. L 著,肖勇波、梁湧譯. 運籌學. 北京:機械工業出版社,2018

清華大學肖勇波梁湧老師的宏篇譯著中的問題實踐之003 - 選址問題