Exemplo n.º 1
0
        public Regression(string solutionType, int NumberofPair)
        {
            NumberOfPairs       = NumberofPair;
            NumberOfVariables   = 3;
            NumberOfObjectives  = 2;
            NumberOfConstraints = 0;
            ProblemName         = "Regression";

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

            if (solutionType == "BinaryReal")
            {
                SolutionType = new BinaryRealSolutionType(this);
            }
            else if (solutionType == "Int")
            {
                SolutionType = new IntSolutionType(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);
            }
        }
Exemplo n.º 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 == "Int")
            {
                SolutionType = new IntSolutionType(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);
            }
        }
Exemplo n.º 3
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 == "Int")
            {
                SolutionType = new IntSolutionType(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);
            }
        }