简体   繁体   中英

Why solving Knapsack problem is not considered as linear programming?

尽管Knapsack问题陈述似乎与线性规划中的问题类似,但为什么线性规划算法类别中不包括背包问题?

Knapsack can be written as an integer linear programming program. Unlike normal linear programming, this problem requires that variables in the solution are integers. Linear programming is known to be solvable in polynomial time, while integer linear programming is NP-complete.

Exercise for the reader: show that 3SAT can be reduced to integer linear programming.

Trivia: there are approximation algorithms for problems such as MAX-3SAT (a variant of 3SAT where we want to maximize the number of satisfied clauses). First you write MAX-3SAT as an integer linear program. Then, you relax it to linear program, by removing the integer restriction. Then, you solve the linear program in polynomial time. Finally, given real x i ∈ [0,1], you round them to integers, or generate random integer solution y i where probability of y i = 1 is x i .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM