New answers tagged

2

One approach is to place inequality and domain restrictions in Solve. I show this below, using the example in the post. mat = {{1, 1, 1, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0}, {0, 0, 0, 0, 1, 1, 1}}; vars = Array[x, Length[mat[[1]]]]; rhs = {2, 2, 2}; Solve[Join[Thread[mat.vars == rhs], Thread[0 <= vars <= 1]], vars, Integers] (* Out[261]= ...



Top 50 recent answers are included