I want to convert an IF statement for my optimization problem. I want to minimize the total price. I want 800 tones of salt and 3 suppliers offer me their prices.
Supplier $1$ offers me $100$ tones at $\\\$150$ a tone.
Supplier $2$ offers me $400$ tones at $\\\$170$ a tone, if I take $300$ tones (or more)the price drops to $\\\$150$.
Supplier $3$ offers me $1600$ tones at $\\\$170$ a tone.
Here is my model without the if statement :
$x_i$ is an integer variable representing the quantity bought to the supplier $i$, $p_i$ is the price of the supplier $i$, $c_i$ is the maximal capacity offered by the supplier $i$.
$Min( p_1\times x_1 + p_2\times x_2 + p_3\times x_3)$
$s.t. x_1 + x_2 + x_3 = 800$
$ x_1 \leq 100$
$ x_2 \leq 400$
$ x_3 \leq 1600$
Now I want to use the Big M method the convert my if statement but I don't know how to do it. I tried this method : Express a "complex" IF-Statement to Linear Programming to find the constraints but I don't know how to modify my prices. I tried this :
If $x_2 \geq 300$, Then $p_2 = 150$, Else $p_2 = 170$.
If $x_2 \geq 300$, Then $b = 1$, Else $b = 0$ and $p_2 = 150b + 170(1-b)$
In addition to this I code in python the the mip library, do you know a better library to do this?
Thanks a lot !