Exemplo n.º 1
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;

            double f1 = 1 - System.Math.Exp((-4) * x[0]) * System.Math.Pow(System.Math.Sin(5 * System.Math.PI * x[0]), 4);

            if (objective_index == 0)
            {
                return(f1);
            }
            else
            {
                double f2, g, h;
                if (x[1] > 0 && x[1] < 0.4)
                {
                    g = 4 - 3 * System.Math.Exp(-2500 * (x[1] - 0.2) * (x[1] - 0.2));
                }
                else
                {
                    g = 4 - 3 * System.Math.Exp(-25 * (x[1] - 0.7) * (x[1] - 0.7));
                }
                double a = 4;
                if (f1 < g)
                {
                    h = 1 - System.Math.Pow(f1 / g, a);
                }
                else
                {
                    h = 0;
                }
                f2 = g * h;
                return(f2);
            }
        }
Exemplo n.º 2
0
        public override void OnePointCrossover(MOOSolution rhs)
        {
            if (mData.Count == 1)
            {
                return;
            }

            int cut_point = 1;

            if (mData.Count > 2)
            {
                cut_point = DistributionModel.NextInt(mData.Count);
            }

            ContinuousVector rhs_vector = (ContinuousVector)rhs;

            double temp = 0;

            for (int dimension = 0; dimension != cut_point; ++dimension)
            {
                temp                  = this[dimension];
                this[dimension]       = rhs_vector[dimension];
                rhs_vector[dimension] = temp;
            }
        }
Exemplo n.º 3
0
        double IMOOProblem.CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;

            object[] currentParams = new object[x.Length];
            for (int i = 0; i < x.Length; i++)
            {
                currentParams[i] = x[i];
            }
            return((double)Calculate(currentParams));
        }
Exemplo n.º 4
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;
            double           f = 0;

            switch (objective_index)
            {
            case 0:
                SYMPART_f1(x, out f, 6, 3);
                break;

            case 1:
                SYMPART_f2(x, out f, 6, 3);
                break;
            }
            return(f);
        }
Exemplo n.º 5
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;

            double f1 = 1;
            double f2 = 1;

            if (objective_index == 0)
            {
                //f1 = CalculateCoupling(s.Rank);
                f1 = MinimizeNoOfTestCases(s.Rank);
                return(f1);
            }
            else
            {
                //f2 = CalculateCohesion(s.Rank);
                f2 = MaximizeMMCoverage(s.Rank);
                return(f2);
            }
        }
Exemplo n.º 6
0
        public override void UniformCrossover(MOOSolution rhs)
        {
            ContinuousVector rhs_vector = (ContinuousVector)rhs;

            int length = mData.Count;

            for (int dimension = 0; dimension != length; ++dimension)
            {
                double val1 = this[dimension];
                double val2 = rhs_vector[dimension];
                if (DistributionModel.GetUniform() < 0.5)
                {
                    this[dimension] = val2;
                }

                if (DistributionModel.GetUniform() < 0.5)
                {
                    rhs_vector[dimension] = val1;
                }
            }
        }
Exemplo n.º 7
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;

            if (objective_index == 0)
            {
                double h = GetNGPDConstraints(x[0], x[1], x[2], x[3]);
                double f = 1.10471 * x[0] * x[0] * x[2] + 0.04811 * x[3] * x[1] * (14.0 + x[2]) - 5 - M * h;
                return(f);
            }
            else if (objective_index == 1)
            {
                double h = GetNGPDConstraints(x[0], x[1], x[2], x[3]);
                double f = 2.1952 / (x[3] * x[3] * x[3] * x[1]) - 0.0001 - M * h;
                return(f);
            }
            else
            {
                throw new ArgumentException("objective_index cannot be greater than 1");
            }
        }
Exemplo n.º 8
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;
            double           f = 0;

            switch (objective_index)
            {
            case 0:
            {
                f = x[0];
                break;
            }

            case 1:
            {
                f = 1 - System.Math.Pow((x[0] + System.Math.PI), 2) / (4 * System.Math.Pow(System.Math.PI, 2)) + System.Math.Pow(System.Math.Abs(x[1] - 5 * System.Math.Cos(x[0])), 1.0 / 3.0) + System.Math.Pow(System.Math.Abs(x[2] - 5 * System.Math.Sin(x[0])), 1.0 / 3.0);
                break;
            }
            }
            return(f);
        }
Exemplo n.º 9
0
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            ContinuousVector x = (ContinuousVector)s;
            double           h = 0, f = 0;

            switch (objective_index)
            {
            case 0:
            {
                h = GetTNKConstraints(x[0], x[1]);
                f = x[0] + M * h;
                break;
            }

            case 1:
            {
                h = GetTNKConstraints(x[0], x[1]);
                f = x[1] + M * h;
                break;
            }
            }
            return(f);
        }
Exemplo n.º 10
0
 bool IMOOProblem.IsFeasible(MOOSolution s)
 {
     return(true);
 }
Exemplo n.º 11
0
 public bool IsFeasible(MOOSolution s)
 {
     return(true);
 }
Exemplo n.º 12
0
        /// <summary>
        /// Implement IProblem.CalcObjective interface method
        /// </summary>
        /// <param name="s"></param>
        /// <param name="objective_index"></param>
        /// <returns></returns>
        public double CalcObjective(MOOSolution s, int objective_index)
        {
            S original_solution = Convert2SolutionForOriginalProblem(s as S);

            return(mOriginalProblem.CalcObjective(original_solution, mObjectiveIndex));
        }
Exemplo n.º 13
0
        public bool IsFeasible(MOOSolution s)
        {
            S original_solution = Convert2SolutionForOriginalProblem(s as S);

            return(mOriginalProblem.IsFeasible(original_solution));
        }