## April 2022

### Logic conditions as constraints - Part 2

#### 12 April 2022 (2,397 words)

In Logic conditions as constraints - Part 1 we introduced a technique for converting a broad class of logic conditions into constraints. While that technique is effective, it can be difficult to apply.

In this article, we present an alternative technique specifically designed to improve the proficiency of students learning to formulate models.

That is, we use two techniques for converting logic conditions into constraints:

- Decomposition and Translation (D&T). This technique is described in the paper "Teaching use of binary variables in integer linear programs: Formulating logical conditions".
- Conjunctive Normal Form (CNF). We described the CNF technique in Part 1.

After describing the D&T technique, we focus on replicating the paper's examples, applying both the D&T and the CNF techniques to illustrate how each technique can be applied to a variety of logic condition formulation situations.

### Logic conditions as constraints - Part 1

#### 3 April 2022 (2,424 words)

When formulating a model, we often have a situation described in terms of logic conditions where something implies something else. For example:

- If this happens, then we must do that.
- If this and that happen, then we can't do some other thing.
- We can do some or all of these things, but only if that other thing happens.

However, mathematical programming models cannot represent logic conditions directly. Therefore, we need to translate the conditions, known as "implications", into a set of constraints that represent the logic.

This article describes a technique for converting a logical implication into an equivalent set of constraints. Along the way, we'll dabble in applying some formal logic notation, define rules for manipulating formal logical implications, have a brief look at Conjunctive Normal Form (CNF), and learn how to convert CNF into constraints.

Part 2 will describe an alternative representation of this technique, specifically designed to improve the proficiency of students learning to formulate models.