開始使用免費開始

解題:模型個案研究

延續汽車製造商的「具容量限制的廠址選擇(Capacitated Plant Location)」模型個案研究。PuLP 模型已為你建立並求解,並存在變數 model 中。

決策變數 xy 分別代表各區域之間的生產與運輸數量,以及是否開設生產廠。此外,已建立兩個 Python 清單 locsize,分別包含各地點與兩種廠房容量類型。最後,模型的輸入資料已列印在主控台中供你參考。

本練習屬於課程

Python 的供應鏈分析

檢視課程

練習說明

  • 列印各區域之間的生產與運輸數量。
  • 接著,列印不同區域中低容量與高容量廠房的狀態值。
  • 最後,列印目標函式值。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Print the Production Quantities
o = [{'prod':'{} to {}'.format(i,j), 'quantity':x[(i,j)].____} 
     for i in ____ for j in ____]
print(pd.DataFrame(o))

# Print the Plant Values of the different regions
o = [{'lowCap':y[(i,size[0])].____, 'highCap':y[(i,size[1])].____}
     for i in ____]
print(pd.DataFrame(o, index=loc))

# Print the Objective Value
print('Objective = ', ____)
編輯並執行程式碼