Exemple #1
0
        /// @param x double[]	origin of projected function
        /// @exception DhbIllegalDimension
        ///						if dimension of x is not that of the origin.
        public DhbVector ArgumentAt(double x)
        {
            DhbVector v = _direction * x;

            v.Accumulate(_origin);
            return(v);
        }
Exemple #2
0
        /// @return DhbVector	center of gravity of best points of simplex,
        ///													except worst one
        private DhbVector CenterOfGravity()
        {
            DhbVector g = new DhbVector(_result.Length);

            for (int i = 0; i < _result.Length; i++)
            {
                g.Accumulate(_simplex[i].Position);
            }
            g.ScaledBy(1.0 / _result.Length);
            return(g);
        }
Exemple #3
0
        /// @return boolean	true if a better point was found
        /// @param g DhbVector	summit whose median is contracted
        /// @exception DhbIllegalDimension if dimension of initial value is 0.
        private bool AddContraction(DhbVector g)
        {
            g.Accumulate(_simplex[_result.Length].Position);
            g.ScaledBy(0.5);
            OptimizingVector contractedPoint = _pointFactory.CreateVector(g, _f);

            if (contractedPoint.BetterThan(_simplex[0]))
            {
                AddBestPoint(contractedPoint);
                return(true);
            }
            else
            {
                return(false);
            }
        }