Is it possible to generate an algorithm that can solve a system of linear equations with binary variables?

General discussion for off-topic subjects.
lopeslimagabriel
Junior Member
Posts: 1
Joined: Wed Sep 23, 2020 4:06 am

Is it possible to generate an algorithm that can solve a system of linear equations with binary variables?

Postby lopeslimagabriel » Wed Sep 23, 2020 4:10 am

I'm having trouble defining an algorithm that can solve a system of linear equations with binary variables.
Example given the following system of linear equations:

x_12 + x_18 + x_28 = 0
x_12 - x_18 - x_28 = 0
x_12 + x_13 + x_28 - x_38 = 0
-x_13 + x_14 - x_38 - x_48 = - 2
-x_14 + x_15 - x_48 - x_58 = -2
x_15 + x_16 + x_58 - x_68 = 0

Knowing that the values of x_12 = 0, x_18 = 0 and x_28 = 0, it is possible to create an algorithm that solves this system with the other variables assuming only values of 0 or 1.

Code: Select all

variables = x_12,x_13,x_14,x_15,x_16,x_18,x_28,x_38,x_48,x_58,x_68
equations = (x_12 + x_18 + x_28,
             x_12 - x_18 - x_28,
             x_12 + x_13 + x_28 - x_38,
             -x_13 + x_14 - x_38 - x_48 + 2,
             -x_14 + x_15 - x_48 - x_58 + 2,
             x_15 + x_16 + x_58 - x_68)



solve((equations),variables)

Return to “Whatever”

Who is online

Users browsing this forum: No registered users and 24 guests