2

I am trying to solve a system of linear equations where the variables take binary values

import numpy as np
import numpy.linalg as LA
import scipy.optimize as optimize

A = np.array([[1/5, 1/2, 1/3], [1/4, 1/5, 1/6], [1/6, 2/9, 3/10]])
b = np.array([1, 1, 1])
x = LA.solve(A, b)

My matrix A has around 400 columns and 3000 rows. Just posted few columns due to space constraint. My output vector is always 1. All my variables can take only binary values - 0 or 1

msksantosh
  • 379
  • 4
  • 19
  • I cant get your code to work, I get the following error **LinAlgError: Singular matrix** – DrBwts Jul 25 '18 at 13:32
  • Maybe this [question](https://stackoverflow.com/q/26305704/8069403) could be usefull, about Mixed Integer Linear Programming. Another keyword seem to be 'system of boolean equations' instead of binary equations ([for example](https://math.stackexchange.com/q/2103949)) – xdze2 Jul 25 '18 at 14:16
  • Thankyou @xdze2, that helped. However I am stuck at formulating optimizing the squares function using Pulp – msksantosh Jul 26 '18 at 10:31
  • Are you even sure your linear system has at least one solution over the reals? This looks like a least-squares problem to me. – Rodrigo de Azevedo Jul 27 '18 at 20:37

0 Answers0