Skip to content

Commit

Permalink
Added short section on negation
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed Jul 16, 2024
1 parent 46dcd95 commit a23b016
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 04_modelling.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@ b3 = model.new_bool_var("b3")
These variables, `b1`, `b2`, and `b3`, represent distinct propositions whose
truth values are to be determined by the model.

You can obtain the negation of a Boolean variable by using `~` or the
`.Not()`-method. The resulting variable can be used just like the original
variable:

```python
not_b1 = ~b1 # Negation of b1
not_b2 = b2.Not() # Alternative notation for negation
```

Note that you can use more than three variables in all of the following
examples, except for `add_implication` which is only defined for two variables.

#### Adding Logical OR Constraints

The logical OR operation ensures that at least one of the specified conditions
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,18 @@ b3 = model.new_bool_var("b3")
These variables, `b1`, `b2`, and `b3`, represent distinct propositions whose
truth values are to be determined by the model.

You can obtain the negation of a Boolean variable by using `~` or the
`.Not()`-method. The resulting variable can be used just like the original
variable:

```python
not_b1 = ~b1 # Negation of b1
not_b2 = b2.Not() # Alternative notation for negation
```

Note that you can use more than three variables in all of the following
examples, except for `add_implication` which is only defined for two variables.

#### Adding Logical OR Constraints

The logical OR operation ensures that at least one of the specified conditions
Expand Down

0 comments on commit a23b016

Please sign in to comment.