Esempio n. 1
0
        public IntergenSolution(IntergenProblem p) : base(p)
        {
            this.problem       = problem;
            this.Type          = problem.SolutionType;
            numberOfObjectives = problem.NumberOfObjectives;
            this.Objective     = new double[numberOfObjectives];

            this.Fitness               = 0.0;
            this.KDistance             = 0.0;
            this.CrowdingDistance      = 0.0;
            this.DistanceToSolutionSet = double.PositiveInfinity;
            if (p.Model.Setting.UseInitialFv)
            {
                var fdist = p.Model.DStore.SelectedFeatureDistribution;

                for (int i = 0; i < fdist.Values.Length; i++)
                {
                    Variable[i] = new Real(problem.LowerLimit[0], problem.UpperLimit[0], fdist.Values[i]);
                }
                if (p.Model.Setting.NumberOfInteractions <= 0)
                {
                    return;
                }
                var idist = p.Model.DStore.SelectedInteractionDistribution;
                for (int i = 0; i < idist.Values.Length; i++)
                {
                    Variable[i + fdist.Values.Length] = new Real(problem.LowerLimit[fdist.Values.Length + 1], problem.UpperLimit[fdist.Values.Length + 1], idist.Values[i]);
                }
                //this.Variable = Type.CreateInitialVariable();
            }
            else
            {
                this.Variable = Type.CreateVariables();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="problem">Problem to solve</param>
 /// <param name="evaluator">Parallel evaluator</param>
 public PNSGAII(IntergenProblem problem, BackgroundWorker worker, MyMultiThreadedEvaluator evaluator)
     : base(problem)
 {
     parallelEvaluator = evaluator;
     _worker           = worker;
 }
Esempio n. 3
0
 public IBEA(IntergenProblem problem) : base(problem)
 {
     this.problem = problem;
 }
 public void StartParallelRunner(object problem)
 {
     this.problem = (IntergenProblem)problem;
     taskList     = null;
 }
Esempio n. 5
0
        /*public static void PlotValues(double[] dist, string name) {
         *  NumericVector data = Engine.CreateNumericVector(dist);
         *  StoredValues.Add(name);
         *  Engine.SetSymbol(name, data);
         *  //PlotValues(name);
         * } */

        public static void PlotValues(SolutionSet currentBestSolutions, IntergenProblem problem)
        {
            /*if (currentBestSolutions.Size() < 2) { return; }
             *
             * var dir = Directory.GetParent(Directory.GetParent(Directory.GetCurrentDirectory()).ToString()).ToString();
             * var project =  dir.Replace("\\", "/");
             *
             * string test = "source('" + project + "/PlotMulti.R')";
             *
             *
             * var result = Engine.Evaluate(test);
             *
             * string imagePath = "CurrentBest";
             *
             * //Engine.Evaluate($"png('{ImagePath.Replace('\\', '/') + imagePath + ".png"}', {900}, {600})");
             * //engine.AutoPrint = true;
             * var combined = "";
             * var varCombined = "";
             * for (var i = 0; i < currentBestSolutions.Size(); i++)
             * {
             *  string name = "CurrentBests" + i;
             *  Solution sol = currentBestSolutions.Get(i);
             *  XReal wrap = new XReal(sol);
             *  double[] values = new double[wrap.Size()];
             *
             *  for (int j = 0; j < wrap.Size(); j++)
             *  {
             *      values[j] = wrap.GetValue(j);
             *  }
             *  var withoutInterac = problem.FeatureMatrix.Multiply(values);
             *  var variantValues = problem.InteractionValuesPerConfig != null ? withoutInterac.Add(problem.InteractionValuesPerConfig) : withoutInterac;
             *
             *
             *  FMScaling fms = new FMScaling(problem.GetModel());
             *
             *  Distribution targetV = fms.InteractionToScale(problem.VariantTarget, variantValues.Min(), variantValues.Max());
             *  NumericVector variantData = Engine.CreateNumericVector(targetV.Values);
             *  StoredValues.Add("targetBest" + i);
             *  Engine.SetSymbol("targetBest" + i, variantData);
             *  if (i < currentBestSolutions.Size() - 1)
             *  {
             *      varCombined += "targetBest" + i + ", ";
             *  }
             *  else
             *  {
             *      varCombined += "targetBest" + i;
             *  }
             *
             *  //PlotValues(values, "test" + i);
             *
             *  NumericVector data = Engine.CreateNumericVector(values);
             *  StoredValues.Add(name);
             *  Engine.SetSymbol(name, data);
             *
             *  if (i < currentBestSolutions.Size() - 1)
             *  {
             *      combined += "CurrentBests" + i + ", ";
             *  }
             *  else {
             *      combined += "CurrentBests" + i;
             *  }
             *  //engine.Evaluate("d" + i + " <- density(" + name + ")");
             *  //
             *
             *  //TODO CREATE LIST FOR plot multi dens
             * }
             *
             * Engine.Evaluate("best(list(" + combined + "))");
             * // Engine.Evaluate("dev.off()");
             *
             * //Engine.Evaluate(string.Format("png('{0}', {1}, {2})", ImagePath.Replace('\\', '/') + "VariantBest.png", 900, 600));
             * //Engine.Evaluate("test(list(" + varCombined + "))");
             * //Engine.Evaluate("dev.off()");
             *
             * //Console.WriteLine("Plotted Pareto"); */
        }
Esempio n. 6
0
 public IntergenSolution(IntergenProblem problem, bool initialValues) : base(problem)
 {
 }