CNF encoding of additions

I have $ m$ equations of the following form: $ $ x_1+x_2+\cdots+x_n=s,$ $ where each variable is either 1 or 0, and the total number of variables is $ m\approx3{,}000$ . So I’m thinking of modeling each variable as a binary variable and each equation as a CNF formula so that, once I combine all formulas into one CNF, I can solve it using a SAT solver.

I’ve tried to solve the system of equations using Gaussian elimination, but it was too slow since the time complexity is $ m^3\approx27{,}000{,}000{,}000$ .

My problem is how to encode addition efficiently and simply. My only known approach is to model $ a+b$ as a circuit and then convert the big totality of $ n$ circuits to a CNF. Is there a better way?

Transitive reduction with vertex additions?

The transitive reduction of a (finite) directed graph is a graph with the same vertex set and reachability relation and a minimum number of edges. However, what if vertex additions are allowed? In some cases, the addition of vertices can considerably reduce the number of edges required. For example, a complete bipartite digraph $ K_{a,b}$ has $ a + b$ veritices and $ ab$ edges, but the addition of a single vertex in the middle results in a digraph with the same reachability relation that has $ a + b + 1$ vertices and only $ a + b$ edges.

More formally, given a directed graph $ G = (V, E)$ , the challenge is to find $ G’ = (V’, E’)$ and injective function $ f: V \rightarrow V’$ such that $ f(b)$ is reachable from $ f(a)$ in $ G’$ if and only if $ b$ is reachable from $ a$ in $ G$ and such that $ |E’|$ is minimized.

Are there any known results or algorithms related to this problem?

Is there a data structure that can perform range modulo additions and range minimum queries?

It is well-known that the Segment Tree performs range additions and range minimum queries in O(logN) each.

Let each element in the array have value V[i], M[i]. We define a “range modulo add” as the following: add +X to V[i] for each element in the range L<=i<=R and then calculate modulo M[i] for each element L<=i<=R. Can both this operation and range minimum queries be run in (worst-case or average-case) o(N)? If not on ranges [L,R], is it possible to handle range minimum queries and range modulo adds on the entire array quickly?

Number of multiplications and additions in the given code

$ N:=2^p$

Input: $ f \in \mathbb C^N$

1: $ n=N/2$

2: initialize vectors $ f^{(1)}, f^{(2)} \in \mathbb C^n$

3: $ w_N^0=1$

4: for $ j=0,\ldots,n-1$ do

5: $ \ \ \ \ \ f_j^{(1)}=f_j+f_{j+n}$

6: $ \ \ \ \ \ f_j^{(2)}=(f_j-f_{j+n})w_N^j$

7: $ \ \ \ \ \ w_N^{j+1}=\exp(-2\pi i/N)w_N^j$

8: end for

9: if $ N=2$ then

10: $ \ \ \ \ \, $ set $ c:=(f^{(1)},f^{(2)})\in \mathbb C^2$

11: else

12: $ \ \ \ \ \, $ evaluate (recursively) $ c^{(1)}=FFT(f^{(1)})$

13: $ \ \ \ \ \, $ evaluate (recursively) $ c^{(2)}=FFT(f^{(2)})$

14: $ \ \ \ \ \, $ set $ c=\Big(c_0^{(1)},c_0^{(2)},c_1^{(1)},c_1^{(2)},\ldots,c_{n-1}^{(1)},c_{n-1}^{(2)}\Big) \in \mathbb C^n$

15: end if

Let $ m_p$ be the number of multiplications and $ a_p$ the number of additions for $ N=2^p$ . I want to show that

$ $ m_p\le p2^p, \ \ \ \ \ a_p\le p2^p, \ \ \ \ \ p\in \mathbb N$ $

Therefore we have a total complexity of about $ N \log (N)$ complex additions/ multiplications

Is Memory Error While Saving Ubuntu’s Status related to Inability of Installing Guest Additions?

After trying to save the Ubuntu 16.04 status before closing the operating system (which is installed on a VirtualBox machine on a host windows), here is the error message I receive resulting in the closing of ubuntu and not saving its status. I would appreciate if someone can explain this and give a solution for it.

The instruction at ************************** referenced memory at *******************************. The memory could not be read. Click OK to terminate the program. 

Where stars stand for some weird combination of letters and numbers.

NOTE: I have allocated 2048 MB as Base Memory with 2 CPU processor. And I have problem installing Guest Additions (if that is related to the issue!)

optimized multiplications using only shifts and additions

I have some doubts regarding the implementation of multiplications by shifts and adds only.

I have a set of coefficients that I’ve use to multiply some variable. For example, I need to multiply tmp by coefficient 15/36. The coefficient is always in the for of k/2^m, and I have a lot of different coefficients (99 in total, and k<2^m). Hence I have the next:

tmp*15/36 is equivalent to (tmp<<3 + tmp<<2 + tmp<<1 + tmp)>>5. It requires 11 shifts and 3 additions.

Now, with this coefficient it is more efficient to do the next: tmp – tmp*17/36 which is equivalent to tmp – (tmp<<4 + tmp)>>5. In this case the same result is obtained with 9 shifts and 1 addition and 1 subtraction, which is a bit more optimized than in the first case.

Contrary, when coefficient is 19/32 it is more efficient to keep it like that, than to use it as 1-13/32, since the number of shifts and adds will be the same and we will need one subtraction in addition.

In summary, my question is how to determinate when to use coefficient directly, and when to use it in the form of 1-(2^m-k)/2^m? Is there any way to conclude it automatically?

Thank you.

Folder for Guest Additions – does that mean it’s installed?

I am running ubuntu as host and windows 10 on my vm. I tried installing guest additions but I am not sure it was successful. I have a folder called guest additions on my windows 10 (guest vm) — do I need to run this setup file to mount it? From the Windows 10 guest vm, under CD DRIVE (D:) I see CCCOMA_X64FRE_EN-US_DV9. No idea what this is so maybe it’s the guest additions file?

[see guest additions folder][1]

Guest additions install failure Windows 7

When I installed Orace Virtual Box I installed guest additions as the secondary master drive.

The location of the guest additions is

C:/prog files/oracle v box/guestaddition.iso

I know I did not know why I installed this on the original Oracle Virtual Box install and now I am unable to successfully install Guest Additions through the command line on my Ubuntu installation.

I was able to successfully download the guest additions iso through ubuntu however I have an error log message when trying to install it.

Is there any specific error message I need to provide to get to the core of this problem?

I could post the entire error log of the unsuccessful guest additions install from terminal however it is quite lengthy.

I’m thinking that there is a conflict between the already installed Oracle guest additions and the successfully downloaded ubuntu but not installed guest additions.

Thank you.

Using O-notation for asymptotic estimation of the number of additions in recursive function

the number of additions that are executed during the calculation is a(n). How can i find an asymptotic estimation for the function mystery(n) with the help of the O-notation and master theorem. Note: here the question is not asked for the value of mystery(n), but rather for the number of additions!

def mystery(n):     if n==0:         return n * n     return 2 * mystery(n/3) + 4 * n