{ "url": "http://arxiv.org/abs/2404.16540v1", "title": "Approximation Algorithm of Minimum All-Ones Problem for Arbitrary Graphs", "abstract": "Let $G=(V, E)$ be a graph and let each vertex of $G$ has a lamp and a button.\nEach button can be of $\\sigma^+$-type or $\\sigma$-type.\n Assume that initially some lamps are on and others are off. The button on\nvertex $x$ is of $\\sigma^+$-type ($\\sigma$-type, respectively) if pressing the\nbutton changes the lamp states on $x$ and on its neighbors in $G$ (the lamp\nstates on the neighbors of $x$ only, respectively). Assume that there is a set\n$X\\subseteq V$ such that pressing buttons on vertices of $X$ lights all lamps\non vertices of $G$. In particular, it is known to hold when initially all lamps\nare off and all buttons are of $\\sigma^+$-type.\n Finding such a set $X$ of the smallest size is NP-hard even if initially all\nlamps are off and all buttons are of $\\sigma^+$-type. Using a linear algebraic\napproach we design a polynomial-time approximation algorithm for the problem\nsuch that for the set $X$ constructed by the algorithm, we have $|X|\\le\n\\min\\{r,(|V|+{\\rm opt})/2\\},$ where $r$ is the rank of a (modified) adjacent\nmatrix of $G$ and ${\\rm opt}$ is the size of an optimal solution to the\nproblem.\n To the best of our knowledge, this is the first polynomial-time approximation\nalgorithm for the problem with a nontrivial approximation guarantee.", "authors": "Chen Wang, Chao Wang, Gregory Z. Gutin, Xiaoyan Zhang", "published": "2024-04-25", "updated": "2024-04-25", "primary_cat": "cs.DS", "cats": [ "cs.DS", "cs.DM" ], "label": "Original Paper", "paper_cat": "Knowledge AND Graph", "gt": "Let $G=(V, E)$ be a graph and let each vertex of $G$ has a lamp and a button.\nEach button can be of $\\sigma^+$-type or $\\sigma$-type.\n Assume that initially some lamps are on and others are off. The button on\nvertex $x$ is of $\\sigma^+$-type ($\\sigma$-type, respectively) if pressing the\nbutton changes the lamp states on $x$ and on its neighbors in $G$ (the lamp\nstates on the neighbors of $x$ only, respectively). Assume that there is a set\n$X\\subseteq V$ such that pressing buttons on vertices of $X$ lights all lamps\non vertices of $G$. In particular, it is known to hold when initially all lamps\nare off and all buttons are of $\\sigma^+$-type.\n Finding such a set $X$ of the smallest size is NP-hard even if initially all\nlamps are off and all buttons are of $\\sigma^+$-type. Using a linear algebraic\napproach we design a polynomial-time approximation algorithm for the problem\nsuch that for the set $X$ constructed by the algorithm, we have $|X|\\le\n\\min\\{r,(|V|+{\\rm opt})/2\\},$ where $r$ is the rank of a (modified) adjacent\nmatrix of $G$ and ${\\rm opt}$ is the size of an optimal solution to the\nproblem.\n To the best of our knowledge, this is the first polynomial-time approximation\nalgorithm for the problem with a nontrivial approximation guarantee.", "main_content": "Introduction The all-ones problem is a fundamental problem in applied mathematics, first proposed by Sutner in 1988 [17]. This problem has applications in linear cellular automata, as discussed in [18] and the references therein. To illustrate the problem, consider an n \u00d7 n grid with each area having a light lamp and a switch, and every lamp is initially off. Turning the switch on in some area lights the lamp in the area and the lamps in neighboring areas. Is there a set X of areas such that turning the switches on in X will turn on all the lamps? This problem can be extended to all graphs and we will call it the all-ones problem. Sutner [18] proved that a solution X exists for every graph. Later, several simple proofs of this result were given or rediscovered [3, 5, 7, 10, 13]. Many variants of the all-ones problem have been introduced and studied [1, 2, 6, 7, 11, 12, 19] over years. There are two important generalizations of the all-ones problem: (i) the initial state of lamps and switches can be arbitrary, \u2217Corresponding author. Email addresses: 2120220677@mail.nankai.edu.cn (Chen Wang), wangchao@nankai.edu.cn (Chao Wang), gutin@cs.rhul.ac.uk (Gregory Z. Gutin), xiaoyanice@aliyun.com (Xiaoyan Zhang) 1 arXiv:2404.16540v1 [cs.DS] 25 Apr 2024 \fChen Wang et al. / Theoretical computer science 00 (2024) 1\u20138 2 i.e., some are on and the others are off, and (ii) every switch can be either of \u03c3+-type which changes the states of the lamp on its vertex and the lamps on the neighbors of its vertex or \u03c3-type which changes the states of the lamps on the neighbors of its vertex only. As a result of these two generalizations, the generalized all-ones problem may not have a solution X which lights all lamps. This generalized problem is studied in this paper. Under the condition that such a solution X exists for the generalized all-ones problem, it is natural to ask for X of minimum size. Unfortunately, this minimization problem is NP-hard even for all-ones problem [16]; we will call the minimization all-ones problem the min all-ones problem. Galvin and Lu both proved that the min all-ones problem of trees can be solved in linear time [9, 14]. Building on this, Chen proposed an algorithm for solving the min generalized allones problem on trees, with linear complexity [4]. Manuel et al. provided solutions for some of the widely studied architectures, such as binomial trees, butterfly, and benes networks [15]. Fleischer and Yu provided a detailed survey of the generalized all-ones problem [8]. More recently, Zhang extended the all-ones problem to the all-colors problem, in which each lamp had other states besides being on and off, and obtained additional findings on the all-colors problem [20]. Although significant research has been conducted on the all-ones problem on special graphs, such as trees, resulting in efficient algorithms, no polynomial-time approximation algorithms have been designed for the min all-ones problem on general graphs. Trees and cyclic graphs only represent a fraction of general graphs. In practical engineering scenarios, complex graphs are more common. In this paper, we design a polynomial-time approximation algorithm for the min generalized all-ones problem. If the problem has a solution, our algorithm outputs a solution X such that |X| \u2264min{r, (|V| + opt)/2}, where the rank of a (modified) adjacent matrix of G and opt is the size of an optimal solution to the problem. Apart from the introduction, this paper contains three sections. In Section 2, we introduce our approximation algorithm in detail. Section 3 shows the theoretical analysis and performance evaluation of this algorithm. Section 4 summarizes all the work of this paper and discusses future work. 2. Approximation algorithm of min generalized all-ones problem 2.1. Linear algebraic formulation of min generalized all-ones problem It is not hard to see that the min generalized all-ones problem can be described as the following linear integer program over F2. For an arbitrary graph G = (V, E) with V = {v1, . . . , vn} we can get its modified adjacency matrix A = (aij)n\u00d7n such that for all i , j, aij = 1 if vivj \u2208E and ai j = 0 otherwise, and for all i \u2208{1, 2, . . . , n}, aii = 1 (aii = 0, respectively) if the switch on vi is of \u03c3+-type (of \u03c3-type, respectively). Combined with the initial state B = (b1, b2, \u00b7 \u00b7 \u00b7 , bn), where bi = 0 if the lamp on vertex vi is initially on and bi = 1 if the lamp is initially off, we can construct a system of linear equations AU = B over F2. The solution to this problem is the minimum of P U = Pn i=1 ui. Suppose the rank of A is r and the corank is m so that m + r = n. If aii = 1 for all i \u2208{1, 2, \u00b7 \u00b7 \u00b7 , n}, the system of equations AU = B must have a solution, but if aii = 0, the system may not necessarily have a solution. However, as long as the system has at least one solution \u03b3 = (\u03b31, \u03b32, \u00b7 \u00b7 \u00b7 , \u03b3n)T, we can find all solutions of the system using the following system combining \u03b3 with the fundamental solution set \u03b7 = (\u03b71, \u03b72, \u00b7 \u00b7 \u00b7 , \u03b7m) within time O(n3). Here xi is the coefficient of the column vector \u03b7i = (\u03b71i, . . . , \u03b7ni)T. \u03b7X + \u03b3 = \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b711 \u03b712 \u00b7 \u00b7 \u00b7 \u03b71m \u03b721 \u03b722 \u00b7 \u00b7 \u00b7 \u03b72m \u03b731 \u03b732 \u00b7 \u00b7 \u00b7 \u03b73m . . . . . . ... . . . \u03b7n1 \u03b7n2 \u00b7 \u00b7 \u00b7 \u03b7nm \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 x1 x2 . . . xm \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe + \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b31 \u03b32 \u03b33 . . . \u03b3n \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe (1) The problem is how to find the appropriate column vector X to minimize P U, under the condition that X has a total of 2m values. This problem was proven to be an NP-complete [16]. Therefore, the next subsection provides an approximation algorithm running in polynomial time. 2 \fChen Wang et al. / Theoretical computer science 00 (2024) 1\u20138 3 2.2. Approximation algorithm Firstly, it can be observed that the polynomial time complexity (not exceeding O(n3)) of finding the matrix (\u03b71, \u03b72, \u00b7 \u00b7 \u00b7 , \u03b7m) and the special solution \u03b3 makes this process cost-effective in solving NP-complete problems. Secondly, it is challenging to identify alternative methods capable of directly computing the optimal solution without obtaining all the solutions. Even if such a solution is obtained, verification is often infeasible. When \u03b7 and \u03b3 are known, we need to find the X that minimizes P U. \u03b7X + \u03b3 = \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b711 \u03b712 \u00b7 \u00b7 \u00b7 \u03b71m \u03b721 \u03b722 \u00b7 \u00b7 \u00b7 \u03b72m \u03b731 \u03b732 \u00b7 \u00b7 \u00b7 \u03b73m . . . . . . ... . . . \u03b7n1 \u03b7n2 \u00b7 \u00b7 \u00b7 \u03b7nm \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 x1 x2 . . . xm \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe + \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b31 \u03b32 \u03b33 . . . \u03b3n \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe = \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b41 \u03b42 \u03b43 . . . \u03b4n \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe + \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03b31 \u03b32 \u03b33 . . . \u03b3n \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe = \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 u1 u2 u3 . . . un \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe (2) Proposition 2.1. Row exchanges of matrix \u03b7 do not change P U. Proof. Multiply both sides of Equation 2 by matrix P as shown in Equation 3. Matrix P is a product of elementary matrices that perform row exchanges. This operation essentially reorders the elements of vector U, but does not change the P U. P(\u03b7X + \u03b3) = P(\u03b4 + \u03b3) = PU (3) Proposition 2.2. Column transformation of matrix \u03b7 does not change P U. Proof. Let Qm\u2217m be a full rank matrix, and QZ = X, with the following equation. \u03b7X + \u03b3 = \u03b7QZ + \u03b3 = (\u03b7Q)Z + \u03b3 = \u03f5Z + \u03b3 = \u03b4 + \u03b3 = U (4) Q is the transition matrix between X and Z, and Q is full rank. When we find that X makes P U the smallest, we can definitely find the corresponding Z, so that the obtained U is the same. We can transform the \u03b7 column into an echelon form using row exchanges and column transformations, as shown in the following equation, with a complexity of O(m2n). The question mark indicates that the value of the number is uncertain, which may be 0 or 1. We can divide the matrix into m + 1 parts based on the echelon and assume the last line of the i-th part is line ki (i = 0, 1, \u00b7 \u00b7 \u00b7 , m) for the rank of matrix \u03b7 is always m. Part 0 is the most special, with all 3 \fChen Wang et al. / Theoretical computer science 00 (2024) 1\u20138 4 elements in each row being 0. To ensure that Equation 4 holds, there should be (u1, u2, \u00b7 \u00b7 \u00b7 , uk0) = (\u03b31, \u03b32, \u00b7 \u00b7 \u00b7 , \u03b3k0). \u03b7Q = \u03f5 = \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 0 0 0 0 \u00b7 \u00b7 \u00b7 0 . . . . . . . . . . . . ... . . . 1 0 0 0 \u00b7 \u00b7 \u00b7 0 1 0 0 0 \u00b7 \u00b7 \u00b7 0 . . . . . . . . . . . . ... . . . \u03f5(k1+1)1 1 0 0 \u00b7 \u00b7 \u00b7 0 \u03f5(k1+2))1 1 0 0 \u00b7 \u00b7 \u00b7 0 . . . . . . . . . . . . ... . . . \u03f5(k2+1)1 \u03f5(k2+1)2 1 0 \u00b7 \u00b7 \u00b7 0 \u03f5(k2+2)1 \u03f5(k2+2)2 1 0 \u00b7 \u00b7 \u00b7 0 . . . . . . . . . . . . ... . . . \u03f5km1 \u03f5km2 \u03f5km3 \u03f5km4 \u00b7 \u00b7 \u00b7 1 \uf8fc \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fd \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8fe (5) In the following m parts, we will use greedy algorithms to solve for the Z value on the Echelon of each part. Part 1 of the linear Equation 5 is shown in Equation 6. (\u03b3k0+1, \u03b3k0+2, \u00b7 \u00b7 \u00b7 , \u03b3k1) is known and (\u03b4k0+1, \u03b4k0+2, \u00b7 \u00b7 \u00b7 , \u03b4k1) is unknown. It is important to ensure that \u03b4i is as similar to \u03b3i as possible. At this moment z1 only has two possible values: 0 and 1. Therefore, the idea of a greedy algorithm is adopted here. If there are more 0\u2019s than 1\u2019s in the range from \u03b3k0+1 to \u03b3k1, then z1 is set to 0. If there are more 1\u2019s than 0\u2019s, then z1 is set to 1. Therefore, we can directly obtain the value of x1 by solving it here, while ensuring that Pk1 i=k0+1 ui \u2264(k1 \u2212k0)/2. \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 z1 = \u03b4k0+1 z1 = \u03b4k0+2 z1 = \u03b4k0+3 . . . z1 = \u03b4k1 Compare to \u03b3k0+1 \u03b3k0+2 \u03b3k0+3 . . . \u03b3k1 (6) The value of z2 can be calculated through z1. Part 2 of Equation 5 can be written as shown in Equation 7. (\u03b3k1+1, \u03b3k1+2, \u00b7 \u00b7 \u00b7 , \u03b3k2) is known, and (\u03b4k1+1, \u03b4k1+2, \u00b7 \u00b7 \u00b7 , \u03b4k2) needs to satisfy the Equation 5 and be as similar to (\u03b3k1+1, \u03b3k1+2, \u00b7 \u00b7 \u00b7 , \u03b3k2) as possible. The variables in Equation 7 are z1 and z2, and z1 has been solved before through a greedy algorithm, so the unknown variable is only z2. Since \u03f5i1z1 are constants, we can move them from the left side of the equation to the right side, and these two equation systems are obviously equivalent. Then, we need to ensure that \u03f5(k1+i)1z1 +\u03b4k1+i is as similar to \u03b3k1+i as possible. It can be seen that another transformation can be carried out, which is equivalent to making \u03b4k1+i as similar to \u03f5(k1+i)1z1 +\u03b3k1+i as possible. In this way, we have separated the variables: the left side of the equation is the variable z2, the right side of the equation is the variable \u03b4k1+i(\u03b4k1+i = z2), and the column of \u03f5(k1+i)1z1 + \u03b3k1+i are constants. At this point, we find that part 2 of Equation 5 has been transformed to be very similar to part 1. Therefore, if there are more 0\u2019s than 1\u2019s in the range from \u03f5(k1+i)1z1 + \u03b3k1+1 to \u03f5(k2)1z1 + \u03b3k2, then z2 is set to 0. If there are more 1\u2019s than 0\u2019s, then z2 is set to 1. Therefore, the value of z2 can be solved here and Pk2 i=k1+1 ui \u2264(k2 \u2212k1)/2 is ensured. After obtaining the value of z2, the value of \u03f5i1z1 + \u03f5i2z2 can be calculated, and the value of z3 can be calculated again. Following this pattern, the values of Z = (z1, z2, \u00b7 \u00b7 \u00b7 , zm) can be obtained. Then \u03f5Z + \u03b3 = U, we obtain U. The complete algorithm is shown in Algorithm 1. 4 \fChen Wang et al. / Theoretical computer science 00 (2024) 1\u20138 5 \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 \u03f5(k1+1)1z1 + z2 = \u03b4k1+1 \u03f5(k1+2)1z1 + z2 = \u03b4k1+2 \u03f5(k1+3)1z1 + z2 = \u03b4k1+3 . . . \u03f5(k2)1z1 + z2 = \u03b4k2 Compare to \u03b3k1+1 \u03b3k1+1 \u03b3k1+1 . . . \u03b3k2 \u21d3 \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 z2 = \u03b4k1+1 + \u03f5(k1+1)1z1 z2 = \u03b4k1+2 + \u03f5(k1+2)1z1 z2 = \u03b4k1+3 + \u03f5(k1+3)1z1 . . . z2 = \u03b4k2 + \u03f5(k2)1z1 Compare to \u03b3k1+1 \u03b3k1+1 \u03b3k1+1 . . . \u03b3k2 \u21d3 \uf8f1 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f2 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f4 \uf8f3 z2 = \u03b4k1+1 z2 = \u03b4k1+2 z2 = \u03b4k1+3 . . . z2 = \u03b4k2 Compare to \u03b3k1+1 + \u03f5(k1+1)1z1 \u03b3k1+2 + \u03f5(k1+2)1z1 \u03b3k1+3 + \u03f5(k1+3)1z1 . . . \u03b3k2 + \u03f5(k2)1z1 (7) 3. Algorithm performance evaluation In this section, we present the complexity of Algorithm 1 and analyze its approximation guarantees. Proposition 3.1. Algorithm 1 has a complexity of O(n3), and if the fundamental solution set \u03b7 for the equation AU = B has been obtained and is in column echelon form, then the complexity will reduce to O(mn). Proof. In Algorithm 1, step 1 involves solving a system of linear equations, which has a complexity of O(n3). Step 8 involves transforming the matrix etaup into column echelon form, which has a complexity of O(m2n) where m \u2264n. Step 2 to 7 is O(1). Step 9 involves calculating the location of pivots in the column echelon matrix \u03f5, which has a complexity of O(mn). Steps 10 to 24 consist of a nested loop with three layers. However, each element in the matrix \u03f5 is only accessed once, resulting in a complexity of O(mn). Proposition 3.2. If a given instance I of the min generalized all-ones problem has a solution, the value sol of the solution obtained by Algorithm 1 satisfies sol \u2264r, where r is the rank of the matrix A. Proof. In Equation 6 and 7, if \u03b4i = \u03b3i, then the resulting ui will be 0. In each part, we always make more ui equal to 0, so each part has at least one ui that takes on the value of 0. Furthermore, the rank of \u03b7 is m = n \u2212r because \u03b7 is the fundamental solution set of the system AU = B. Therefore, at least m values of ui are 0, so P U \u2264n \u2212m = r. Proposition 3.3. If a given instance I of the min generalized all-ones problem has a solution, the value sol of the solution obtained by Algorithm 1 satisfies sol \u2264(n + opt)/2, where opt is the value of an optimal solution of I. 5 \fChen Wang et al. / Theoretical computer science 00 (2024) 1\u20138 6 Algorithm 1: Approximation Algorithm of Minimum All-Ones Problem Data: An adjacency matrix An\u2217n and a initial state B1\u2217n Result: Answer U 1 (\u03b7, \u03b3, m) = solveEquations(A,B); 2 if m == 0 and \u03b3 is null then 3 return null; 4 end 5 if m == 0 and \u03b3 is not null then 6 return \u03b3; 7 end 8 (P, \u03f5, Q) = matrixEchelon(\u03b7, \u03b3); 9 K = calculatePart(\u03f5); 10 for i from 1 to m do 11 cnt, tmp = 0; 12 for j from K[i \u22121] + 1 to K[i] do 13 for p from 1 to i \u22121 do 14 tmp = tmp \u2295(\u03f5[ j][p] \u2217X[p]) 15 end 16 cnt = cnt + (tmp \u2295\u03b3[ j]); 17 end 18 if cnt \u2264K[i] \u2212K[i \u22121])/2 then 19 X[i] = 0; 20 end 21 else 22 X[i] = 1; 23 end 24 end 25 U = P \u2217(\u03f5 \u2217X + \u03b3); 26 return U; Proof. In the Subsection 2.2, we partitioned the matrix \u03b7 into m + 1 parts and proved that for the 1 to m parts, Pki+1 ki+1 u \u2264(ki+1 \u2212ki)/2. Only the 0th part remains to be discussed. The 0th part is quite special in that it contains no variables, only differing in the value of \u03b3. Let the number of 0\u2019s in \u03b3 in the 0th part be g0 and the number of 1\u2019s be g1. g0 indicates that the switch at that point must not be pressed; otherwise, the conditions for the all-ones problem cannot be satisfied. Similarly, g1 indicates that the switch must be pressed. Now we have: sol \u2264g1 + (n \u2212g1 \u2212g0)/2 = (n + g1 \u2212g0)/2 (8) Then add the parameter opt. We can easily prove that sol \u2265opt \u2265g1, because the switches for these points must be pressed in any case. So we have g1 \u2264opt \u2264sol \u2264(n + g1 \u2212g0)/2 (9) Next, we will bound sol by replacing g1 with opt and g0 with 0, resulting in the following expression: sol \u2264(n + opt)/2 (10) 4." }