コード例 #1
0
ファイル: ZDT3.cs プロジェクト: masuodfathi/jmetal
        /// <summary>
        /// Constructor.
        /// Creates a new ZDT3 problem instance.
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal", and "ArrayReal".</param>
        /// <param name="numberOfVariables">Number of variables</param>
        public ZDT3(string solutionType, int numberOfVariables)
        {
            NumberOfVariables   = numberOfVariables;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "ZDT3";

            UpperLimit = new double[NumberOfVariables];
            LowerLimit = new double[NumberOfVariables];

            for (int i = 0; i < NumberOfVariables; i++)
            {
                LowerLimit[i] = 0.0;
                UpperLimit[i] = 1.0;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else if (solutionType == "ArrayReal")
            {
                SolutionType = new ArrayRealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Solution type " + solutionType + " is invalid");
                return;
            }
        }
コード例 #2
0
        /// <summary>
        /// Constructor.
        /// Creates a new instance of the Kursawe problem.
        /// </summary>
        /// <param name="solutionType">The solution type must "Real", "BinaryReal, and "ArrayReal".</param>
        /// <param name="numberOfVariables">Number of variables of the problem</param>
        public Kursawe(string solutionType, int numberOfVariables)
        {
            NumberOfVariables   = numberOfVariables;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "Kursawe";

            UpperLimit = new double[NumberOfVariables];
            LowerLimit = new double[NumberOfVariables];

            for (int i = 0; i < NumberOfVariables; i++)
            {
                LowerLimit[i] = -5.0;
                UpperLimit[i] = 5.0;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else if (solutionType == "ArrayReal")
            {
                SolutionType = new ArrayRealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a DTLZ1 problem instance
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal".</param>
        /// <param name="ptype"></param>
        /// <param name="dtype"></param>
        /// <param name="ltype"></param>
        public LZ09_F9(string solutionType, int ptype, int dtype, int ltype)
        {
            NumberOfVariables   = 30;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "LZ09_F9";

            LZ09 = new LZ09(NumberOfVariables, NumberOfObjectives, ptype, dtype, ltype);

            LowerLimit = new double[NumberOfVariables];
            UpperLimit = new double[NumberOfVariables];
            for (int var = 0; var < NumberOfVariables; var++)
            {
                LowerLimit[var] = 0.0;
                UpperLimit[var] = 1.0;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #4
0
        /// <summary>
        /// Creates a DTLZ1 problem instance
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal"</param>
        /// <param name="numberOfVariables">Number of variables</param>
        /// <param name="numberOfObjectives">Number of objective functions</param>
        public DTLZ1(string solutionType, int numberOfVariables, int numberOfObjectives)
        {
            NumberOfVariables   = numberOfVariables;
            NumberOfObjectives  = numberOfObjectives;
            NumberOfConstraints = 0;
            ProblemName         = "DTLZ1";

            LowerLimit = new double[NumberOfVariables];
            UpperLimit = new double[NumberOfVariables];
            for (int var = 0; var < numberOfVariables; var++)
            {
                LowerLimit[var] = 0.0;
                UpperLimit[var] = 1.0;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #5
0
ファイル: Fonseca.cs プロジェクト: masuodfathi/jm
        /// <summary>
        /// Constructor
        /// Creates a default instance of the Fonseca problem
        /// </summary>
        /// <param name="solutionType">The solution type must "Real", "BinaryReal, ArrayReal, or ArrayRealC".</param>
        public Fonseca(string solutionType)
        {
            NumberOfVariables   = 3;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "Fonseca";

            UpperLimit = new double[NumberOfVariables];
            LowerLimit = new double[NumberOfVariables];
            for (int var = 0; var < NumberOfVariables; var++)
            {
                LowerLimit[var] = 0.0;
                UpperLimit[var] = 2.0;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else if (solutionType == "ArrayReal")
            {
                SolutionType = new ArrayRealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #6
0
        /// <summary>
        /// Constructor. Creates a default instance of the Water problem.
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal".</param>
        public Water(string solutionType)
        {
            NumberOfVariables   = 3;
            NumberOfObjectives  = 5;
            NumberOfConstraints = 7;
            ProblemName         = "Water";



            UpperLimit = new double[NumberOfVariables];
            LowerLimit = new double[NumberOfVariables];

            for (int var = 0; var < NumberOfVariables; var++)
            {
                LowerLimit[var] = LOWERLIMIT[var];
                UpperLimit[var] = UPPERLIMIT[var];
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #7
0
        /// <summary>
        /// Constructor
        /// Creates a WFG problem
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal".</param>
        /// <param name="k">position-related parameters</param>
        /// <param name="l">distance-related parameters</param>
        /// <param name="M">Number of objectives</param>
        public WFG(string solutionType, int k, int l, int M)
        {
            this.k              = k;
            this.l              = l;
            this.M              = M;
            NumberOfVariables   = this.k + this.l;
            NumberOfObjectives  = this.M;
            NumberOfConstraints = 0;

            LowerLimit = new double[NumberOfVariables];
            UpperLimit = new double[NumberOfVariables];
            for (int var = 0; var < NumberOfVariables; var++)
            {
                LowerLimit[var] = 0;
                UpperLimit[var] = 2 * (var + 1);
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
コード例 #8
0
ファイル: Schaffer.cs プロジェクト: elimelec/sim-outorder
        /// <summary>
        /// Constructor.
        /// Creates a default instance of problem Schaffer
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal".</param>
        public Schaffer(string solutionType)
        {
            NumberOfVariables   = 1;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "Schaffer";

            LowerLimit    = new double[NumberOfVariables];
            UpperLimit    = new double[NumberOfVariables];
            LowerLimit[0] = -100000;
            UpperLimit[0] = 100000;

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                Logger.Log.Error("Error: solution type " + solutionType + " is invalid");
                Environment.Exit(-1);
            }
        }
        /// <summary>
        /// Constructor.
        /// Creates a new multiobjective problem instance.
        /// </summary>
        /// <param name="solutionType">The solution type must "Real" or "BinaryReal", and "ArrayReal".</param>
        /// <param name="numberOfVariables">Number of variables</param>
        public NSGAIIProblem(string solutionType, MOO comp, int solutionsCounter)
        {
            this.component      = comp;
            NumberOfVariables   = comp.readSlidersList().Count;
            NumberOfObjectives  = comp.objectives.Count;
            NumberOfConstraints = 0;
            ProblemName         = "Multiobjective";

            // Log
            comp.LogAddMessage("Number of Variables = " + NumberOfVariables);
            comp.LogAddMessage("Number of Objectives = " + NumberOfObjectives);
            comp.LogAddMessage("Number of Constraints = " + NumberOfConstraints);


            UpperLimit = new double[NumberOfVariables];
            LowerLimit = new double[NumberOfVariables];

            for (int i = 0; i < NumberOfVariables; i++)
            {
                GH_NumberSlider curSlider = comp.readSlidersList()[i];

                LowerLimit[i] = (double)curSlider.Slider.Minimum;
                UpperLimit[i] = (double)curSlider.Slider.Maximum;
            }

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Real")
            {
                SolutionType = new RealSolutionType(this);
            }
            else if (solutionType == "ArrayReal")
            {
                SolutionType = new ArrayRealSolutionType(this);
            }
            else
            {
                Console.WriteLine("Error: solution type " + solutionType + " is invalid");
                //Logger.Log.Error("Solution type " + solutionType + " is invalid");
                return;
            }

            // Log
            comp.LogAddMessage("Solution Type = " + solutionType);
        }