Is there a function $*:\mathbb{Z}\times\mathbb{Z}\to\mathbb{R}$ which has a "retraction" which ignores order in $\mathbb{Z}\times\mathbb{Z}$? When working with machine learning models I came across a regression model that has 2 integer outputs for which the order doesn't matter. It would be convenient to map this two outputs into one real one such that the integers can be recoverd from this real number. Thus the question:
Is there any function $*:\mathbb{Z}\times\mathbb{Z}\to\mathbb{R}$ with associated map $A:Im(*)\to\mathbb{Z}\times\mathbb{Z}$ such that for any $p,q\in\mathbb{Z}$
$$A(p*q)=(p,q) \vee A(p*q)=(q,p)$$
 A: If "$X \vee Y = Z$"  means just that at least one of $X, Y$ is $Z$ then all you are really asking is that
$$
A(p*q) = (q,p)
$$
since then
$$
(p,q) \vee (q,p) = (q,p)
$$
will be true.
There are lots of pairs of functions  $(*, A)$ that will do. You just have to encode a pair as a single number that uniquely determines both $p$ and $q$. Then let  $A$ be the function for which
$$
A(p*q) = (q,p) ,
$$
If there is a bound $b$ on nonnegative inputs just convert $(p,q)$ to a  digit base $b$ integer:
$$
p*q = pb + q.
$$
For arbitrary integer inputs, setting
$$
p*q = 2^p3^q
$$
produces a rational number from which you can recover $p$ and $q$ by factoring.
If you want integer rather than a rational output use $2^p$ or $3^{-p}$ depending on the sign of $p$, and a power of $5$ or $7$ to encode $q$.
There are many other strategies. Picking one that works best for the application depends on context you haven't provided.
A: Without any constraints on $\ast$ and $A$, this simply follows from cardinality arguments. Since $|\mathbb{Z}\times \mathbb{Z}|\le |\mathbb{R}|$ (via the well known fact that $\mathbb{Z}^2$ is countable and $\mathbb{R}$ is uncountable), there must exist an injective function $\ast : \mathbb{Z}\times\mathbb{Z}\to \mathbb{R}$. When restricted to it's image this function $\ast$ will have an inverse $A$.
Explicit examples are numerous and given by some of the comments and other answers. 
