現在有一道VBA期末考試題,跪求了各路學過VB大神無果,上論壇求大神幫小菜鳥解答。是要用Excel-VBA,編一個手術室調度問題,主要考察的是貪婪啟發式(Greedy heuristic ),附上題目,能幫忙的大神請與我聯系細節,我的聯系方式:QQ:243676529 郵箱:[email protected] 真的是萬分感謝!
醫院中有兩個外科醫生,他們在單獨的手術室中進行手術。外科醫生希望平均每天作業6小時,如果超過每天超過7.5小時他們將非常不開心。這意味著偶爾手術超過7.5小時是可以接受的,但是日程表應該設計為讓這種事情發生最小化。
對于每個在串列中的病人,管理者應該知道兩個醫生中的哪一個將進行手術,而且基于醫院記錄計算出類似手術的預計(平均)手術時間以及標準差
找到一個可行的(但很有可能是次優的)安排這個問題的方法是利用greedy heuristic(貪婪啟發式)。在你的作業中,你可以利用以下貪婪啟發式去開發代碼:
1. Select a surgeon, S, whose schedule has not been planned.
選擇一個日程表上沒有計劃的外科醫生,S
2. Create an ordered list, L, of the patients who require treatment by that surgeon, in descending order of expected operation duration.
制作一個關于需要這個醫生治療的病人們的順序表L,用預期手術時間的降序排列
3. Consider the patient, P, at the top of L, awaiting operation O. Add P to the earliest acceptable daily schedule for the surgeon S. A daily schedule is acceptable for patient P if adding operation O will not:
考慮到串列L中的第一個病人P,等待手術O。增加P在外科醫生S最早的可接受的每天日程表上。一個日程表是可接受的,如果對于病人P如果手術O不會發生以下情況:
(a) take the total expected duration of the operations for that day over 6 hours, or 預計總的預計手識訓費時間在那天超過6小時 或者
(b) take the total expected duration of the operations on that day plus the standard deviation for the total duration of operations on that day over 7.5 hours. 總的預計手識訓費時間加上手術標準差的時間超過7.5小時
If no such acceptable daily schedule exists then create a new daily schedule at the end of the current schedule for surgeon S to accommodate patient P (and implicitly operation O).
如果不存在這樣可以接受的日程表,為了適應患者P,創建一個新的日程在現有的外科醫生S的日程表的最后。(和隱式手術O)
4. Remove patient P from L.
從L中移除病人P
5. If L is not empty, then return to step 3.
如果L不是空的,那么就回到第三步
6. If there are surgeons whose schedules have not been planned then return to step 1.
如果有哪個外科醫生的日常安排沒有被安排,那么回到第一步
In order to make the heuristic deterministic (i.e. to guarantee the same result each time it is run on the same Problem instance), we must specify how ties are broken in step 2. In this coursework, ties should be broken by selecting the patient with the highest standard deviation of operation duration first. If two patients have the same expected operation duration and standard deviation of operation duration, then the patient with the smallest index (first on the original list of patients) should be chosen first.
為了確定的啟發性(即 運行在同樣的問題實體中保證每次有相同的結果)我們必須指定在步驟2中怎樣打破這種ties。在這個作業中,ties應該首先通過選擇病人手術時間的最高標準偏差被打破。如果兩個病人有相同的預計手術時間和手術時間的標準偏差也相同,那索引中最小的病人(在原始串列中的第一個病人)應該被第一個選擇。
Example 1: if patients 5 and 7 have the same expected operation duration, with standard deviations of 1.5 and 1.7, respectively, then patient 7 should be listed first.
例1:如果病人5和病人7的預計手術時間相同,他們的標準偏差分別為1.5和1.7,那么病人7應該在串列的第一個
Example 2: if patients 4 and 8 have the same expected operation durations and standard deviations then patient 4 should be listed first.
例2:如果病人4和病人8有相同的預計手術時間和標準偏差,那么病人4應該在串列中排第一個
參閱技術文章(我給你的另一個word)查閱細節,有關于結合預計手術時間和標準偏差的結合怎么計算
需要在EXCEL VBA中實作貪婪啟發式。你的程式必須有一個獨立的用戶見面,以至于用戶可以
1. 從一個CSV的text檔案中閱讀資料
2. 識別任何問題資料
3. 運行貪婪啟發式
4. 輸出結果
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/123932.html
標籤:VBA
上一篇:批處理備份交換組態檔
