The five following examples are modeled in logic0 in the modeling language LPL.
Example 1: We would like to decide whether a particular depot should be built or not. The decision to build or not to build can be modeled by a binary variable δ: δ = 1 mean “to build an depot” and δ = 0 mean‘s “not to build the depot”. Now this depends on whether there is a quantity z > 0 delivered from this depot. This means: “if there is a certain quantity delivered from a depot then the depot should be built, that is, supposing the upper bound of z is M > 0 (see rule 50a):
If equivalence is required, then
Example 2: Model the following statement: “If a product is manufactured at all then there is an additional setup (or fixed) cost.” Suppose that z ≥ 0 represents the quantity of a product manufactured at a marginal cost per unit of c_{1}. If the product is manufactured at all there is a additional unique setup cost of c_{2}. Hence, two cases need to be distinguished:
Either nothing is manufactured, then z = 0 and total cost = 0.
Or something is manufactured, then z > 0 and total cost = c_{1}z + c_{2}
To model this situation, a Boolean (indicator) variable δ is introduced which is true if “something is manufactured” (z > 0), if nothing is manufactured the δ is false. Now the indicator variable can be linked with the quantity z by the implication (meaning “if the quantity z is strictly larger than 0 then something is manufactured”):
Applying rule 50a gives the linear constraint: z ≤ U(z) ⋅ δ
The cost function is formulated as: cost = c_{1}z + c_{2}δ
To verify the resulting model, the values of δ are checked:
(1) if δ = 1 (true) then one has: z ≤ U(z) , cost = c_{1}z + c_{2}
(2) If δ = 0 (false) then one has: z ≤ 0 , cost = 0
In this case in LPL it is even not needed to introduce a binary variable. The constraint can be formulated as:
The z > 0 is automatically replaced by an additional binary variable.
Example 3: Two quantities must be link logically. For example: “If product A is included in the blend then also at least a quantity b of product B must be included”. That is: z_{A} > 0 → z_{B} ≥ b
To model this situation, an indicator variable δ is introduced with the meaning “A is included in the blend” that is: z_{A} > 0 → δ. And the requirement “if product A is included in blend then also at least b of product B must be included” can be modeled as: δ → z_{B} ≥ b
The two constraints can be translated to mathematical inequalities by applying the two Rules 51a and 53a, giving:
To verify the resulting model, check for the values of δ:
(1) If δ = 1 (true) then z_{A} ≤ U(z_{A}) , z_{B} ≥ b (supposingL(z_{B}) = 0)
(2) If δ = 0 (false) then Z_{A} ≤ 0 , z_{B} ≥ 0
Example 4: A constraint A must hold if and only if the indicator variable is true. For example: 2v + 3w ≤ 1 ↔ δ. Hence they are:
Applying two rules, one gets (supposing L(v) = L(w) = 0 , U(v) = U(w) = 1 , ϵ = 0.001):
Example 5: Model the following constraint, supposing L(x) = L(y) = 0, U(x) = U(y) = 10, and ϵ = 0.0001:
The details are given in the text logic0. Note that these examples are from [7] and [6].