Pseudo if statements in LP programming

55 Views Asked by At

When designing LPs for exams I often run across problems where I would like to input an "if-statement". For example:

$5\leq x_b$ if $p_a\geq 10$

I've tried dividing by itself and using floor functions to turn the inequality into:

$5*f\leq x_b$

$f=1$ if $p_a\geq 10$ else $f=0$

Are there any smart ways to about creating the function f here?

1

There are 1 best solutions below

0
On

Declare $f$ as a binary variable (or function like $f_x = x$ with $x$ as binary var) with a pair of constraints:
$L_a(f-1) \le p_a - 10 \le P_af$ where $0 \le P_a, L_a$ are upper/lower bounds of $p_a$

Ad then ofcourse
$ 5f \le p_a$