基於TRE文章的非線性模型化線性方法

碼頭牛牛發表於2023-10-04

之前寫過一篇有關TRE最佳化模型詳解的博文:

https://www.cnblogs.com/zoubilin/p/17270435.html

這篇文章裡面的附錄給出了非線性模型化線性的方式,具體內容如下:

  • 首先是篇文章的變數和原模型(具體見我上面那篇筆記):

  • 其次這篇文章附錄給出的非線性化線性的方法:


    我覺得很經典,所以這幾天我廢了九牛二虎之力推導了這個附錄的公式,並復現了它的化線性的過程•́‸ก

一、目標函式

  • 目標函式中的非線性項為:

\[Max\quad{\sum_{t\in{T}}}\sum_{z\in{Z}}[P^t_{bz}\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})+P^t_{ez}\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})] \]

  • 引入決策變數:

\[Y^t_{bzi}=\begin{cases} 1,\quad\quad{if\,在t時期z區域渠道b對應的是第i個價格}\\0,\quad\quad{else}\end{cases} \]

\[Y^t_{ezi}=\begin{cases} 1,\quad\quad{if\,在t時期z區域渠道e對應的是第i個價格}\\0,\quad\quad{else}\end{cases} \]

  • 此時應加入下面約束條件,即式(A.13)~式(A.14)式(A.28)~式(A.29)

    \[\sum_{i\in{I_{bzi}^t}}Y^t_{bzi}=1 \]

    \[\sum_{i\in{I_{ezi}^t}}Y^t_{ezi}=1 \]

    \[Y^t_{bzi},Y^t_{ezi}\in{\{0,1\}} \]

  • 引入價格集合(已知量),其中\(I^t_{bz}、I^t_{ez}\)為對應渠道的可選擇價格數量,\(i={1,2,...,I^t_{bz}}或i={1,2,...,I^t_{ez}}\)

\[\Omega^t_{bz}=\{P^t_{bzi}\}_{i\in{I^t_{bz}}} \]

\[\Omega^t_{ez}=\{P^t_{ezi}\}_{i\in{I^t_{ez}}} \]

  • 那麼有:\(P^t_{bz}=\sum_{i\in{I^t_{bz}}}P^t_{bzi}Y^t_{bzi}\)\(P^t_{ez}=\sum_{i\in{I^t_{ez}}}P^t_{ezi}Y^t_{ezi}\)

  • 此時,目標函式變為:

\[Max\quad{\sum_{t\in{T}}}\sum_{z\in{Z}}[\sum_{i\in{I^t_{bz}}}P^t_{bzi}Y^t_{bzi}\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})+\sum_{i\in{I^t_{ez}}}P^t_{ezi}Y^t_{ezi}\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})] \]

  • 目標函式中仍存在非線性項\(Y^t_{bzi}\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})\)\(Y^t_{ezi}\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})\)

    所以需要再引入下面決策變數,也就是式(A.6)~式(A.7)

    \[V^t_{bzi}=Y^t_{bzi}\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz}) \]

    \[V^t_{ezi}=Y^t_{ezi}\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz}) \]

    此時目標函式變為下式,也就是式(A.8) 的由來:

\[ Max\quad{\sum_{t\in{T}}}\sum_{z\in{Z}}[(\sum_{i\in{I^t_{bz}}}P^t_{bzi}V^t_{bzi})+(\sum_{i\in{I^t_{ez}}}P^t_{ezi}V^t_{ezi})] \]

\(\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})\)的上限為\(a\)\(\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})\)的上限為\(b\),要徹底轉換目標函式變為線性,需要增加新的約束如下,包含了式(A.15)-式(A.18)式(A.33)-式(A.34)

\[V^t_{bzi}\leq{a}Y^t_{bzi} \]

\[V^t_{ezi}\leq{b}Y^t_{ezi} \]

\[V^t_{bzi}\leq{\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})} \]

\[V^t_{ezi}\leq{\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})} \]

\[V^t_{bzi}\geq[{\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})}]-a(1-Y^t_{bzi}) \]

\[V^t_{ezi}\geq[{\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})}]-b(1-Y^t_{ezi}) \]

\[V^t_{bzi},V^t_{ezi}\geq{0} \]

\[\sum_{i\in{I^t_{bzi}}}V^t_{bzi}={\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})} \]

\[\sum_{i\in{I^t_{ezi}}}V^t_{ezi}=\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz}) \]

