Example #1
0
        public void CalculateParetoFrontiers(double factor)
        {
            List <sParetoDataSet> temp      = this.data.ToList();
            List <int>            paretoIDs = new List <int>();
            int candidateRowNr = 0;

            while (true)
            {
                sParetoDataSet candidateRow = this.data[candidateRowNr];
                this.data.RemoveAt(candidateRowNr);

                int  rowNr        = 0;
                bool nonDominated = true;

                while (this.data.Count != 0 && rowNr < this.data.Count)
                {
                    sParetoDataSet row = this.data[rowNr];

                    if (candidateRow.IsDominatesOver(row, false))
                    {
                        this.data.RemoveAt(rowNr);
                    }
                    else if (row.IsDominatesOver(candidateRow, false))
                    {
                        nonDominated = false;
                        rowNr       += 1;
                    }
                    else
                    {
                        rowNr += 1;
                    }
                }

                if (nonDominated)
                {
                    paretoIDs.Add(candidateRow.ID);
                }

                if (this.data.Count == 0)
                {
                    break;
                }
            }

            foreach (sParetoDataSet ps in temp)
            {
                foreach (int idd in paretoIDs)
                {
                    if (ps.ID == idd)
                    {
                        ps.IsParetoFront = true;
                        break;
                    }
                }
            }

            this.data.Clear();
            this.data = temp.ToList();

            this.NormalizeData(factor);
        }