Example #1
0
        /// <summary>
        /// Performs a SCALE on a Fuzzy Set
        /// </summary>
        /// <param name="fs">The Fuzzy Set to Scale</param>
        /// <param name="val">The scalar amount to Scale the Set</param>
        /// <returns></returns>
        public static FuzzySet ScaleFS(FuzzySet fs, double val)
        {
            FuzzySet retSet = new FuzzySet();

            if (fs == null)
            {
                retSet.SetErr(10);
                return retSet;
            }

            retSet = new FuzzySet(fs);

            if (retSet.Invalid())
            {
                retSet.SetErr(10);
                return retSet;
            }

            int i;
            for (i = 0; i < retSet.GetNumPoints(); i++)
            {
                double w = retSet.GetWorldValue(i);
                double s = retSet.GetSetValue(i) * val;
                if (s > 1) s = 1;
                if (s < 0) s = 0;
                retSet.AdjustPoint(i, w, s);
            }

            return retSet;
        }