Example #1
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);
            }
        }
        /// <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);
            }
        }
Example #3
0
        /// <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;
            }
        }
Example #4
0
        /// <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);
            }
        }
Example #5
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);
            }
        }
Example #6
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);
            }
        }
        /// <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);
            }
        }
Example #8
0
        /// <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);
        }
Example #10
0
        public IntergenProblem(Thor model)
        {
            Model = model;

            NumberOfVariables = model.Setting.NumberOfFeatures + model.Setting.NumberOfInteractions;
            //ProblemName = "InteractionProblem";
            SolutionType = new RealSolutionType(this);

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

            var featMin = Model.DStore.SelectedFeatureDistribution.Values.Min();
            var featMax = Model.DStore.SelectedFeatureDistribution.Values.Max();


            const double featMargin  = 0.05;
            double       lowInterac  = 0;
            double       highInterac = 0;

            var lowFeat  = featMin < 0 ? featMin * (1 + featMargin) : featMin * (1 - featMargin);
            var highFeat = featMax < 0 ? featMax * (1 - featMargin) : featMax * (1 + featMargin);

            if (model.Setting.NumberOfInteractions > 0)
            {
                const double interacMargin = 0.05;
                var          interacMin    = Model.DStore.SelectedInteractionDistribution.Values.Min();
                var          interacMax    = Model.DStore.SelectedInteractionDistribution.Values.Max();
                lowInterac  = interacMin < 0 ? interacMin * (1 + interacMargin) : interacMin * (1 - interacMargin);
                highInterac = interacMax < 0 ? interacMax * (1 - interacMargin) : interacMax * (1 + interacMargin);
            }

            for (var index = 0; index < NumberOfVariables; index++)
            {
                if (index < model.Setting.NumberOfFeatures)
                {
                    LowerLimit[index] = lowFeat;
                    UpperLimit[index] = highFeat;
                }
                else
                {
                    LowerLimit[index] = lowInterac;
                    UpperLimit[index] = highInterac;
                }
            }
        }
Example #11
0
 public GeneratorProblem(SolutionType type)
 {
     SolutionType = new RealSolutionType(this);
 }
Example #12
0
 public GeneratorProblem(string solutionType, int numberOfVariables)
 {
     SolutionType = new RealSolutionType(this);
 }