Why solving Knapsack problem is not considered as linear programming?

心不动则不痛 提交于 2019-12-21 03:49:30

问题


Why isn't the knapsack problem included under the category of linear programming algorithms in spite of the fact that the Knapsack problem statement seems similar to the problems in linear programming?


回答1:


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 xi ∈ [0,1], you round them to integers, or generate random integer solution yi where probability of yi = 1 is xi.



来源:https://stackoverflow.com/questions/11600524/why-solving-knapsack-problem-is-not-considered-as-linear-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!