1

please can you help me in solving this problem

I have totally uni-modular matrix A multiplied by set of Binary variables X.

it means that A*X<=B

how to solve this problem in polynomial time .. I am interested in finding just one feasible solution.

For example I have:

A= [ 1  1  1  0  0  0  0  0 ;
     0  0  1  1  1  1  0  0 ;
     0  0  0  0  1  1  1  1 ;
     1  1  1  1  1  0  0  0 ;
     0  0  0  0  0  1  1  1 ;
    -1 -1 -1 -1  0  0  0  0 ;
     0 -1 -1 -1 -1  0  0  0 ;
     0  0  0 -1 -1 -1 -1  0 ;
     0  0  0  0  0 -1 -1 -1 ];

B= [ 2 ; 2; 2; 3; 2;-3;-3;-2;-2];
9
  • A= [1 1 1 0 0 0 0 0 ; 0 0 1 1 1 1 0 0 ; 0 0 0 0 1 1 1 1 ; 1 1 1 1 1 0 0 0 ; 0 0 0 0 0 1 1 1 ; -1 -1 -1 -1 0 0 0 0 ; 0 -1 -1 -1 -1 0 0 0 ; 0 0 0 -1 -1 -1 -1 0 ; 0 0 0 0 0 -1 -1 -1; ]; B=[2;2;2;3;2;-3;-3;-2;-2]; Commented Dec 7, 2013 at 16:19
  • you can edit your question, I did that for you. What do you mean whit polynomial time? What about A\B = X? Commented Dec 7, 2013 at 16:35
  • thank you for editing the question .. it is not possible to solve it in this way because inverse of A is undefined , the determination of A is zero Commented Dec 7, 2013 at 16:40
  • but it gives a solution, isn't it a feasable one? Commented Dec 7, 2013 at 16:47
  • how it is feasible solution ? what is the values of X in this case Commented Dec 7, 2013 at 17:01

1 Answer 1

0

This easily solved with bintprog (binary integer programming) from the Optimization toolbox:

x = bintprog(ones(size(A,2),1),A,b)

which returns

x =

      0
      1
      1
      1
      0
      0
      1
      1

You can easily confirm that A*x yields b. Of course it's not guaranteed that this is the only solution. For more on the bintprog algorithm and options for tuning, see this article. According to this Wikipedia page, the branch-and-bound method on which bintprog is based can have polynomial time complexity.

Additionally, as @thewaywewalk points out, lsqlin can also be leveraged:

x = lsqlin(A,b,A,b,[],[],zeros(size(A,2),1),ones(size(A,2),1))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.