二、約束條件

  • 非線性項為\(D^t_{bz}(P^t_{z})\)\(D^t_{ez}(P^t_{z})\)

  • 經過上面的轉換,有:

    • \(e^{\beta_{0z}+\beta_{1z}P^t_{bz}}=e^{\beta_{0z}+\beta_{1z}\sum_{i\in{I^t_{bz}}}(P^t_{bzi}Y^t_{bzi})}\)其中,\(Y^t_{bzi}\)是一個0-1變數,所以又可以寫成:\(e^{\beta_{0z}+\beta_{1z}P^t_{bz}}=\sum_{i\in{I^t_{bz}}}Y^t_{bzi}e^{\beta_{0z}+\beta_{1z}P^t_{bzi}}\).

    • 同理,\(e^{\beta_{0z}+\beta_{1z}P^t_{ez}}=\sum_{i\in{I^t_{ez}}}Y^t_{ezi}e^{\beta_{0z}+\beta_{1z}P^t_{ezi}}\)

  • \[r^t_{bzi}=e^{\beta_{0z}+\beta_{1z}P^t_{bzi}} \]

    \[r^t_{ezi}=e^{\beta_{0z}+\beta_{1z}P^t_{ezi}} \]

    式(A.1)~式(A.2),那麼有:

    \[D^t_{bz}(P^t_z)=n^t_z×\frac{\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}}{\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}+\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}+1} \]

    \[D^t_{ez}(P^t_z)=n^t_z×\frac{\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}}{\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}+\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}+1} \]

  • 為了將\(D^t_{bz}(P^t_{z})\)\(D^t_{ez}(P^t_{z})\)化為線性,令:

    \[R^t_z=\frac{1}{\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}+\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}+1} \]

    式(A.3)。那麼\(D^t_{bz}(P^t_{z})=n^t_zR^t_z\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}\)\(D^t_{ez}(P^t_{z})=n^t_zR^t_z\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}\),需要明確的是:\(\sum_{i\in{I^t_{bz}}}Y^t_{bzi}r^t_{bzi}+\sum_{i\in{I^t_{ez}}}Y^t_{ezi}r^t_{ezi}\geq{0}\),故\(R^t_z\leq{1}\)

  • 此時仍存在非線性項\(\sum_{i\in{I^t_{bz}}}R^t_zY^t_{bzi}r^t_{bzi}\)\(\sum_{i\in{I^t_{ez}}}R^t_zY^t_{ezi}r^t_{ezi}\)

    令:

    \[U^t_{bzi}=R^t_zY^t_{bzi} \]

    \[U^t_{ezi}=R^t_zY^t_{ezi} \]

    式(A.4)-式(A.5)。此時需要新增的約束條件如下,包含了式(A.21)-式(A.27)式(A.32)-式(A.34)

    \[U^t_{bzi},U^t_{ezi}\geq{0} \]

    \[R^t_z\geq{0} \]

    \[U^t_{bzi}\leq{Y^t_{bzi}} \]

    \[U^t_{ezi}\leq{Y^t_{ezi}} \]

    \[U^t_{bzi}\leq{R^t_z} \]

    \[U^t_{ezi}\leq{R^t_z} \]

    \[U^t_{bzi}\leq{R^t_z}-(1-Y^t_{bzi}) \]

    \[U^t_{ezi}\leq{R^t_z}-(1-Y^t_{ezi}) \]

    \[\sum_{i\in{I^t_{bzi}}}U^t_{bzi}=R^t_z \]

    \[\sum_{i\in{I^t_{ezi}}}U^t_{ezi}=R^t_z \]

\[R^t_z+\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi}+\sum_{i\in{I^t_{ez}}}U^t_{ezi}r^t_{ezi}=1 \]

  • 此時約束條件(6)、(7)變為:

\[\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})\leq{n^t_z\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi}} \]

