This is an excellent question asked by one of my students. I imagine the answer is "no", but it doesn't strike me as easy.

Recall the set up of the stable marriage problem. We have $n$ men and $n$ women. Each man has sorted the women into some order, according to how much he likes them, and each women has likewise ranked the men. We want to pair off the men with the women so that there do NOT exist any pairs $(m,w)$ and $(m', w')$ where

- $m$ prefers $w'$ to $w$ and
- $w'$ prefers $m$ to $m'$.

It is a theorem of Gale and Shapley that such an assignment is always possible.

Here is a potential way you could try to find a stable matching. Choose some function $f: \{ 1,2,\ldots, n \}^2 \to \mathbb{R}$. Take the complete bipartite graph $K_{n,n}$, with white vertices labeled by men and black vertices by women, and weight the edge $(m,w)$ by $f(i,j)$ if $w$ is $m$'s $i$-th preference, and $m$ is $w$'s $j$-th preference. Then find a perfect matching of minimal weight, using standard algorithms for the assignment problem.

Is there any function $f$ such that this method works for all preference lists?