# ่ญ‰ๆ˜Ž 0โ€“1 Integer Programming Problem ็‚บ NP-Complete ## Exercises 34.5โ€“2 Given an integer ๐‘š ร— ๐‘› matrix ๐ด , and an integer ๐‘š-vector ๐‘, the 0-1 integer-programming problem asks whether there exists an integer ๐‘›-vector ๐‘ฅ with elements in the set {0, 1} such that ๐ด๐‘ฅ โ‰ค ๐‘. Prove that 0-1 integer programming problem is NP-complete (Hint: Reduce from 3-CNF-SAT.) ![](https://hackmd.io/_uploads/SyrhHAND3.png) ๅ•้กŒ๏ผšๆ˜ฏๅฆๅญ˜ๅœจไธ€ๅคงๅฐ็‚บ n ็š„ vector ๐‘ฅ๏ผˆ๐‘ฅ ไธญ็š„ๅ…ƒ็ด ็š†็‚บ0ๆˆ–1๏ผ‰ไฝฟๅพ— ๐ด๐‘ฅ โ‰ค ๐‘ ๏ผŸ 1. ่ญ‰ๆ˜Ž 0-1 IP โˆˆ NP ็ตฆๅฎšไธ€ๅคงๅฐ็‚บ n ็š„ vector ๐‘ฅ๏ผˆ๐‘ฅ ไธญ็š„ๅ…ƒ็ด ็š†็‚บ0ๆˆ–1๏ผ‰๏ผŒๆฌฒ้ฉ—่ญ‰ ๐ด๐‘ฅ โ‰ค ๐‘ ๆ˜ฏๅฆๆˆ็ซ‹๏ผŒๅช้œ€ๅฐ‡ ๐ด๐‘ฅ ็›ธไน˜๏ผŒไธฆๅฐ‡็ตๆžœ่ˆ‡ ๐‘ ไธ€ไธ€ๆฏ”ๅฐใ€‚ๆ™‚้–“่ค‡้›œๅบฆ็‚บ O(mn) + O(m)๏ผŒๅฏๆ–ผ polynomial time ๅฎŒๆˆใ€‚ 2. ่ญ‰ๆ˜Ž 3-CNF-SAT โ‰ค~p~ 0-1-IP ๆŠŠ3-CNF-SATๅ•้กŒ่ฝ‰ๆ›็‚บ0-1-IPๅ•้กŒ: - ๅ‡่จญ ฮฆ ๆœ‰ m clauses ๅ’Œ n variablesใ€‚ - ๆˆ‘ๅ€‘ๅฏไปฅๆŠŠๆฏๅ€‹ clause (๐‘ฅ~1~ โˆจ ยฌ๐‘ฅ~2~ โˆจ ยฌ๐‘ฅ~3~) ่ฝ‰ๆ›ๆˆไธ็ญ‰ๅผ ๐‘ฅ~1~ + (1 - ๐‘ฅ~2~) + (1 - ๐‘ฅ~3~) โ‰ฅ 1๏ผŒๅ†ๆ•ด็†็‚บ - ๐‘ฅ~1~ + ๐‘ฅ~2~ + ๐‘ฅ~3~ โ‰ค 1ใ€‚ - ้€้Ž่ง€ๅฏŸๅฏ็™ผ็พ๏ผŒๆฒ’ๆœ‰ๅš not ้‹็ฎ—็š„ variable ๆœƒไน˜ไธŠ -1๏ผŒๆœ‰็ถ“้Ž not ้‹็ฎ—็š„ variable ๅ‰‡ไน˜ไธŠ 1ใ€‚ - ่€Œไธ็ญ‰ๅผๅณ้‚Š็š„ๅ€ผ๏ผŒๅ‰‡็‚บ not ็š„ๆ•ธ้‡ - 1ใ€‚ - ๅพ—ๅ‡บ็Ÿฉ้™ฃ ๐ด ็š„่ฝ‰ๆ› Function: $$a_{i,j} = \left\{ \begin{aligned} -1 & & if \ x_j โˆˆ C_i\\ 1 & & if \ ยฌx_j โˆˆ C_i\\ 0 & & otherwise \end{aligned} \right.$$ - ่€Œ vector ๐‘ ็š„่ฝ‰ๆ›็‚บ: $$b_i = \sum\limits_{j = 1}^n{max(0, a_{i,j}) - 1}$$ ่ญ‰ๆ˜Žๅญ˜ๅœจไธ€ๅ€‹n-vector ๐‘ฅ: ๐ด๐‘ฅ โ‰ค ๐‘ โŸบ ฮฆใ€‚ ่ฝ‰ๆ›็š„ๆ™‚้–“่ค‡้›œๅบฆ็‚บO(mn)๏ผŒๅฏๆ–ผ polynomial time ๅฎŒๆˆใ€‚ ็”ฑ 1. ๅ’Œ 2. ๅฏๅพ—็Ÿฅ๏ผšๅฏไปฅๅฐ‡ 3-CNF-SAT ๅ•้กŒ reduce ๅˆฐ 0-1 Integer-Programming ๅ•้กŒ๏ผŒ0-1 Integer-Programming ๅ•้กŒ็‚บNP-Complete ๅ•้กŒใ€‚ Example: ฮฆ = (๐‘ฅ~1~ โˆจ ๐‘ฅ~2~ โˆจ ยฌ๐‘ฅ~3~) โˆง (๐‘ฅ~1~ โˆจ ๐‘ฅ~3~ โˆจ ๐‘ฅ~4~) โˆง (ยฌ๐‘ฅ~2~ โˆจ ยฌ๐‘ฅ~3~ โˆจ ยฌ๐‘ฅ~4~) $$ \left[ \begin{array}{cccc} -1 & -1 & 1 & 0 \\ -1 & 0 & -1 & -1 \\ 0 & 1 & 1 & 1 \end{array} \right] ร— \left[ \begin{array}{cccc} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array} \right] โ‰ค \left[ \begin{array}{cccc} 0 & -1 & 2 \end{array} \right] $$ > [name=ไป€้บผ] ็•ถๅˆๅฏซ้€™้กŒ็š„ๆ™‚ๅ€™็œ‹ๅพ—ๅพˆ็—›่‹ฆๆ‰€ไปฅ่ฉฆๅœ–้€ ็ฆๅพŒไบบใ„‰ๆˆ‘๏ผŒๅธŒๆœ›ๅฏไปฅๅนซไธŠๅฟ™ใ„› --- ๅƒ่€ƒ่ณ‡ๆ–™๏ผš[Proving 0-1 integer programming is NP-complete (using reduction from 3-CNF-SAT)](https://gnarlyware.com/blog/proving-0-1-integer-programming-is-np-complete-using-reduction-from-3-cnf-sat/)