Solving Numerical NP-complete Problems with Spiking Neural P Systems Dipartimento di Informatica, Sistemistica e Comunicazione Università degli Studi di Milano – Bicocca WMC 8 Thessaloniki, June 25 – 28, 2007 Alberto Leporati Claudio Zandron Claudio Ferretti Giancarlo Mauri {leporati, zandron, ferretti,
WMC 8 - Thessaloniki - June 25-28, Talk outline Spiking Neural (SN) P systems standard version an extended version Computational power of SN P systems universality (Turing completeness) nondeterminism, determinism, maximal parallelism Solving NP-complete problems with nondeterministic SN P systems 3-SAT vs. numerical problems (Subset Sum et al.) conversion from binary to unary, and back Uniform family of SN P systems that solves Subset Sum with instances encoded in binary form Directions for further research
WMC 8 - Thessaloniki - June 25-28, Standard SN P systems An SN P system of degree m 1 is a construct: (O, 1, 2, …, m, syn, in) where: O {a} is the singleton alphabet cells (neurons) i (n i, R i ) are placed in the nodes of the synapse graph syn, where: n i 0 : initial contents R i : finite set of rules syn {1,2,…,m} {1,2,…,m} : directed graph of synapses, without self-loops in {1,2,…,m} : input neuron
WMC 8 - Thessaloniki - June 25-28, Standard SN P systems The rules can be: firing rules: E/a c a; d with c 1, d 0 integers (if E a c we simply write a c a; d ) forgetting rules: a s with s 1 and a s L(E) for any firing rule E/a c a; d in the neuron initial configuration: n 1, n 2, …, n m spikes in the neurons all neurons are open configuration (during computations): for each neuron: number of spikes in the neuron number of steps to wait until the neuron becomes open
WMC 8 - Thessaloniki - June 25-28, Standard SN P systems Computation of f: the system starts in the initial configuration input n enters in in, encoded as the time elapsed between two spikes (unary notation) computation proceeds sequentially in every neuron, and in parallel between the neurons if 2 rules can be applied in a neuron, a nondeterministic choice is made the system is deterministic if L(E i ) L(E j ) = for all i j if the system halts, then the output f(n) is read as the time elapsed between the first two spikes emitted by the system
WMC 8 - Thessaloniki - June 25-28, Standard SN P systems (Already) many variants/possibilities: different halting conditions different ways to encode input and output values (ex: number of spikes) different ways to compute f: directly (spike trains in input and output) through bijections ( and ) generative case: we ignore the input accepting case: we ignore the output
WMC 8 - Thessaloniki - June 25-28, Description size Description size of : number of bits required to represent it: no bits for the alphabet m 2 bits for the synapse graph in (and out ): lg m bits for every neuron i : n i N lg N bits at most R rules; for each rule E/a c a; d o type {firing, accepting} 1 bit o regular expression E size S bits o two numbers 2 lg N bits m lg m + m (lg N + R (1 + S + 2 lg N)) bits
WMC 8 - Thessaloniki - June 25-28, Description size Remark: we work with unary languages every string is bijectively associated with its length a compact representation of E works on the lengths regular expressions on natural numbers union and Kleene star are computed as usual L 1 L 2 : all numbers of L 1 are summed with those of L 2 in all possible ways Example: {2,3} {2,5} = {4,5,7,8}
WMC 8 - Thessaloniki - June 25-28, Computational power SN P systems are universal (Turing complete) also if we remove forgetting rules or delays also if the outdegree of syn is 2 also with regular expressions of very simple forms nondeterministic systems are able to solve 3-SAT deterministic systems with regular expressions of very restricted forms can be simulated by DTM with a polynomial slowdown using general regular expressions, choosing the rule to apply is at least as difficult as solving Subset Sum
WMC 8 - Thessaloniki - June 25-28, The 3-SAT problem variables X = {x 1, x 2, …, x n } literal X i : directed ( x i ) or negated ( x i ) variable 3-clause: disjunction of exactly three literals assignment: function a : X { false, true } The 3-SAT problem: instance: set C = {C 1,C 2,…,C m } of 3-clauses built on X (equiv., = C 1 C 2 … C m ) question: is there an assignment which satisfies all the clauses? (equiv., which satisfies ) Note: m (2n) 3 = 8n 3
WMC 8 - Thessaloniki - June 25-28, Solving 3-SAT with SN P systems a “circuit” with four layers first two layers: one module for each variable This appears only once
WMC 8 - Thessaloniki - June 25-28, Solving 3-SAT with SN P systems next two layers: one module for each variable semi-uniform solution generative approach solution given in constant time
WMC 8 - Thessaloniki - June 25-28, Deterministic SN P systems explicit simulation by DTMs given in the Technical Report of the last Brainstorming t steps of any deterministic SN P system can be simulated in poly(t, Description size) steps of a DTM crucial assumption: regular expressions are of very restricted form, for example : a i, with i 3 a(aa) + (the membership problem must be polynomial also the succint version)
WMC 8 - Thessaloniki - June 25-28, The Subset Sum problem instance: a (multi)set V = {v 1,v 2,…,v n } of positive integer values a positive integer value S question: is there a sub(multi)set A V such that numerical, pseudo-polynomial NP-complete problem instance size: let K = max{v 1,v 2,…,v n, S} each number requires lg K bits to be represented total size: (n lg K)
WMC 8 - Thessaloniki - June 25-28, Solving Subset Sum with SN P systems let ({v 1,v 2,…,v n }, S) be an instance of Subset Sum consider the languages (in succint form): L i = {0,v i }, for i {1,2,…,n} let L = L 1 L 2 … L n membership problem: is S L ? the answer is yes if and only if the instance of Subset Sum is positive deciding whether the rule E/a c a; d can be applied, when L = L(E) and the neuron contains S spikes, can be difficult (hidden power)
WMC 8 - Thessaloniki - June 25-28, Extending SN P systems Differences with traditional SN P systems: we allow rules of type E/a c a p ; d with c 1, p 0, d 0 p = 1 : traditional rules p = 0 : forgetting rules no mutual exclusion between firing and forgetting rules output neuron ( out ); if out = 0, then the output is sent to the environment different interpretations of output: number of spikes in a given time interval number of spikes contained in out
WMC 8 - Thessaloniki - June 25-28, Solving Subset Sum with SN P systems
WMC 8 - Thessaloniki - June 25-28, Solving Subset Sum with SN P systems generative system semi-uniform approach (input encoded both in the initial configuration and in the structure of the system) solution given in constant time nondeterminism: at least one computation chooses the correct v i, if possible (again magic power) in particular, we don’t like: rules operate on large ( O(K) ) numbers of spikes the initial configuration contains O(nK) spikes
WMC 8 - Thessaloniki - June 25-28, Dynamic programming solution boolean matrix M[1..n, 0..S] M[i, j] = 1 there exists B {v 1,…,v i } such that space and time complexity: (nK) solution
WMC 8 - Thessaloniki - June 25-28, Dynamic programming solution pseudo-code:
WMC 8 - Thessaloniki - June 25-28, Encoding inputs in binary form : a k -bit non-negative integer number usual binary encoding using k consecutive time steps; at time k–1–j (with j {0,1,…, k–1} ): presence of a spike if and only if N j = 1 conversion from binary to unary (next slide) N enters the system starting from msb one (undesired) spike is produced at the 2 nd step at the end of the k -th step, neuron j contains 2 j spikes if N j = 1, and 0 spikes otherwise at the ( k +1)-th step, neuron out becomes open and receives N spikes
WMC 8 - Thessaloniki - June 25-28, Encoding inputs in binary form maximal parallelism: one of the active rules is nondetermi- nistically chosen and is applied as many times as possible
WMC 8 - Thessaloniki - June 25-28, Solving Subset Sum (2 nd version) these rules remove spurious spikes instance (V, S) is positive if and only if one spike is emitted at the (2k+2) -nd step
WMC 8 - Thessaloniki - June 25-28, Solving Subset Sum (2 nd version) we can also use two neurons in the last layer nondeterministic and semi-uniform solution rules depend on the value of S idea: read also S in binary convert it compare it with spike if equal A better idea: keep S in binary form convert sum of B from unary to binary perform a bit-by-bit comparison
WMC 8 - Thessaloniki - June 25-28, Conversion from unary to binary uses maximal parallelism at each step, an integer division by 2 is performed the result is propagated the remainder stays in the current neuron
WMC 8 - Thessaloniki - June 25-28, Conversion from unary to binary The conversion cannot be performed in polynomial time t(k) without using maximal parallelism regular expressions of restricted forms Q = max number of spikes produced by any rule the number of spikes is incremented at most by mQ units at each computation step M spikes in the initial configuration Hence, at most M + mQt(k) spikes after t(k) steps a polynomial quantity !
WMC 8 - Thessaloniki - June 25-28, Uniform solution of Subset Sum the output has to be observed exactly after 3k+6 steps length of delay subsystem: 3k+2 steps
WMC 8 - Thessaloniki - June 25-28, family { ( n,k )} n,k such that for all n,k , ( n,k ) solves all possible instances ({v 1,…,v n }, S) where v 1,…,v n, S are all k -bit natural numbers the number of neurons and of rules is polynomial in n and k some spurious spikes may be emitted before the result the delay subsystem: Uniform solution of Subset Sum
WMC 8 - Thessaloniki - June 25-28, The Comparison subsystem emits one spike if and only if the two numbers given in input (expressed in binary form) are equal the subsystem computes the following boolean function:
WMC 8 - Thessaloniki - June 25-28, Conclusions and future research nondeterministic SN P systems solve NP-complete problems such as 3-SAT deterministic SN P systems with simple regexp can be simulated by Turing machines with a polynomial slowdown deterministic SN P systems with general regexp solve NP-complete problems such as Subset Sum Hence it should be interesting to investigate: influence of regular unary languages on the computational power of SN P systems the role of maximal parallelism (and different flavors of it)
WMC 8 - Thessaloniki - June 25-28, Last slide ! Thanks for your attention !