Optimizers
Class ConstrainedDownhillSimplex

java.lang.Object
  extended byOptimizers.Optimizer
      extended byOptimizers.ConstrainedDownhillSimplex

public abstract class ConstrainedDownhillSimplex
extends Optimizer

Downhill simplex optimizer as described in NR and constrained to remain in a search domain. Primitive implementation. If the simplex is too close to the boundary to carry out the next step it shrinks itself once and changes direction.


Constructor Summary
ConstrainedDownhillSimplex(double[] x, double[] delta, int nStep, boolean verbose)
          Initial simplex has vertices x, x+delta*e_j.
 
Method Summary
 void contract(int i)
          Contracts the simplex by a factor of two in the direction of vertex i (which remains unaffected).
 void copy(double[] a, double[] b)
          Copies the array b into a.
abstract  boolean isInDomain(double[] x)
          SEARCH DOMAIN
static void main(java.lang.String[] args)
          Test program.
 double reflectVertex(int i, double k)
          vertex[i] is reflected at the barycenter of the convex hull of the remaining vertices (the opposing face) by a factor k.
 void replaceWorst(double w)
          Exchanges vertex[max] (the worst vertex) with newVertex and updates the barycenter and function values.
 double[] search()
          SEARCH FOR THE MINIMUM
 
Methods inherited from class Optimizers.Optimizer
f
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstrainedDownhillSimplex

public ConstrainedDownhillSimplex(double[] x,
                                  double[] delta,
                                  int nStep,
                                  boolean verbose)

Initial simplex has vertices x, x+delta*e_j. Make sure delta is chosen so that this point is in the search domain.

Parameters:
x - starting point (initial simplex built around it)
delta - size of initial simplex
nStep - number of steps
Method Detail

isInDomain

public abstract boolean isInDomain(double[] x)
SEARCH DOMAIN


copy

public void copy(double[] a,
                 double[] b)
Copies the array b into a.


reflectVertex

public double reflectVertex(int i,
                            double k)

vertex[i] is reflected at the barycenter of the convex hull of the remaining vertices (the opposing face) by a factor k. If k is positive we land at the other side of the face, if negative we land at the same side of the face. Writes the resulting vertex into the field newVertex.

If new vertex is better than the worst existing (highest) vertex this vertex is exchanged with the new vertex. Assumes that the variable center is kept current at the barycenter of the whole simplex.

Returns:
function value at reflected vertex.

contract

public void contract(int i)

Contracts the simplex by a factor of two in the direction of vertex i (which remains unaffected).

Parameters:
i - number of vertex which remains fixed.

replaceWorst

public void replaceWorst(double w)

Exchanges vertex[max] (the worst vertex) with newVertex and updates the barycenter and function values. The value w=f(newVertex) is passed as a parameter to save on function evaluations.

Parameters:
w - must be f(newVertex).

search

public double[] search()
SEARCH FOR THE MINIMUM

Specified by:
search in class Optimizer
Returns:
the minimizing vector x.

main

public static void main(java.lang.String[] args)

Test program.