Back to index

wims  3.65+svn20090927
Static Public Member Functions
rene.zirkel.expression.ConvexMin Class Reference

List of all members.

Static Public Member Functions

static double computeMin (FunctionObject F, double a, double b, double eps) throws ConstructionException
static double computeMax (FunctionObject F, double a, double b, double eps) throws ConstructionException

Detailed Description

Definition at line 10 of file ConvexMin.java.


Member Function Documentation

static double rene.zirkel.expression.ConvexMin.computeMax ( FunctionObject  F,
double  a,
double  b,
double  eps 
) throws ConstructionException [inline, static]

Definition at line 34 of file ConvexMin.java.

       {      double lambda=(Math.sqrt(5)-1)/2;
              double x2=lambda*a+(1-lambda)*b;
              double y2=F.evaluateF(x2);
              double x3=(1-lambda)*a+lambda*b;
              double y3=F.evaluateF(x3);
              while (b-a>eps)
              {      if (y2>y3)
                     {      b=x3; x3=x2; y3=y2;
                            x2=lambda*a+(1-lambda)*b; y2=F.evaluateF(x2);
                     }
                     else
                     {      a=x2; x2=x3; y2=y3;
                            x3=(1-lambda)*a+lambda*b; y3=F.evaluateF(x3);
                     }
              }
              return (a+b)/2;
       }

Here is the caller graph for this function:

static double rene.zirkel.expression.ConvexMin.computeMin ( FunctionObject  F,
double  a,
double  b,
double  eps 
) throws ConstructionException [inline, static]

Definition at line 12 of file ConvexMin.java.

       {      double lambda=(Math.sqrt(5)-1)/2;
              double x2=lambda*a+(1-lambda)*b;
              double y2=F.evaluateF(x2);
              double x3=(1-lambda)*a+lambda*b;
              double y3=F.evaluateF(x3);
              while (b-a>eps)
              {      if (y2<y3)
                     {      b=x3; x3=x2; y3=y2;
                            x2=lambda*a+(1-lambda)*b; y2=F.evaluateF(x2);
                     }
                     else
                     {      a=x2; x2=x3; y2=y3;
                            x3=(1-lambda)*a+lambda*b; y3=F.evaluateF(x3);
                     }
              }
              return (a+b)/2;
       }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: