*To*: debian-newmaint@lists.debian.org*Subject*: Re: Miriam Ruiz advocation*From*: Anthony Towns <aj@azure.humbug.org.au>*Date*: Sat, 3 Nov 2007 13:51:33 +1000*Message-id*: <[🔎] 20071103035133.GA24107@blae.erisian.com.au>*Mail-followup-to*: debian-newmaint@lists.debian.org*In-reply-to*: <[🔎] 20071102212353.GA11914@riseup.net>*References*: <20071028083830.GA20670@ouaza.com> <1193575508.5381.303.camel@pluto.hgc.intranet> <871wbf1jn6.fsf@debian.org> <1193580950.5381.382.camel@pluto.hgc.intranet> <87tzobz4r6.fsf_-_@debian.org> <1193583716.5381.408.camel@pluto.hgc.intranet> <20071029230842.GA28900@pryan.sytes.net> <20071030100030.GD2181@aenima> <[🔎] 20071102204905.GA8924@enricozini.org> <[🔎] 20071102212353.GA11914@riseup.net>

On Fri, Nov 02, 2007 at 05:23:53PM -0400, Micah Anderson wrote: > [...] formal proofs of the problem of migrating an > optimal set of packages to testing as a np-complete problem [...] Checking installability is an NP-complete problem. Proof: Installability of a package P from a set of packages S with dependency relationships D and conflict relationships C is defined as there being a subset I of S, P is in I, no two packages in I conflict, and the dependency relations of all packages in I are satsified by other packages in I. In order to prove this is NP, we show this is a subset of the SAT problem, which is known to be NP-complete. We do this by relating each package in S to a boolean that is true if the package is also in I, and false otherwise. We relate each dependency, p Depends: x | y | z, w to the logical statements: not(p) or x or y or z not(p) or w and each conflict, p Conflicts: x, y to the logical statements: not(p) or not(x) not(p) or not(y) and finally we indicate P should be in I: p Finding a solution via SAT for the truth value of each variable thus gives us a set I which satisfies all the requirements. So the installability is NP. To show installability is also NP-hard (and thus is NP-complete), we reduce 3SAT, which is know to be NP-hard, to an installability problem. 3SAT finds truth values for a set of variables, given expressions of the form: (x or y or z) where x, y and z are variables or their negations. Making the negations explicit gives only the following possibilities: (x or y or z) (!x or y or z) (!x or !y or z) (!x or !y or !z) In order to reduce this to an installability problem (expressed in terms of a set of packages, a package to be tested for installability, and a set of conflicts/depends relationships). As before, we relate each variable to a package, and its truth value to whether it is in the set I. We also introduce an additional package, P, and add a set of nega-packages Nx for each x. Each expression is converted as follows: (x or y or z) -> P Depends: x | y | z (!x or y or z) -> x Depends: y | z (!x or !y or z) -> x Depends: Ny | z (!x or !y or !z) -> P Depends: Nx | Ny | Nz In addition for each package x, Nx Conflicts: x. That gives a polynomial conversion of 3SAT to installability testing, proving correctness of the solution is left as an exercise to the reader (what did you think the margin to the left was for?). Since installability is both NP and NP-hard, it follows by definition, that it's NP-complete. Finding an optimal set of packages to move to testing is thus NP-hard (since it implies the solution to a bunch of NP-complete installability problems). I'm not sure if it's also NP though, but hey, I guess applicants have to have *something* left to prove, right? :) In any event, the current implementation is greedy (something goes into testing? add it!) rather than optimising (these three packages could go in, /or/ these four packages could), and tends to leave the hard problems to the RMs anyway, so "optimal" might be a bit misleading compared to reality. Cheers, aj

**Attachment:
signature.asc**

**Follow-Ups**:**Checking installability is an NP-complete problem***From:*Mike O'Connor <stew@vireo.org>

**References**:**Re: Miriam Ruiz advocation***From:*Enrico Zini <enrico@enricozini.org>

**Re: Miriam Ruiz advocation***From:*Micah Anderson <micah@riseup.net>

- Prev by Date:
**Re: Miriam Ruiz advocation** - Next by Date:
**NM Report for Week Ending 04 Nov 2007** - Previous by thread:
**Re: Miriam Ruiz advocation** - Next by thread:
**Checking installability is an NP-complete problem** - Index(es):