Exemplo n.º 1
0
        private float CalculateConstraintsFitness(int GeneIdx)
        {
            CSimpleBattalion Battalion = CStrategyPool.ActiveStrategy.BattalionsData[this.Genes[GeneIdx].BattalionUID];
            CSimpleSector    Sector    = CStrategyPool.ActiveStrategy.SectorsData[this.Genes[GeneIdx].SectorUID];

            return(((Battalion.Force & Sector.ForceConstraint) > 0) ? 1 : 0);
        }
        public CSimpleSector[] GetSectorData()
        {
            CSimpleSector[] Secotrs             = new CSimpleSector[GlobalConfiguration.Assignemnt.SectorCount];
            var             objSectorialBrigade = Enum.GetValues(typeof(ESectorialBrigade));

            ESectorialBrigade[] BrigadeAss = new ESectorialBrigade[GlobalConfiguration.Assignemnt.SectorCount];

            for (int i = 0; i < GlobalConfiguration.Assignemnt.SectorCount; i++)
            {
                BrigadeAss[i] = (ESectorialBrigade)objSectorialBrigade.GetValue(Shared.Next(objSectorialBrigade.Length));
            }

            BrigadeAss = BrigadeAss.OrderBy(x => (int)x).ToArray();

            DateTime FirstWednesday = new DateTime(2018, 1, 1);

            while (FirstWednesday.Date.DayOfWeek != DayOfWeek.Wednesday)
            {
                FirstWednesday = FirstWednesday.AddDays(1);
            }

            for (int i = 0; i < Secotrs.Length; i++)
            {
                Secotrs[i] = new CSimpleSector(
                    "Sec1" + i,
                    EConstraints.All,
                    BrigadeAss[i],
                    FirstWednesday);
                Secotrs[i].SetUID(i);
            }

            return(Secotrs);
        }
Exemplo n.º 3
0
        public CSimpleSector[] GetSectorData()
        {
            CSimpleSector[] Secotrs             = new CSimpleSector[GlobalConfiguration.Assignemnt.SectorCount];
            var             objSectorialBrigade = Enum.GetValues(typeof(ESectorialBrigade));

            ESectorialBrigade[] BrigadeAss = new ESectorialBrigade[GlobalConfiguration.Assignemnt.SectorCount];


            for (int i = 9; i < GlobalConfiguration.Assignemnt.SectorCount; i++)
            {
                BrigadeAss[i] = (ESectorialBrigade)objSectorialBrigade.GetValue(Shared.Next(objSectorialBrigade.Length - 3) + 3);
            }

            BrigadeAss = BrigadeAss.OrderBy(x => (int)x).ToArray();

            DateTime FirstWednesday = new DateTime(2018, 1, 1);

            while (FirstWednesday.Date.DayOfWeek != DayOfWeek.Wednesday)
            {
                FirstWednesday = FirstWednesday.AddDays(1);
            }

            var c = 0;

            Secotrs[c] = new CSimpleSector("Sec0", EConstraints.ArmoredBattalion, ESectorialBrigade.Brigade1, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec1", EConstraints.ArmoredBattalion, ESectorialBrigade.Brigade1, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec2", EConstraints.Land, ESectorialBrigade.Brigade1, FirstWednesday);
            Secotrs[c].SetUID(c++);

            Secotrs[c] = new CSimpleSector("Sec3", EConstraints.Land, ESectorialBrigade.Brigade2, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec4", EConstraints.All, ESectorialBrigade.Brigade2, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec5", EConstraints.All, ESectorialBrigade.Brigade2, FirstWednesday);
            Secotrs[c].SetUID(c++);

            Secotrs[c] = new CSimpleSector("Sec6", EConstraints.Land, ESectorialBrigade.Brigade3, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec7", EConstraints.All, ESectorialBrigade.Brigade3, FirstWednesday);
            Secotrs[c].SetUID(c++);
            Secotrs[c] = new CSimpleSector("Sec8", EConstraints.All, ESectorialBrigade.Brigade3, FirstWednesday);
            Secotrs[c].SetUID(c++);


            for (int i = c; i < Secotrs.Length; i++)
            {
                Secotrs[i] = new CSimpleSector("Sec" + i, EConstraints.All, BrigadeAss[i], FirstWednesday);
                Secotrs[i].SetUID(i);
            }

            return(Secotrs);
        }
Exemplo n.º 4
0
        private float CalculateConstraintsFitness()
        {
            float Score = 0;

            for (int i = 0; i < this.Genes.Length; i++)
            {
                CSimpleBattalion Battalion = CStrategyPool.ActiveStrategy.BattalionsData[this.Genes[i].BattalionUID];
                CSimpleSector    Sector    = CStrategyPool.ActiveStrategy.SectorsData[this.Genes[i].SectorUID];

                Score += ((Battalion.Force & Sector.ForceConstraint) > 0) ? 1 : 0;
            }

            return(Score / this.Genes.Length);
        }
        public CSimpleSector[] GetSectorData()
        {
            CSimpleSector[] Secotrs             = new CSimpleSector[GlobalConfiguration.Assignemnt.SectorCount];
            var             objSectorialBrigade = Enum.GetValues(typeof(ESectorialBrigade));

            DateTime FirstWednesday = new DateTime(2018, 1, 1);

            while (FirstWednesday.Date.DayOfWeek != DayOfWeek.Wednesday)
            {
                FirstWednesday = FirstWednesday.AddDays(1);
            }

            for (int i = 0; i < 3; i++)
            {
                Secotrs[i] = new CSimpleSector(EConstraints.ArmoredBattalion, ESectorialBrigade.Brigade1, FirstWednesday);
                Secotrs[i].SetUID(i);
            }

            for (int i = 3; i < 6; i++)
            {
                Secotrs[i] = new CSimpleSector(EConstraints.Land, ESectorialBrigade.Brigade2, FirstWednesday.AddMonths(1));
                Secotrs[i].SetUID(i);
            }

            for (int i = 6; i < GlobalConfiguration.Assignemnt.SectorCount; i++)
            {
                Secotrs[i] = new CSimpleSector(EConstraints.Land, ESectorialBrigade.Brigade3, FirstWednesday);
                Secotrs[i].SetUID(i);
            }

            //for (int i = 0; i < 6; i++)
            //{
            //    for (int j = 0; j < 3; j++)
            //    {
            //        int id = 12 + i * 3 + j;
            //        Secotrs[id] = new CSimpleSector(
            //            EConstraints.All,
            //            (ESectorialBrigade)objSectorialBrigade.GetValue(Shared.Next(objSectorialBrigade.Length - 3) + 3),
            //            FirstWednesday);
            //        Secotrs[id].SetUID(id);
            //    }
            //}

            return(Secotrs);
        }
Exemplo n.º 6
0
 public void RegisterSector(CSimpleSector Sector)
 {
     this.MySectors.Add(Sector);
 }