示例#1
0
        protected override void doSolve()
        {
            initial();
            frm = new plotFrm(mainpop, mop.getName());
            frm.Show();
            frm.Refresh();
            while (!terminated())
            {
                List <MoChromosome> offsPop = new List <MoChromosome>();

                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offspring;
                    offspring = SBXCrossover(i, false);//GeneticOPDE//GeneticOPSBXCrossover
                    this.evaluate(offspring);
                    offsPop.Add(offspring);
                }

                List <MoChromosome> Pop = new List <MoChromosome>();
                Pop.AddRange(mainpop);
                Pop.AddRange(offsPop);

                EnviromentSelection(Pop);

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();
                }

                ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
        }
示例#2
0
        protected override void doSolve()
        {
            initial();
            frm = new plotFrm(mainpop, mop.getName());
            frm.Show();
            frm.Refresh();
            while (!terminated())
            {
                for (int i = 0; i < this.popsize; i++)
                {
                    MoChromosome offspring;
                    offspring = SBXCrossover(i);//GeneticOPDE//GeneticOPSBXCrossover
                    this.evaluate(offspring);
                    updateReference(offspring);
                    updatePoint(offspring);
                    updateNeighbours(i, offspring);
                    offspring = null;
                }

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();
                }

                this.ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
        }
示例#3
0
        protected override void DoSolve()
        {
            Initial();

            string prob = mop.GetName();

            if (prob.IndexOf("DTLZ") != -1)
            {
                igdValue.Add(QulityIndicator.QulityIndicator.DTLZIGD(mainpop, prob, this.numObjectives));
            }
            else
            {
                pofData = FileTool.ReadData(pofPath + prob);
                igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
            }


            frm = new plotFrm(mainpop, mop.GetName());
            frm.Show();
            frm.Refresh();
            while (!Terminated())
            {
                List <MoChromosome> offsPop = new List <MoChromosome>();

                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offspring;
                    offspring = SBXCrossover(i, true);//GeneticOPDE//GeneticOPSBXCrossover
                    this.Evaluate(offspring);
                    offsPop.Add(offspring);
                    UpdateReference(offspring);
                }

                List <MoChromosome> Pop = new List <MoChromosome>();
                Pop.AddRange(mainpop);
                Pop.AddRange(offsPop);

                EnviromentSelection(Pop);

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();

                    if (prob.IndexOf("DTLZ") != -1)
                    {
                        igdValue.Add(QulityIndicator.QulityIndicator.DTLZIGD(mainpop, prob, this.numObjectives));
                    }
                    else
                    {
                        igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
                    }
                }

                ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
            Common.FileTool.WritetoFile(igdValue, "igdCurve");
        }
示例#4
0
        protected override void DoSolve()
        {
            Initial();

            string prob = mop.GetName();

            pofData = FileTool.ReadData(pofPath + prob);
            igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));

            frm = new plotFrm(mainpop, mop.GetName());
            frm.Show();
            frm.Refresh();
            while (!Terminated())
            {
                List <MoChromosome> offsPop = new List <MoChromosome>();

                for (int i = 0; i < K; i++)
                {
                    for (int j = 0; j < Pop[i].Count; j++)
                    {
                        MoChromosome offspring;
                        offspring = GeneticOPDE(i, j);//GeneticOPDE//GeneticOPSBXCrossover
                        this.Evaluate(offspring);
                        offsPop.Add(offspring);
                        UpdateReference(offspring);
                    }
                }

                offsPop.AddRange(mainpop);
                EnviromentSelection(offsPop);

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();
                    igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
                }

                this.ItrCounter++;
            }
            List <MoChromosome> result = new List <MoChromosome>();

            result.AddRange(mainpop);
            mainpop.Clear();
            mainpop.AddRange(NSGA.FastNonDominatedSort(result)[0]);
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
            Common.FileTool.WritetoFile(igdValue, "igdCurve");
        }
示例#5
0
        protected override void DoSolve()
        {
            Initial();
            frm = new plotFrm(mainpop, mop.GetName());
            frm.Show();
            frm.Refresh();
            while (!Terminated())
            {
                List <MoChromosome> offsPop = new List <MoChromosome>();

                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offspring;
                    if (GlobalValue.CrossoverType.Equals("SBX"))
                    {
                        offspring = SBXCrossover(i);//GeneticOPDE//GeneticOPSBXCrossover
                    }
                    else
                    {
                        offspring = DECrossover(i);
                    }
                    this.Evaluate(offspring);
                    offsPop.Add(offspring);
                    UpdateReference(offspring);
                }

                List <MoChromosome> Pop = new List <MoChromosome>();
                Pop.AddRange(mainpop);
                Pop.AddRange(offsPop);

                EnviromentSelection(Pop);

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();
                }

                ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
        }
