0

I'm have a binary integer programming problem and want to solve it with bintprog.

A = [1 0 1 0; 0 1 1 0; 1 1 1 1; 0 0 1 1];
f=[1 1 1 1];
b=[1 1 1 1];
[x,xfval,exitflag,output]=bintprog(f,-A,-b);

The solution bintprog gave me is x={3}, but I would like the solution to be x={1,2} which mean 4 is reachable if 1 and 2 (which connected to 3) are both selected. What can I do to get the result that I wanted?

EDIT: Node 3 act like a switch that can only be enabled if at least 2 nodes that connected to it are active. When that happens, the last node can be reached. For e.g, if 1,2 are active, 4 can be reached. Same can also be said if 1,4 are active, 2 can be reached. 3 obviously shouldn't be the solution.

maostah
  • 1
  • 2
  • Now it is unclear what you ask. Your problem as stated in the EDIT is probably not the same as your code example above. You should probably expand on your problem, especially on the part where you transform it to a binary programming problem. – NoDataDumpNoContribution Feb 12 '15 at 14:19

1 Answers1

0

Let's take your example:

You want to minimize f=x1+x2+x3+x4 subject to the inequalities x1+x3>1, x2+x3>1, x1+x2+x3+x4>1 and x3+x4>1 (-A, -b effectively changes <= to >).

Matlab gives x1=x2=x4=0 and x3=1 which fullfills all inequalities and gives f=1.

You want x1=x2=1 and x3=x4=0 as a solution? Well, that violates the last inequality (x3+x4>1) and would only give f=2.

If you want this solution you must provide different parameters f, A, b.

NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104