how to put the following constraints in a linear form.

if(T(i)<Tmax(i)) then x=0 else x=1

where T and Tmax are continuous in [0.0008-10] and x is a binary variable

thank u

asked 01 Aug '17, 06:17

nardinebasta's gravatar image

accept rate: 0%

edited 01 Aug '17, 06:19

You cannot do exactly what you asked, at least not in the context of a mathematical program. The problem is that strict inequalities are incompatible with mathematical programs. (They lead to feasible regions that are not closed.)

One way to come close is the following:\[T(i) \le T_{max}(i)+10x\] \[T(i) \ge T_{max}(i)-10(1-x) \]

The only issue here is that if \(T(i)=T_{max}(i)\), \(x\) can be either 0 or 1.

An alternative that makes the value of \(x\) unambiguous involves specifying some small \(\epsilon > 0\) and partitioning the cases into \(T(i) \le T_{max}(i) - \epsilon\) and \(T(i) \ge T_{max}(i)\), making \(T_{max}(i) - \epsilon < T(i) < T_{max}(i)\) infeasible.


answered 01 Aug '17, 11:12

Paul%20Rubin's gravatar image

Paul Rubin ♦♦
accept rate: 19%

edited 01 Aug '17, 11:17

Thank you so much for you reply...I am most grateful. According to my problem, the question can be rephrased to be: if(T(i)=Tmax(i)) then x=1 else x=0.

Since Tmax is the maximum value of T, then T can never be greater than Tmax. you posted a solution using z1 and z2 in orinanobworld

I am trying to use the same technique with only z1 that signifies y<m-1 and omit z2 , as y can never be greater than m, having the third equation (x+z1=1) but i failed. Your help is highly appreciated.

Note: am trying to do that to simplify my constraints as cplex still finds my program infeasible.

(01 Aug '17, 15:31) nardinebasta

If you can live with \(x\) either 0 or 1 (ambiguous) when \(T(i)=T_{max}(i)\), then you can use just the second constraint of my answer. Otherwise, keep my second constraint as-is and change my first constraint to \(T(i) \le T_{max}(i) - \epsilon*(1-x)\). You will have to live with the limitation that \(T(i)<T_{max}(i) \implies T(i)\le T_{max}(i)-\epsilon\).

(01 Aug '17, 17:21) Paul Rubin ♦♦

If i got it right, the constraints will look as follows: T(i)<=Tmax(i)- ϵ(1-x(i)) and T(i)>=Lz1(i)+Tmax(i)x(i)+(Tmax(i)+ϵ)z2(i) and x(i)+z2(i)+z1(i)=1. using this set of constraints cplex finds an infeasibility in x(i)+z2(i)+z1(i)=1. am i doing anything wrong?

(03 Aug '17, 10:17) nardinebasta

Yes, this is wrong. Look at what happens if z2(i) = 1.

(03 Aug '17, 11:45) Paul Rubin ♦♦

i somehow got it. my constraints are now: T(i)≤Tmax(i)−ϵ∗(1−x) and T(i)≥Tmax(i)−10(1−x)

in my problem T(i)=h(i)ho(i,j)+ w(i)wo(i,j)+s(i)*st(i,j) where ho,st,wo are parameters and h,w,s are the variables I need to optimize. Now using these constraints, for some i, T gets the value of ϵ and thus Tmax as well since it is calculated through the following constraint: Tmax(i)>=T(i). Where should I look?

your help is highly appreciated

i apologize am asking too much questions. i need this to validate my PhD theory in the area of VANET and I have no strong theoretical background in this area

(04 Aug '17, 03:47) nardinebasta

If \(T(i)\in [0.0008, 10]\) then I assume you have either set 0.0008 as a lower bound for \(T(i)\) or added the constraint \(T(i)\ge 0.0008\). Thus if \(T(i)=\epsilon\), I assume \(\epsilon \ge 0.0008\). Are you saying that you know, for some reason, that \(T(i)\) should not be that small?

(04 Aug '17, 17:08) Paul Rubin ♦♦

yes, that exactly my problem now. t(i) should not be that small... this doesn't happen for all i, only some. hint on where the problem might be is highly appreciated.

(06 Aug '17, 06:29) nardinebasta

You apparently have an error in your model (but I have no idea where). The best general advice I can give is to do the following. First, ask yourself what aspect of the underlying problem would rule out \(T(i)=\epsilon\). Second, ask yourself what constraints and/or bounds in the model capture that aspect of the problem. If none, you are apparently missing some constraints. Otherwise, plug your solution into those constraints and figure out why they are not violated by the solution.

(06 Aug '17, 20:06) Paul Rubin ♦♦

my problem is finally solved.... am so grateful to you...many many thanks :)

(22 Aug '17, 08:06) nardinebasta
showing 5 of 9 show 4 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • 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



Asked: 01 Aug '17, 06:17

Seen: 718 times

Last updated: 22 Aug '17, 08:06

OR-Exchange! Your site for questions, answers, and announcements about operations research.