Ejemplo n.º 1
0
        protected void initWeight(int m)
        {
            this.weights = new List <double[]>();
            if (numObjectives < 6)
            {
                this.weights = UniPointsGenerator.getMUniDistributedPoint(numObjectives, m);
            }
            else
            {
                this.weights = UniPointsGenerator.getMaUniDistributedPoint(numObjectives, m, 2);
            }

            for (int i = 0; i < this.weights.Count; i++)
            {
                double std = Tool.VectorLen(weights[i]);
                for (int j = 0; j < this.numObjectives; j++)
                {
                    this.weights[i][j] /= std;
                }
            }

            this.popsize = this.weights.Count();

            Vectors = new List <double[]>();
            Vectors.AddRange(weights);
        }
Ejemplo n.º 2
0
        protected void InitWeight(int m)
        {
            this.weights = new List<double[]>();
            if (numObjectives < 6) this.weights = UniPointsGenerator.getMUniDistributedPoint(numObjectives, m);
            else this.weights = UniPointsGenerator.getMaUniDistributedPoint(numObjectives, m, 2);

            this.popsize = this.weights.Count();
            this.baseNum = this.popsize;
        }
Ejemplo n.º 3
0
        protected void AdjustReferencePoints()
        {
            List<double[]> wNew = new List<double[]>();

            List<List<MoChromosome>> associatedSolution = Clustering(mainpop);
            

            List<double[]> wNew1 = new List<double[]>();

            for (int i = 0; i < this.weights.Count(); i++)
            {
                //sort1(associatedSolution[i]);
                if (associatedSolution[i].Count() > 0) wNew.Add(this.weights[i]);
                else wNew1.Add(this.weights[i]);
            }

            if (wNew.Count() > 0.9 * popsize) return;

            List<double[]> result = new List<double[]>();
            List<double[]> temp = new List<double[]>();


            int n = GetH((int)(popsize * baseNum * 1.0 / wNew.Count()), this.numObjectives);
            temp = UniPointsGenerator.getMUniDistributedPoint(numObjectives, n);


            baseNum = temp.Count();

            double dt = threshold;
            threshold = GetThreshold(temp);

            for (int i = 0; i < temp.Count(); i++)
            {
                double min = Double.MaxValue;
                for (int j = 0; j < wNew.Count(); j++)
                {
                    double tp2 = Distance(temp[i], wNew[j]);
                    if (tp2 < min) min = tp2;
                }

                if (min <= dt)
                {
                    result.Add(temp[i]);
                }
            }
            weights.Clear();
            weights.AddRange(result);
            H = n;
        }
Ejemplo n.º 4
0
        protected void InitWeight(int m)
        {
            this.weights = new List <double[]>();
            if (numObjectives < 6)
            {
                this.weights = UniPointsGenerator.getMUniDistributedPoint(numObjectives, m);
            }
            else
            {
                this.weights = UniPointsGenerator.getMaUniDistributedPoint(numObjectives, m, 2);
            }

            this.popsize = this.weights.Count();
            k            = (int)Math.Sqrt(2 * popsize);
        }
Ejemplo n.º 5
0
        protected void initWeight(int m)
        {
            this.weights = new List <double[]>();
            if (numObjectives < 6)
            {
                this.weights = UniPointsGenerator.getMUniDistributedPoint(numObjectives, m);
            }
            else
            {
                this.weights = UniPointsGenerator.getMaUniDistributedPoint(numObjectives, m, 2);
            }

            this.K       = this.weights.Count();
            this.S       = this.K;
            this.popsize = K * S;
        }
Ejemplo n.º 6
0
        private static double DTLZIGD(List <double[]> solution, string prob, int objs)
        {
            List <double[]> list = new List <double[]>();
            int             div  = 0;

            switch (objs)
            {
            case 3:
                div = 12;
                break;

            case 5:
                div = 6;
                break;

            case 8:
                div = 3;
                break;

            case 10:
                div = 3;
                break;

            case 15:
                div = 2;
                break;
            }

            if (objs < 6)
            {
                list = UniPointsGenerator.getMUniDistributedPoint(objs, div);
            }
            else
            {
                list = UniPointsGenerator.getMaUniDistributedPoint(objs, div, 2);
            }

            List <double[]> front = new List <double[]>();

            if (prob.IndexOf("DTLZ1") != -1)
            {
                for (int i = 0; i < list.Count(); i++)
                {
                    double[] arr = new double[objs];
                    double   sum = 0.0;
                    for (int j = 0; j < objs; j++)
                    {
                        sum += list[i][j];
                    }
                    for (int j = 0; j < objs; j++)
                    {
                        arr[j] = 0.5 * list[i][j] / sum;
                    }
                    front.Add(arr);
                }
            }
            else
            {
                for (int i = 0; i < list.Count(); i++)
                {
                    double[] arr = new double[objs];
                    double   sum = 0.0;
                    for (int j = 0; j < objs; j++)
                    {
                        sum += list[i][j] * list[i][j];
                    }
                    sum = Math.Sqrt(sum);
                    for (int j = 0; j < objs; j++)
                    {
                        arr[j] = list[i][j] / sum;
                    }
                    front.Add(arr);
                }
            }
            return(IGD(solution, front));
        }