示例#6
0
        protected override void DoSolve()
        {
            Initial();
            frm = new plotFrm(mainpop, mop.GetName());
            frm.Show();
            frm.Refresh();
            while (!Terminated())
            {
                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offspring;
                    if (GlobalValue.CrossoverType.Equals("SBX"))
                    {
                        offspring = SBXCrossover(i, true);//GeneticOPDE//GeneticOPSBXCrossover
                    }
                    else
                    {
                        offspring = DECrossover(i, true);
                    }
                    this.Evaluate(offspring);
                    UpdateReference(offspring);
                    UpdateNeighbours(i, offspring);
                    offspring = null;
                }

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();
                }

                this.ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
        }
示例#7
0
        protected override void doSolve()
        {
            initial();

            string prob = mop.getName();

            pofData = FileTool.readData(pofPath + prob);
            igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
            frm = new plotFrm(mainpop, mop.getName());
            frm.Show();
            frm.Refresh();
            while (!terminated())
            {
                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offSpring = SBXCrossover(i, true);//GeneticOPDE//GeneticOPSBXCrossover
                    this.evaluate(offSpring);
                    updateNeighbours(i, offSpring);
                    updateReference(offSpring);
                    offSpring = null;
                }
                if (this.ItrCounter == 0.7 * this.TotalItrNum)
                {
                    isCave = isConcave();
                    //isCave = false;
                    if (isCave == false)
                    {
                        exterSet.Clear();
                        for (int i = 0; i < this.mainpop.Count; i++)
                        {
                            MoChromosome offSpring = this.createChromosome();
                            this.mainpop[i].copyTo(offSpring);
                            exterSet.Add(offSpring);
                        }

                        for (int i = 0; i < this.weights.Count(); i++)
                        {
                            for (int j = 0; j < this.numObjectives; j++)
                            {
                                this.weights[i][j] = 1 - this.weights[i][j];
                            }
                        }
                        getTransweight();
                        this.neighbourTable.Clear();
                        initNeighbour();

                        for (int i = 0; i < popsize; i++)
                        {
                            for (int j = 0; j < this.numObjectives; j++)
                            {
                                narpoint[j] = 1;
                            }
                        }
                    }
                }

                if (this.ItrCounter % 10 == 0)
                {
                    List <MoChromosome> union = new List <MoChromosome>();
                    union.AddRange(mainpop);
                    union.AddRange(exterSet);
                    frm.refereshPlot(this.ItrCounter, union);
                    frm.Refresh();
                    igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
                }

                this.ItrCounter++;
            }
            mainpop.AddRange(exterSet);
            List <MoChromosome> result = new List <MoChromosome>();

            result.AddRange(mainpop);
            mainpop.Clear();
            mainpop.AddRange(NSGA.fastNonDominatedSort(result)[0]);

            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
            Common.FileTool.WritetoFile(igdValue, "igdCurve");
        }
示例#8
0
        protected override void doSolve()
        {
            initial();

            //string prob = mop.getName();
            //if (prob.IndexOf("DTLZ") != -1)
            //{
            //    igdValue.Add(QulityIndicator.QulityIndicator.DTLZIGD(mainpop, prob, this.numObjectives));
            //}
            //else
            //{
            //    pofData = FileTool.readData(pofPath + prob);
            //    igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
            //}


            frm = new plotFrm(mainpop, mop.getName());
            frm.Show();
            frm.Refresh();
            while (!terminated())
            {
                List <MoChromosome> offsPop = new List <MoChromosome>();

                for (int i = 0; i < popsize; i++)
                {
                    MoChromosome offspring;
                    offspring = SBXCrossover(i);//GeneticOPDE//GeneticOPSBXCrossover
                    this.evaluate(offspring);
                    offsPop.Add(offspring);
                    updateReference(offspring);
                }

                List <MoChromosome> Pop = new List <MoChromosome>();
                Pop.AddRange(mainpop);
                Pop.AddRange(offsPop);

                Reference_Vector_Guided_Selection(Pop);
                Reference_Vector_Adaptation();
                //Reference_Vector_Adaptation(Pop);

                if (this.ItrCounter % 10 == 0)
                {
                    frm.refereshPlot(this.ItrCounter, mainpop);
                    frm.Refresh();

                    //if (prob.IndexOf("DTLZ") != -1)
                    //{
                    //    igdValue.Add(QulityIndicator.QulityIndicator.DTLZIGD(mainpop, prob, this.numObjectives));
                    //}
                    //else
                    //{
                    //    igdValue.Add(QulityIndicator.QulityIndicator.IGD(mainpop, pofData));
                    //}
                }

                ItrCounter++;
            }
            Common.FileTool.WritetoFile(mainpop, "gen", 1);
            Common.FileTool.WritetoFile(mainpop, "obj", 2);
            //Common.FileTool.WritetoFile(igdValue, "igdCurve");
        }