Skip to content

Mutex new

---
title: mutex
---

# pitct.mutex('DES3', 'DES1', 'DES2', pair_state)

Constructs a mutual exclusion automaton by removing specified state pairs from the synchronous product of `DES1` and `DES2`.

The resulting automaton is stored as `DES3`.

## Description

The function first computes the synchronous product of `DES1` and `DES2`, and then excludes the state pairs specified in `pair_state`.

This function is commonly used to model:

- mutual exclusion constraints,
- collision avoidance,
- forbidden shared-resource states,
- safety specifications in supervisory control.

---

## Parameters

| Name         | Type            | Description                                      | Default |
|------        |------           |--------------------------------------------------|---------|
| `DES3`       | string          | Name of the generated automaton.                 | *required* |
| `DES1`       | string          | First automaton used in the synchronous product. | *required* |
| `DES2`       | string          | Second automaton used in the synchronous product. | *required* |
| `pair_state` | list[list[int]] | List of forbidden state pairs to exclude from the product automaton. Each entry `[i, j]` represents the forbidden pair `(state i of DES1, state j of DES2)`. | *required* |

---

## Returns

| Type      | Description |
|-----------|------------ |
| automaton | A new automaton satisfying the mutual exclusion constraints. |

---

## Example

```python title="sample 1"
import pitct

delta1 = [
    (0, 10, 1),
    (1, 12, 0),
]

Qm = [0]

pitct.create("DES1", 2, delta1, Qm)

delta2 = [
    (0, 11, 1),
    (1, 10, 2),
    (2, 10, 0),
]

pitct.create("DES2", 3, delta2, Qm)

# Forbidden state pairs:
# (DES1 state 1, DES2 state 1)
# (DES1 state 1, DES2 state 2)

pair_state = [
    [1, 1],
    [1, 2],
]

pitct.mutex("DES3", "DES1", "DES2", pair_state)

Notes

  • The forbidden state pairs are removed from the reachable synchronous product automaton.
  • This function is useful for automatically generating safety specifications.
  • Typical applications include AGV systems, resource allocation systems, and collision avoidance problems.