# To represent a logic constraint

 0 Hello, now I have a problem, in which $$x$$ is the binary variable, constant $$a \ge 0$$, $$f(x)$$ is a function of $$x$$. How to represent the following relationship: If $$a \le f(x)$$, then $$x=0$$. Do you have some ideas for the constraint above? Many thanks for that, it seems a bottle-neck in my current problem. I want to fix it. Thank you. asked 10 Mar '15, 10:52 LinYuan 80●6●17 accept rate: 0% fbahr ♦ 4.6k●7●16

 2 One way to model this, is $$a \geq f(x) + \varepsilon - (1-x)M$$. Sensible values for $$\varepsilon$$ and $$M$$ depend on your problem formulation though. Note that when this constraint does not admit a conic representation (due to f(x)), you are solving a mixed integer nonlinear programming problem. These problems are generally challenging. answered 10 Mar '15, 11:00 optimizer 176●1●5 accept rate: 6% That is pretty good. I really appreciate that. When a<= f(x), this constraint requires x=0 exactly; while if a > f(x), it doesn't influence the value of x. In my problem, f(x) is a linear function of x. Thank you very much. Have a good day. (10 Mar '15, 11:06) LinYuan
 2 You might be able to apply what I wrote in Indicator Implies Relation to the contrapositive of your constraint ($$x = 1 \implies a \gt f(x)$$), with the usual necessity to relax the strict inequality a bit (or introduce an $$\epsilon$$ gap as in what @optimizer wrote). answered 10 Mar '15, 15:48 Paul Rubin ♦♦ 14.6k●5●13 accept rate: 19% That is exactly what I want. According to the link, I find many related topics in your blog. Many thanks for the kind materials. They really help me a lot for my future research. For this problem, can we simply set ϵ=0 ? (10 Mar '15, 21:31) LinYuan Yes, because $$x$$ binary implies $$f(x)$$ takes only two possible values ... which also makes the constraint somewhat trivial. Let $$f_0 = f(0)$$ and $$f_1 = f(1)$$. Presumably you can compute these before solving the model. If $$f_1 \ge a$$ then $$x$$ must be 0. If $$f_1 \lt a \le f_0$$, the constraint is vacuous (it basically says $$x = 0 \implies x = 0$$). If both values of $$f$$ are less than $$a$$, the constraint can never come into play. (11 Mar '15, 10:46) Paul Rubin ♦♦
 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:

×65
×27
×12
×6