Example #1
0
        internal OptSimplexBoundVariable GetClon()
        {
            OptSimplexBoundVariable clon = new OptSimplexBoundVariable(this._Name, this._InitialGuess, this._LowerBound, this._UpperBound, this._ScaleFactor);

            clon.Fixed = this._Fixed;
            return(clon);
        }
Example #2
0
 internal static OptSimplexBoundVariable[] GetClon(OptSimplexBoundVariable[] variables)
 {
     OptSimplexBoundVariable[] cloned = new OptSimplexBoundVariable[variables.Length];
     for (int i = 0; i < variables.Length; i++)
     {
         cloned[i] = variables[i].GetClon();
     }
     return(cloned);
 }
Example #3
0
        private OptSimplexBoundVariable[] GetVariables(OptBoundVariable[] variablesArray)
        {
            OptSimplexBoundVariable[] vars = new OptSimplexBoundVariable[variablesArray.Length];

            for (int i = 0; i < variablesArray.Length; i++)
            {
                OptBoundVariable var = variablesArray[i];

                vars[i] = new OptSimplexBoundVariable(var.Name, var.InitialGuess, var.Fixed, var.LowerBound, var.UpperBound);
            }

            return(vars);
        }
Example #4
0
        private int GetNumFreeVariable(OptSimplexBoundVariable[] variables)
        {
            int numFreeVariables = 0;
            foreach (OptSimplexBoundVariable var in variables)
            {
                if (var.Fixed == false) numFreeVariables++;
            }

            return numFreeVariables;
        }
Example #5
0
        private OptSimplexBoundVariable[] GetVariables(OptBoundVariable[] variablesArray)
        {
            OptSimplexBoundVariable[] vars = new OptSimplexBoundVariable[variablesArray.Length];

            for (int i = 0; i < variablesArray.Length; i++)
            {

                OptBoundVariable var = variablesArray[i];

                vars[i] = new OptSimplexBoundVariable(var.Name, var.InitialGuess, var.Fixed, var.LowerBound, var.UpperBound);
            }

            return vars;
        }
Example #6
0
        private double[] GetMinimum(OptMultivariateFunction function, OptSimplexBoundVariable[] variables, double initialStep, double tolerance, ref int MAXFUN)
        {
            if (this._CobylaDriver == null) this._CobylaDriver = new CobylaDriver();

            double[] minimum = this._CobylaDriver.ComputeMin(function, variables, initialStep, tolerance, ref MAXFUN);

            this.FunEvaluations = MAXFUN;
            return minimum;
        }
Example #7
0
        private double GetAutomaticInitialStep(OptSimplexBoundVariable[] variables)
        {
            int numFreeVariables = this.GetNumFreeVariable(variables);
            if (numFreeVariables == 0) return 1;

            double step = 0;

            double sum = 0;
            foreach (OptSimplexBoundVariable var in variables)
            {
                if (var.Fixed == false)
                {
                    //mod
                    sum += Math.Abs(var.InitialGuess / var.ScaleFactor);
                }
            }

            if (sum != 0)
            {
                step = sum / (2.0 * numFreeVariables);
            }
            else
            {
                step = 1;
            }

            return step;
        }
Example #8
0
        /// <summary>
        /// Computes the minimum point of a function of several variables.
        /// </summary>
        /// <param name="function">The function to minimize.</param>
        /// <param name="variables">Array of size N containing the varaibles.</param>
        /// <param name="initialStep">The initial change of the variables.</param>
        /// <returns>Array containing the solution.</returns>
        public double[] ComputeMin(OptMultivariateFunction function, OptSimplexBoundVariable[] variables, float initialStep)
        {
            if (variables == null) return new double[0];
            if (variables.Length == 0) return new double[0];

            int maxFunc = this._MaxFunEvaluations;

            return this.GetMinimum(function, variables, initialStep, this._Tolerance, ref maxFunc);
        }
 internal OptSimplexBoundVariable GetClon()
 {
     OptSimplexBoundVariable clon = new OptSimplexBoundVariable(this._Name, this._InitialGuess, this._LowerBound, this._UpperBound, this._ScaleFactor);
     clon.Fixed = this._Fixed;
     return clon;
 }
 internal static OptSimplexBoundVariable[] GetClon(OptSimplexBoundVariable[] variables)
 {
     OptSimplexBoundVariable[] cloned = new OptSimplexBoundVariable[variables.Length];
     for (int i = 0; i < variables.Length; i++)
     {
         cloned[i] = variables[i].GetClon();
     }
     return cloned;
 }