Reputation: 11
I am new to linear/integer programming and I am having a hard time formulating constraints for a specific if-then statement in a fixed charge problem. Suppose that there are five manufacturers of t-shirts, and a customer wishes to purchase 400 t-shirts while minimizing costs.
Producer | Variable cost/t-shirt | Delivery | Availability |
---|---|---|---|
A | 3 | 40 | 200 |
B | 3.5 | 30 | 100 |
C | 4.10 | Free delivery | 100 |
D | 4.1 | 30 | 200 |
E | 3.2 | 30 | First 100 t-shirts |
E | 2.90 | 20 | 101st-150th t-shirt |
Producer E has an availability of 150 t-shirts. The first 100 t-shirts bought from producer E have a variable cost of $3.20 and a delivery fee of $30. If the customer orders more than 100 t-shirts from producer E, she can buy them at a variable cost of $2.90 and an additional fee of $20.
How can I create constraints from this if-then statement:
I want constraint Xe2 <= 0 to exist when Xe1 < 100.
Thanks in advance!
Upvotes: 1
Views: 512
Reputation: 11938
This is a pretty standard "discount pricing model" where a discount price is awarded at a certain quantity. You can introduce 1 binary variable to the model to do this. This sounds like a H/W assignment.... :)
Let:
Xe1 be the qty bought from E at price 1
Xe2 be the qty bought from E at price 2
Ye be the decision to buy at the second price point y ∈ {0, 1}
Me2 be the qty available at the 2nd price (or a reasonable upper bound)
Then:
Xe2 <= Ye * Me2 # purchase at 2nd price point held to zero, unless Ye==1
Xe1 >= 100 * Ye # Ye can only be 1 if 100 are purchased at Xe1
There are some nuances here with the shipping. It isn't clear from the problem description if you bought 101 shirts from E if the shipping cost would be 30 + 20 (which would be odd) or the whole cost of shipping drops to 20. You could use the same indicator variable Ye
to work something out for that as well.
Upvotes: 0
Reputation: 7157
Since Xe1 and Xe2 are both non-negative integer variables, your constraint is the same as Xe1 <= 99 ⇒ Xe2 = 0
. This can be formulated as follows:
b1 <= b2
99*b1 + 100*(1-b1) <= Xe1 <= 99*b1 + M*(1-b1)
1-b2 <= Xe2 <= M'*(1-b2)
where b1,b2
are binary helper variables and M
and M'
are upper bounds for Xe1
and Xe2
, i.e. M = 101
and M' = 400
.
Upvotes: 0