Esempio n. 1
0
        public virtual void Copy(MOOSolution rhs)
        {
            mObjectives.Clear();
            mConstaints.Clear();

            int objective_count = rhs.mObjectives.Count;

            for (int objective_index = 0; objective_index < objective_count; ++objective_index)
            {
                mObjectives.Add(rhs.mObjectives[objective_index]);
            }
            int constraint_count = rhs.mConstaints.Count;

            for (int constraint_index = 0; constraint_index < constraint_count; ++constraint_index)
            {
                mConstaints.Add(rhs.mConstaints[constraint_index]);
            }

            mTags.Clear();
            Dictionary <string, object> tags = rhs.mTags;

            foreach (string tag_id in tags.Keys)
            {
                mTags[tag_id] = tags[tag_id];
            }

            mRank             = rhs.mRank;
            mCrowdingDistance = rhs.mCrowdingDistance;

            mPopulation = rhs.mPopulation;
            mProblem    = rhs.mProblem;
        }
Esempio n. 2
0
        private void DisplayParetoFront <S>(NondominatedPopulation <S> archive)
            where S : ContinuousVector, new()
        {
            GraphPane pane = chtParetoFront.GraphPane;

            pane.XAxis.Title.Text = "Objective 1";
            pane.YAxis.Title.Text = "Objective 2";
            pane.Title.Text       = string.Format("Problem: {0}", (ProblemType)cboProblem.SelectedItem);

            PointPairList list = new PointPairList();

            foreach (S s in archive.Solutions)
            {
                list.Add(s.FindObjectiveAt(0), s.FindObjectiveAt(1));
            }

            AlgorithmType algorithm_type = (AlgorithmType)cboAlgorithm.SelectedItem;
            LineItem      myCurve        = pane.AddCurve(string.Format("{0} ({1})", algorithm_type.ToString(), cboProblem.SelectedItem), list, GetParetoFrontColor());

            myCurve.Symbol.Type    = ZedGraph.SymbolType.Plus;
            myCurve.Line.IsVisible = false;

            pane.AxisChange();
            chtParetoFront.Invalidate();

            DataTable table = new DataTable();

            table.Columns.Add("#");
            IMOOProblem problem = archive[0].Problem;

            for (int i = 0; i < problem.GetObjectiveCount(); ++i)
            {
                table.Columns.Add(string.Format("Objective {0}", i + 1));
            }
            for (int i = 0; i < problem.GetDimensionCount(); ++i)
            {
                table.Columns.Add(string.Format("x[{0}]", i));
            }

            for (int i = 0; i < archive.Count; ++i)
            {
                S             s      = archive[i];
                List <object> values = new List <object>();
                values.Add(i + 1);
                for (int j = 0; j < problem.GetObjectiveCount(); ++j)
                {
                    values.Add(s.FindObjectiveAt(j));
                }
                for (int j = 0; j < problem.GetDimensionCount(); ++j)
                {
                    values.Add(s[j]);
                }
                table.Rows.Add(values.ToArray());
            }

            dgvParetoFront.DataSource = table;
        }
Esempio n. 3
0
        public HybridGame(IMOOProblem problem)
        {
            mProblem = problem;
            int dimension_count = problem.GetDimensionCount();

            for (int i = 0; i < dimension_count; ++i)
            {
                mEliteDesignVariables[i] = 0;
            }
        }
        public override List <S> Crossover(P pop, params S[] parents)
        {
            List <S> results = new List <S>();

            int         dimension_count = pop.Problem.GetDimensionCount();
            IMOOProblem problem         = pop.Problem;
            double      crossover_rate  = pop.CrossoverRate;

            int ccount = parents.Length;
            S   child1, parent1, parent2, parent3;

            for (int i = 0; i < ccount; i += 4)
            {
                int child1_index  = i;
                int parent1_index = (i + 1) % ccount;
                int parent2_index = (i + 2) % ccount;
                int parent3_index = (i + 3) % ccount;

                child1  = parents[child1_index].Clone() as S;
                parent1 = parents[parent1_index];
                parent2 = parents[parent2_index];
                parent3 = parents[parent3_index];

                int jrand = DistributionModel.NextInt(dimension_count);

                for (int j = 0; j < dimension_count; j++)
                {
                    if ((DistributionModel.GetUniform() <= crossover_rate) || (j == jrand))
                    {
                        double v1 = parent1[j];
                        double v2 = parent2[j];
                        double v3 = parent3[j];

                        double y = v3 + mF * (v1 - v2);

                        if (y < problem.GetLowerBound(j))
                        {
                            y = problem.GetLowerBound(j);
                        }

                        if (y > problem.GetUpperBound(j))
                        {
                            y = problem.GetUpperBound(j);
                        }

                        child1[j] = y;
                    }
                }
                results.Add(child1);
            }

            return(results);
        }
Esempio n. 5
0
        public NashNode(IMOOProblem problem, MOOConfig config, Dictionary <int, double> elite_design_variables, Dictionary <int, int> design_variable_local_mapping, int objective_index)
        {
            mGlobalEliteDesignVariables        = elite_design_variables;
            mDesignVariableGlobal2LocalMapping = design_variable_local_mapping;
            foreach (int design_variable_global_index in design_variable_local_mapping.Keys)
            {
                mLocalEliteDesignVariables[design_variable_global_index] = -1;
                mDesignVariableLocal2GlobalMapping[design_variable_local_mapping[design_variable_global_index]] = design_variable_global_index;
            }

            mOriginalProblem = problem;
            mObjectiveIndex  = objective_index;

            mPopulation         = CreatePopulation();
            mPopulation.Problem = this;
            mPopulation.Config.Copy(config);

            mMutationInstructionFactory              = CreateMutationInstructionFactory();
            mCrossoverInstructionFactory             = CreateCrossoverInstructionFactory();
            mPopInitInstructionFactory               = CreatePopInitInstructionFactory();
            mReproductionSelectionInstructionFactory = CreateSelectionInstructionFactory();
        }
Esempio n. 6
0
 public NSGAII(IMOOProblem problem)
     : base(problem)
 {
 }
Esempio n. 7
0
 public ContinuousVector(IMOOPop pop, IMOOProblem problem)
     : base(pop, problem)
 {
 }
Esempio n. 8
0
 public MOOSolution(IMOOPop population, IMOOProblem problem)
 {
     mPopulation = population;
     mProblem    = problem;
 }
Esempio n. 9
0
 public GDE3(IMOOProblem problem)
     : base(problem)
 {
 }
Esempio n. 10
0
 public ParetoNode(IMOOProblem problem)
     : base(problem)
 {
 }
Esempio n. 11
0
 public HAPMOEA(IMOOProblem problem1, IMOOProblem problem2, IMOOProblem problem3)
 {
     mProblem1 = problem1;
     mProblem2 = problem2;
     mProblem3 = problem3;
 }
Esempio n. 12
0
 public HAPMOEA(IMOOProblem problem)
 {
     mProblem1 = problem;
     mProblem2 = problem;
     mProblem3 = problem;
 }
Esempio n. 13
0
 public HAPMOEALayer(IMOOProblem problem, HAPMOEAConfig config)
 {
     mProblem = problem;
     mConfig  = config;
 }