3

I need to minimize a 2D function f(x,y). I already have 1-D minimization using Brent's Method (similar to bisectional search for finding a root.) I thought a 2D version would be a pretty straightforward, common problem that would have lots of good algorithms and libraries, but I haven't found any. I'm thinking of just using Downhill Simplex from Numerical Recipes, but I thought there might be an easier one for just 2D, or a handy library.

For the interested, here are some more details:

I am actually trying to find a line that minimizes a point between two 1D functions, AKA the bitangent. The 1D functions generally look like parabolas, and they cross at some point. The crossing point gives the X of the point to minimize, and I want to find a line that tangents the parabolas that minimizes Y at that X.

So, I really am minimizing g( f1(x1), f2(x2) ).

Unfortunately, I don't have any more information about f1() and f2(). The functions are selected, or even provided, by the user. If the user provides the data, I get the functions as a set of points. I can do interpolation to get a pretty good numerical derivative at any point on the line, but that's about it. The previous developer thought minimization was the most general way to find the bitangent. I'm still trying to figure out if he was correct.

Jim
  • 651
  • 2
  • 7
  • 15
  • you need to provide more information about f1() and f2(). "generally look like parabolas" is not very precise. Simplex is quite strict about functions it works on. – Michał Šrajer Feb 05 '14 at 08:10
  • There is something wrong in this problem statement: the line that tangents the two curves is unique, there is nothing you can minimize! (My guess: the bitangent IS the line that minimizes the ordinate - for any X.) –  Feb 05 '14 at 08:24
  • I edited to clear up a few details. Hopefully it's more clear now. – Jim Feb 05 '14 at 16:52

3 Answers3

1

I understand you want to minimize g(f1(x),f2(y)) = h(x,y). Downhill Simplex might be a good solution to your problem, since it's straightforward to implement if you have NR. Another possible method may be Broyden's one. However, since you have the derivatives, you could use algorithms expoiting that information too. For e.g. Conjugate Gradient method there is a implementation in NR (or at least NR3).

In case you can provide grad(h) to be really simple, that is grad(h)[1] depending on one and grad(h)[2] on the other variable, it may be easiest to solve for grad(h) = 0 and check if it's a minimum. Even if the gradient isn't that simple you might be able to solve the problem by hand and provide a general formula which does the job if f1 and f2 follow a certain pattern (e.g. if they only differ concerning parameters).

Aduait Pokhriyal
  • 1,529
  • 14
  • 30
Matz
  • 583
  • 1
  • 6
  • 21
1

Conjugate gradient minimization will probably do.

But your problem can also be formulated as a system of two equations in two unknowns instead.

You know the curves and their slopes, so for a given X1 you can find the ordinate Z1(X1) where the tangent to curve 1 intersects the vertical through X. And similarly Z2(X2). At the same time consider the ordinate of the intersection between the vertical and the line through the two tangency points, Z(X1, X2).

Z1(X1) = Y1(X1) + Y1'(X1).(X1 - X)

Z2(X2) = Y2(X2) + Y2'(X2).(X2 - X)

Z(X1, X2) = ((X1 - X).Y2(X2) - (X2 - X).Y1(X1)) / (X1 - X2)

You now have to solve Z1(X1) = Z2(X2) = Z(X1, X2), possibly using the same method that you used to find the value of X.

  • This will find the bitangent solution (see my comment to the question). –  Feb 05 '14 at 08:21
1

The Gnu Scientific Library has the minimization functions I need, so I'm integrating it. The answers provided were quite good, but they didn't quite turn out to be the best solution in my case. Largely because I didn't state the problem clearly enough.

Jim
  • 651
  • 2
  • 7
  • 15