Example #1
0
 /** Get the value of the minimum, i.e. the value associated with the resulting parameters
  *  as obtained by getParams(). May return NaN in case the minimize call has returned
  *  an INITIALIZATION_FAILURE status or that abort() has been called at the very
  *  beginning of the minimization.
  *  Do not call this method before minimization. */
 public double getFunctionValue()
 {
     if (result == null)
     {
         result = new double[numParams + 1];
         Java.DoubleArrayFill(result, double.NaN);
     }
     return(value(result));
 }
Example #2
0
 /** Get the result, i.e., the set of parameter values (i.e., variable values)
  *  from the best corner of the simplex. Note that the array returned may have more
  *  elements than numParams; ignore the rest.
  *  May return an array with only NaN values in case the minimize call has returned
  *  an INITIALIZATION_FAILURE status or that abort() has been called at the very
  *  beginning of the minimization.
  *  Do not call this method before minimization. */
 public double[] getParams()
 {
     if (result == null)
     {
         result = new double[numParams + 1 + numExtraArrayElements];
         Java.DoubleArrayFill(result, double.NaN);
     }
     return(result);
 }
Example #3
0
        /** Get center of all vertices except one to exclude
         *  (may be -1 to exclude none)
         *  Does not care about function values (i.e., last array elements) */
        private void getCenter(List <double[]> simp, int excludeVertex, double[] center)
        {
            Java.DoubleArrayFill(center, 0.0);
            int nV = 0;

            for (int v = 0; v < numVertices; v++)
            {
                if (v != excludeVertex)
                {
                    for (int i = 0; i < numParams; i++)
                    {
                        center[i] += simp[v][i];
                    }
                    nV++;
                }
            }
            double norm = 1.0 / nV;

            for (int i = 0; i < numParams; i++)
            {
                center[i] *= norm;
            }
        }