Random Notes...

Nelder-Mead Simplex Method

I have updated the the C code available here to allow for constraints. The latest version can be found here. The example compiles with gcc: gcc -Wall -o testfun testfun.c nmsimplex.c

	  Iteration 60
	  0.990000 0.980000 0.000101
	  1.000000 1.000000 0.000000
	  0.980000 0.960000 0.000416
	  Iteration 61
	  0.990000 0.980000 0.000101
	  1.000000 1.000000 0.000000
	  1.000000 1.000000 0.000000
	  The minimum was found at
	  1.000000e+00
	  1.000000e+00
	  123 Function Evaluations
	  61 Iterations through program
	
Implementation in java.

One Dimensional Optimization Using Nelder-Mead

The following is an example of using Nelder-Mead for a one dimensional optimization problem. The problem is to find the value of a load resistor that will cause maximum power to be delivered to the load. For this example I used a simple voltage divider circuit consisting of a single 9V source with two resistors in series (1000 ohm and 470 ohm) with the output taken across the 470 ohm resistor. From the Thevenin equivalent circuit we know that the optimium load resistor value for max power transfer should be 319.73 ohms. The source code for this problem can be found here. The program produces the following output starting with an initial guess of RL=100 ohms:

	  RL:320.000000 P:0.006474
	  29 Function Evaluations
	  13 Iterations through program
	

Older Implementations

I originally coded the Nelder-Nead simplex method in C, crosen.c, and then ported it to FORTRAN 77, frosen.f and FORTRAN 90, frosen.90. The C and FORTRAN 77 versions compile with gcc and g77 respectively. The FORTRAN 90 version compiles with ELF90.

The programs have all been tested with Rosenbrock's function starting at -1.2,1.0 and converge after 54 iterations and 107 function evaluations. In each case the initial simplex is constructed as a regular simplex, as opposed to taking a particular step in the n coordinate directions from the starting point.

Creating the initial simplex in this way means that it may have to be scaled. However, I've found that I get better results this way, at least in my applications - Impedance matching, Optimization of antenna arrays.

nmsimplex.c contains the Nelder-Mead algorithm as specified in Margaret H. Wright's paper on Direct Search Methods. It was tested with Rosenbrock's function, as before, with a starting point of -1.2,1.0 and converged after 53 iterations and 105 function evaluations.

Reference

D. J. Wilde and C. S. Beightler, Foundations of Optimization. Englewood Cliffs, N.J., Prentice-Hall, 1967.

© 2003-2011 Michael F. Hutt. All Rights Reserved.