建模线性化技巧学习笔记

逻辑或

  1. a T x ≤ c o r b T x ≥ d \mathbf{a^Tx} \leq c \quad or \quad \mathbf{b^Tx} \geq d aTxcorbTxd
    等价于
    a T x ≤ c + M ( 1 − u ) b T x ≥ d − M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \leq c + M(1-u) \\ \mathbf{b^Tx} \geq d -M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxc+M(1u)bTxdM(1v)u+v1u,v{0,1}

  2. a T x ≤ c o r b T x ≤ d \mathbf{a^Tx} \leq c \quad or \quad \mathbf{b^Tx} \leq d aTxcorbTxd
    等价于
    a T x ≤ c + M ( 1 − u ) b T x ≤ d + M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \leq c + M(1-u) \\ \mathbf{b^Tx} \leq d + M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxc+M(1u)bTxd+M(1v)u+v1u,v{0,1}

  3. a T x ≥ c o r b T x ≥ d \mathbf{a^Tx} \geq c \quad or \quad \mathbf{b^Tx} \geq d aTxcorbTxd
    等价于
    a T x ≥ c − M ( 1 − u ) b T x ≥ d − M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \geq c - M(1-u) \\ \mathbf{b^Tx} \geq d - M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxcM(1u)bTxdM(1v)u+v1u,v{0,1}

  4. a T x = c o r b T x = d \mathbf{a^Tx} = c \quad or \quad \mathbf{b^Tx} = d aTx=corbTx=d
    等价于
    a T x ≤ c + M ( 1 − u ) b T x ≤ d + M ( 1 − v ) , b T x ≥ d + M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \leq c + M(1-u)\\ \mathbf{b^Tx} \leq d + M(1-v), \mathbf{b^Tx} \geq d + M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxc+M(1u)bTxd+M(1v),bTxd+M(1v)u+v1u,v{0,1}

  5. a T x ≤ c o r b T x = d \mathbf{a^Tx} \leq c \quad or \quad \mathbf{b^Tx} = d aTxcorbTx=d
    等价于
    a T x ≤ c + M ( 1 − u ) b T x ≤ d + M ( 1 − v ) , b T x ≥ d + M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \leq c + M(1-u)\\ \mathbf{b^Tx} \leq d + M(1-v), \mathbf{b^Tx} \geq d + M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxc+M(1u)bTxd+M(1v),bTxd+M(1v)u+v1u,v{0,1}

  6. a T x ≥ c o r b T x = d \mathbf{a^Tx} \geq c \quad or \quad \mathbf{b^Tx} = d aTxcorbTx=d
    等价于
    a T x ≥ c − M ( 1 − u ) b T x ≤ d + M ( 1 − v ) , b T x ≥ d + M ( 1 − v ) u + v ≤ 1 u , v ∈ { 0 , 1 } \mathbf{a^Tx} \geq c - M(1-u)\\ \mathbf{b^Tx} \leq d + M(1-v), \mathbf{b^Tx} \geq d + M(1-v) \\ u+v \leq 1\\ u,v \in \{0,1\} aTxcM(1u)bTxd+M(1v),bTxd+M(1v)u+v1u,v{0,1}

if…elif…else…

情形1

i f if if A x − b ≤ 0 A\mathbf{x} - \mathbf{b} \leq 0 Axb0
t h e n then then C 1 x − b ≤ 0 C_1\mathbf{x} - \mathbf{b} \leq 0 C1xb0
e l s e else else C 2 x − b ≤ 0 C_2\mathbf{x} - \mathbf{b} \leq 0 C2xb0

等价于
A x − b ≤ ( 1 − u ) M C 1 x − d 1 ≤ ( 1 − u ) M C 2 x − d 2 ≤ u M u ∈ { 0 , 1 } \mathbf{Ax} - \mathbf{b} \leq (1-u)M\\ \mathbf{C}_1\mathbf{x} - \mathbf{d}_1 \leq (1-u)M\\ \mathbf{C}_2\mathbf{x} - \mathbf{d}_2 \leq uM\\ u\in\{0,1\} Axb(1u)MC1xd1(1u)MC2xd2uMu{0,1}

情形2

i f if if x ≥ y x \geq y xy
t h e n then then z = w 1 z = w_1 z=w1
e l s e else else z = w 2 z = w_2 z=w2

等价于
x ≥ y − M ( 1 − b ) x < y + M b w 1 − M ( 1 − b ) ≤ z ≤ w 1 + M ( 1 − b ) w 2 − M b ≤ z ≤ w 2 + M b b ∈ { 0 , 1 } x \geq y -M(1-b) \\ x < y + Mb\\ w_1-M(1-b) \leq z \leq w_1+M(1-b) \\ w_2-Mb \leq z \leq w_2+Mb\\b\in\{0,1\} xyM(1b)x<y+Mbw1M(1b)zw1+M(1b)w2Mbzw2+Mbb{0,1}

情形3

i f if if x > y x > y x>y
t h e n then then z = w 1 z = w_1 z=w1
e l s e else else z = w 2 z = w_2 z=w2

等价于
x > y + 0.0001 − M ( 1 − b ) x ≤ y + M b w 1 − M ( 1 − b ) ≤ z ≤ w 1 + M ( 1 − b ) w 2 − M b ≤ z ≤ w 2 + M b b ∈ { 0 , 1 } x > y+0.0001 -M(1-b) \\ x \leq y + Mb\\ w_1-M(1-b) \leq z \leq w_1+M(1-b) \\ w_2-Mb \leq z \leq w_2+Mb\\b\in\{0,1\} x>y+0.0001M(1b)xy+Mbw1M(1b)zw1+M(1b)w2Mbzw2+Mbb{0,1}

连续性表述

如果一个需求 j j j可以在各个节点 i i i切换状态,约束要求最多只能有1次状态切换,可以引入0-1变量表示 y j i y_{ji} yji状态是否切换变量, x j i x_{ji} xji表示需求 j j j在节点 i i i是否有某种情况,可以建立以下约束:
y j i ≥ x j i − x j ( i − 1 ) , ∀ i ∈ I , ∀ j ∈ J ∑ i y j i ≤ 1 , ∀ j ∈ J x j i ∈ { 0 , 1 } , y j i ∈ { 0 , 1 } y_{ji} \geq x_{ji}-x_{j(i-1)} , \quad \forall i \in I, \forall j \in J\\ \sum_{i} y_{ji}\leq1, \quad \forall j \in J\\ x_{ji} \in \{0,1\},\quad y_{ji} \in \{0,1\} yjixjixj(i1),iI,jJiyji1,jJxji{0,1},yji{0,1}
可以借用这个表格来进行解释
可以表示以下几种情况

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值