linear algebra - Matlab: how to solve a binary system of equations? -


i'm trying solve system of equation following form:

a5 + a6 + a7 + f5 + f6 + f7 = 11; b5 + b6 + b7 + e5 + e6 + e7 = 100; c5 + c6 + c7 + d5 + d6 + d7 = 100;  a5 + b5 + c5 + d5 + e5 + f5 = 11; a6 + b6 + c6 + d6 + e6 + f6 = 100; a7 + b7 + c7 + d7 + e7 + f7 = 100; 

where variables , digits binaries.

is there way in matlab?

for example, substituting binary numbers there decimal values:

a5 + a6 + a7 + f5 + f6 + f7 = 3; b5 + b6 + b7 + e5 + e6 + e7 = 4; c5 + c6 + c7 + d5 + d6 + d7 = 4;  a5 + b5 + c5 + d5 + e5 + f5 = 3; a6 + b6 + c6 + d6 + e6 + f6 = 4; a7 + b7 + c7 + d7 + e7 + f7 = 4; 

and tell matlab somehow unknowns should integers , interval [0:1]?


here x = b form:

a = [1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1; 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0; 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0; 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0; 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1];  b = [3 4 4 3 4 4]; 

what next step?

bintprog, if have optimization toolbox.

since there multiple solutions, i'll choose solution has minimum sum.

>> = [1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1; 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0; 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0; 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0; 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1];  >> b = [3 4 4 3 4 4];  >> bintprog(ones(1,18),[],[],a,b) optimization terminated. ans =      0      1      1      1      1      1      1      1      1      1      0      0      0      0      1      0      1      0 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -