Chapter 8 NP-complete problems课后习题8.16

题目

We are feeling experimental and want to create a new dish. There are various ingredients we can choose from and we’d like to use as many of them as possible, but some ingredients don’t go well with others. If there are n possible ingredients (numbered 1 to n), we write down an n x n matrix giving the discord between any pair of ingredients. This discord is a real number
between 0.0 and 1.0, where 0.0 means “they go together perfectly” and 1.0 means “they really don’t go together.” Here’s an example matrix when there are five possible ingredients.
这里写图片描述

In this case, ingredients 2 and 3 go together pretty well whereas 1 and 5 clash badly. Notice that this matrix is necessarily symmetric; and that the diagonal entries are always 0.0. Any set of ingredients incurs a penalty which is the sum of all discord values between pairs of ingredients. For instance, the set of ingredients {1; 3; 5} incurs a penalty of 0.2+1.0+0.5 = 1.7. We want this penalty to be small.

EXPERIMENTAL CUISINE
Input: n, the number of ingredients to choose from; D, the n x n “discord” matrix; some number p > 0
Output: The maximum number of ingredients we can choose with penalty p.
Show that if EXPERIMENTAL CUISINE is solvable in polynomial time, then so is 3SAT.

证明

3SAT
3SAT问题为输入是一个子句集,每个子句包含不超过3个文字。3SAT的一个实例形如 (x¯yz¯)(xy¯z)(xyz)(x¯y¯) 。目标是求一个它的可满足赋值或判定该赋值不存在。

考虑把3SAT问题转换成EXPERIMENTAL CUISINE问题。
假设对于任何一个3SAT问题,它由n个子句组成,表示为ABC…
假设其中一个子句A= (xyz) ,则我们可以得到7个ingredients,它们代表使A成立的7种不同情况,分别表示为 xyzA xyz¯A xy¯zA xy¯z¯A x¯yzA x¯yz¯A x¯y¯zA 。但是这7种情况是不可能同时成立的,因此这7种ingredients两两间的discord设为1。
对于不同子句的ingredients,将它们之间有冲突的ingredients的discord设为1,无冲突的为0。比如,设另一个子句C= (mnx) , 则 xyzA mnxC 没有冲突可以同时为真,discord设为0。 xyzA mnx¯C 存在冲突不可能同时为真,discord设为1。
若p=0时,能选择到的ingredients总数等于子句总数n,则说明该3SAT能满足,有解。这样就把3SAT问题转换成EXPERIMENTAL CUISINE问题来求解了。

求解EXPERIMENTAL CUISINE问题时,对于一个ingredient,如果把它加入选择中,p的大小不超过设定值,则可以选择,否则不可以。每次判断都是多项式时间的,经过多项式次数的判断可以得到结果,那么整个过程是可以在多项式时间内完成的。
因此,若EXPERIMENTAL CUISINE在多项式的时间内可解,3SAT亦然。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值