Declaring a variable to be any element of a given set

46 Views Asked by At

Let $A \in \mathbb{R}^{m\times n}$. The element in the i:th row, j:th column is denoted as $A(i,j)$. I am writing an algorithm/a pseudocode where I want to declare a variable pair $(i, j)$ which satisfies $$ (i, j) \in \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\}, $$ i.e, $(i,j)$ is a position where the corresponding matrix entry is the smallest. Depending on the matrix, this might not be unique. I have written

$$ (i, j) \gets \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\} $$ to my pseudocode. However, I am not sure if this is 'morally' correct, as I am not explicitly stating what $(i, j)$ is and the choice might not be unique. Mathematically it is clearly incorrect, as $\arg \min$ is a set of positions, and $(i,j)$ is an element of that set.

I could of course write an algorithm which goes through all the positions $(i, j)$ and uses some rule to choose the position, but that would be too thorough for my purposes. Is it common to declare a variable by writing e.g. $$ (i, j) \in \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\}, $$ or what would be the standard notation in this kind of a variable declaration?

1

There are 1 best solutions below

0
On

You are correct in noting that $(i, j)$ is not unique and that

$$ X \gets \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\}$$

is the set of all $(i, j)$ pairs that minimize the expression. Any correct assignment must make use of some property that one and only one $x \in X$ satisfies. Since each $(i, j)$ is unique, such uniqueness can be used. For example

$$ X \gets \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\} \\ x \gets (i, j) \in X \mid \forall (w, z), (i, k) \in X: i \leq w, j \leq k$$

We are setting $x$ to be the unique element of $X$ whose row index $i$ is lower or equal than all other row indexes, and $j$ to be the column index among all pairs with row index $i$ with the least column index.

For example, if $X = \{(1, 2), (1, 9), (5, 1), (2, 1) \}$ the first condition demands $i=1$ and the second condition demands $j = 2$. To be overly repeating, note that the second condition inspects the column indexes of only $(1, 2), (1, 9)$, since it already assumes $i = 1$.

This assignment is a shorthand for

$$\begin{align} X &\gets \underset{(i, j)}{\arg\min} \left\{ {A}(i,j) \mid 1 \le i \le m, 1 \le j \le n\right\} \\ X' &\gets \{(i, j) \in X \mid \forall (w, z) \in X: i \leq w\} \\ x &\gets (i, j) \in X' \mid \forall(i, k) \in X': j \leq k \end{align}$$