integer linear if then else constraint

 0 how to linearize: if (m > 0) then c = 1 else c = 0  thank you c is binary m is in [0,inf) asked 21 Apr '16, 12:56 nardinebasta 6●1●4 accept rate: 0% fbahr ♦ 4.6k●7●17 I kindly seek help for linearizing the following: if(R>0) then T=aR+bL else T=L where T,R,L are continuous in[0,1] a and b are variables to be optimized, where a+b=1 (24 Apr '17, 04:25) nardinebasta

 1 It is not possible to do this exactly (at least not within a mixed integer linear program). The first problem is the feasible region corresponding to $$c=1$$ is open, due to the strict inequality $$m>0$$. So you must settle for either $$c$$ being ambiguous (0 and 1 both feasible values) when $$m=0$$ or $$c=1$$ when $$m\ge \epsilon$$ for some small but strictly positive $$\epsilon$$. The second problem is that the only way I know to linearize this requires a finite upper bound for $$m$$. Moreover, if the upper bound is too large, the model can become numerically unstable. (How large is "too large" depends on the rest of the model, the precision of the solver, and to some extent just luck.) To linearize "if $$m\ge\epsilon$$ then $$c=1$$ else $$c=0$$" when $$m\in [0, U]$$ for some finite $$U$$, follow the last part of my answer to your previous question ("converting composite conditional constraint to linear progrmming"), with the $$c_2$$ there being your $$c$$ here and the value 100 there being the upper bound $$U$$ here. answered 21 Apr '16, 15:45 Paul Rubin ♦♦ 14.6k●5●13 accept rate: 19%
 0 here the other way around. when m(v,t) is 0, c(v,s,t) is for sure 0. when m >0 then if r(v,s,t)=m(v,t) then c(v,s,t)=1 else c(v,s,t)=0 m(v,t) is the maximum attraction a vehicle v could achieve at this time slot c(v,s,t) is a binary value signifying the attraction between a vehicle v and a location s is matching the maximum attraction the vehicle could achieve. r(v,s,t)is the relation attraction between a vehicle v and a location s at time t. so i am not sure what I did is correct. I treated the compound condition into two separate ones without any conjunction. i replaced the if m(v,t) =0 then c(v,s,t) = 0.  by : 100*maximumAttraction(v,t)>=chosenLocation(v,s,t)  and if r(v,s,t)=m(v,t) then c(v,s,t)=1.  by: relationAttraction(v,s,t) - maximumAttraction(v,t) <= 100*(1-chosenLocation(v,s,t)) relationAttraction(v,s,t) - maximumAttraction(v,t) >=-100*(1-chosenLocation(v,s,t))  however I have noticed that the values of the variables to be optimized are highly affected by the lower and upper bounds values, the smaller the range, the more realistic the optimized values are, despite the fact that the value of the objective function does not change. i did not put and limit on the number of iterations for the solver. answered 23 Apr '16, 15:30 nardinebasta 6●1●4 accept rate: 0% Your first constraint is correct (assuming that 100 is a large enough constant). Your second and third constraints actually enforce the converse of what you say you want: if c = 1 then r = m. Observe that r = m and c = 0 satisfies both of them. (28 Apr '16, 16:09) Paul Rubin ♦♦ how to represent if (m=0) then c=0 where m in [0,1] and c is binary (04 May '16, 11:17) nardinebasta
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×231
×190