\[\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})\leq{n^t_z\sum_{i\in{I^t_{ez}}}U^t_{ezi}r^t_{ezi}} \]

  • 那麼\(a=n^t_z\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi}\)\(b=n^t_z\sum_{i\in{I^t_{ez}}}U^t_{ezi}r^t_{ezi}\)。約束\(V^t_{bzi}\leq{a}Y^t_{bzi}\)\(V^t_{ezi}\leq{b}Y^t_{ezi}\)分別變為:

    \[V^t_{bzi}\leq{(n^t_z\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi}})Y^t_{bzi}=n^t_zU^t_{bzi}\sum_{i\in{I^t_{bz}}}r^t_{bzi}Y^t_{bzi} \]

    \[V^t_{ezi}\leq{(n^t_z\sum_{i\in{I^t_{ez}}}U^t_{ezi}r^t_{ezi})}Y^t_{ezi}=n^t_zU^t_{ezi}\sum_{i\in{I^t_{ez}}}r^t_{ezi}Y^t_{ezi} \]

    • 已知\(V^t_{bzi}\geq{0}\),當\(Y^t_{bzi}=0\)時,上面的第一條約束條件變為\(V^t_{bzi}\leq{0}\),此時\(V^t_{bzi}\)應為0;當\(Y^t_{ezi}=1\)時,上面的約束條件變為\(V^t_{bzi}\leq{n^t_zU^t_{bzi}r^t_{bzi}}\),此時\(V^t_{bzi}\)的取值應當為\(0\leq{V^t_{bzi}}\leq{n^t_zU^t_{bzi}r^t_{bzi}}\)

      綜上和同理,在約束\(V^t_{bzi},V^t_{ezi}\geq{0}\)下,式(A.19)式(A.20) 被推匯出:

    \[V^t_{bzi}\leq{a}Y^t_{bzi}\quad{}→\quad{}V^t_{bzi}\leq{n^t_zU^t_{bzi}r^t_{bzi}} \]

    \[V^t_{ezi}\leq{b}Y^t_{ezi}\quad{}→\quad{}V^t_{bzi}\leq{n^t_zU^t_{bzi}r^t_{bzi}} \]

    • 對於約束條件\(V^t_{bzi}\geq[{\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})}]-a(1-Y^t_{bzi})\)\(V^t_{ezi}\geq[{\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})}]-b(1-Y^t_{ezi})\),它們分別變為:

      \[V^t_{bzi}\geq[{\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})}]-(n^t_z\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi})(1-Y^t_{bzi}) \]

      \[V^t_{ezi}\geq[{\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})}]-(n^t_z\sum_{i\in{I^t_{ez}}}U^t_{ezi}r^t_{ezi})(1-Y^t_{ezi}) \]

      \(Y^t_{bzi}=0\)時,上面第一條約束條件變為\(\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})\leq{n^t_z\sum_{i\in{I^t_{bz}}}U^t_{bzi}r^t_{bzi}}\)這與文中式(6)相同;當\(Y^t_{bzi}=1\)時,它則變為\(V^t_{bzi}=\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})\),而這又被約束條件\(\sum_{i\in{I^t_{bzi}}}V^t_{bzi}={\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})}\)包含。

      綜上及同理,約束條件\(V^t_{bzi}\geq[{\sum_{w\in{Z}}(S^t_{bwz}+S^t_{ewz})}]-a(1-Y^t_{bzi})\)\(V^t_{ezi}\geq[{\sum_{w\in{Z}}(O^t_{bwz}+O^t_{ewz})}]-b(1-Y^t_{ezi})\)均屬於重複約束,可被消除

由此,所有公式已全部被推出,但還多了兩條約束:

  • 對於約束條件\(U^t_{bzi}\leq{R^t_z}-(1-Y^t_{bzi})\)有:

    • \(Y^t_{bzi}=0\)時,\(R^t_z\geq{0}\),該約束已存在;\(Y^t_z=1\)時,\(U^t_{bzi}=R^t_{z}\),該約束已被\(\sum_{i\in{I^t_{bzi}}}U^t_{bzi}=R^t_z\)所包含。

    • 綜上及同理,約束條件\(U^t_{bzi}\leq{R^t_z}-(1-Y^t_{bzi})\)\(U^t_{ezi}\leq{R^t_z}-(1-Y^t_{ezi})\)屬於重複約束,均可被刪除

以上就是這篇論文公式全部的推導,上面是所使用的非線性化線性的方法簡例如下。

三、簡例

(1) 帶有0-1變數的非線性規劃問題

\[z=x_1x_2 \]

其中決策變數\(x_1\in{\{0,1\}}\),\(0\leq{x_2}\leq{a}\)

那麼我們可以用下面的方法化為線性規劃:

  • 首先設一個新的決策變數\(y=x_1x_2\),並將問題轉化為:

    \[y\leq{ax_1} \]

    \[y\leq{x_2} \]

    \[y\geq{x_2-a(1-x_1)} \]

    \[y\geq{0} \]

  • 由此,問題變為了線性問題

(2) 帶分母變數的非線性規劃問題

\[min\quad\frac{x+2y+3}{4x+5y} \]

\(s.t.\)

\[6x+7y\leq{8} \]

\[9x+10y\geq{0} \]

\[x,y\geq{0} \]

  • \(z=\frac{1}{4x+5y}\),此時目標函式變為:\((x+2y)z+3z\),但仍含有非線性項,此時我們又令:\(xz=u,yz=v\),那麼可以得到:

    \[min\quad{u+2v+3z} \]

    \(s.t.\)

    \[6u+7v\leq{8z} \]

    \[9u+10v\geq{0} \]

    \[u,v,z\geq{0} \]

  • 解上面的線性規劃問題,可得到\(u,v,z\)的精確解,之後可代入式子解方程,得到\(x,y\)的精確解。

相關文章