In an application, a solution may be available in 0 < x ≤ 25, 0 < y ≤ 25. To compare different solutions and choose an optimal one, I would like a function f(x, y) such that:
- $f(x,y)=f(y,x)$
- $f(x, k)$ for $0 < x ≤ 25$ has a maximum at $x=k$
- $f(k,y)$ for $0 < y ≤ 25$ has a maximum at $y=k$
- $f(x−k,y−k)>f(x,y)$ for $k > 0$
Imagine a pole at $(0,0)$, then tying a loose string to $(25, 25)$ at closer to ground level, then draping a sheet over that, so that the sheet forms a ridge from $(0,0)$ to $(25, 25)$ that tapers down to the sides.
Ideally $f$ would be continuous and not too computationally intensive.
Getting a local maximum at $f(0⁺ ,0⁺)$ is easy enough, e.g. $f(x,y)=\frac{1}{x^2+y^2}$, but I can’t seem to get the “ridge”.
Any suggestions would help, thank you.
Inspired by some suggestions from Vasily Mitch, while not exactly computationally light, this one meets the criteria:
$$f(x, y) = -\log((x^2+y^2)(1+(x-y)^2))$$
The equivalent is “flipping” the problem around and using the minimum solutions of:
$$f(x, y) = (x^2+y^2)(1+(x-y)^2)$$
While it doesn’t have the striking features of the previous, it generates the same preferred solutions.
Edit: I found the function above too heavily biased for solutions along the ridge, so instead used:
$$f(x, y) = x^2+y^2+(x-y)^2$$
Which gives a much gentler bias to the ridge.