I want to represent MIN{y,z} = 5 in matlab by the following equations.
y >= 5
y <= 5*x + 20*(1-x)
z >= 5
z <= 5*(1-x) + 20*x
Therefore, the variable x should be a binary variable. Is there anyway
to define/declare x as a binary variable? I have searched online and
have not found any method to do it.
Thank you in advance.
Xu
1. the possibilities of 0 and 1 is not equal. If x is 0, logic(x) is
0, otherwise, logic(x) is 1.
2. I think it is impossible to put a function in a matrix, because I
want to use the equations in linear programming problems.
Additional information is in this post
http://groups.google.com/group/sci.math/browse_thread/thread/51f93c35bab4cbcf#.
Xu
You can define x as a binary variable by using either x = true or x = false. However, equations you presented in the post is not a clear descrption of what you want to do.
Good luck.
Yi
Thank you.
I want to solve a mixed integer programming problem in matlab.
MIN = x1+x2+x3+x4;
x1 + x2 >= 5;
x3 + x4 >= 5;
x1 + x2 <= 5*y1 + 200*(1-y1);
x3 + x4 <= 5*(1-y1) + 200*y1;
x2 >= 3;
x3+x4 >= 3;
x2 <= 3*y2 + 100*(1-y2);
x3+x4 <= 3*(1-y2) + 200*y2;
@BIN(y1);
@BIN(y2);
Here, y1 and y2 are binary valued variables. Their value should be 0
or 1. The code above is in Lingo/Lindo style. I want to represent it
in matlab.
Xu
You can download some MILP solvers from the File Exchange, for example
http://www.mathworks.com/matlabcentral/fileexchange/6990
HTH
Yi