From: Xu Wang on 30 Jul 2010 06:30 Hi everyone, 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
From: Xu Wang on 30 Jul 2010 06:39 On Jul 30, 12:30 pm, Xu Wang <wangxu.n...(a)gmail.com> wrote: > Hi everyone, P.S. There is a method to use logic(x) to get binary values, but there are two disadvantages: 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 > > 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
From: Yi Cao on 30 Jul 2010 06:46 Xu Wang <wangxu.name(a)gmail.com> wrote in message <9acb49a0-3e6d-4c8d-b95b-d8f8c7fcc357(a)g35g2000yqa.googlegroups.com>... > Hi everyone, > > 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 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
From: Xu Wang on 30 Jul 2010 06:53 On Jul 30, 12:46 pm, "Yi Cao" <y....(a)cranfield.ac.uk> wrote: > Xu Wang <wangxu.n...(a)gmail.com> wrote in message <9acb49a0-3e6d-4c8d-b95b-d8f8c7fcc...(a)g35g2000yqa.googlegroups.com>... > > Hi everyone, > > > 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 > > 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
From: Yi Cao on 31 Jul 2010 16:10 Xu Wang <wangxu.name(a)gmail.com> wrote in message <3691e5c6-2c1e-4ea6-b61a-e32de0d6d2d6(a)f42g2000yqn.googlegroups.com>... > 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
|
Pages: 1 Prev: Changing XTickLabels and YTickLabels font sizes Next: Redefine 0/0 |