Exercises 8.16 (week17)

week17

题目

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 * 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 * 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问题,若其某一子句s为这里写图片描述,我们可以建立7种ingredients代表使得子句s成立的不同情况,它们分别为这里写图片描述。它们之间是完全不兼容的,因此将两两之间的discord值设为1。
然后是子句之间的情况,对于任意两个子句i和j,将它们中相矛盾的成分之间的discord设为1。设子句总数为n,令p=0,如果此时能选择的ingredient的数目为n,那么说明该3SAT能满足。
判断一个3SAT能否满足与找出这个3SAT的解这两个问题实际上是等价的,因此如果EXPERIMENTAL CUISINE在多项式时间内可解的话,3SAT也是可解的。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值