Exemple #1
0
        public CSimpleBattalion[] GetBatalionData()
        {
            CSimpleBattalion[] Battalions = new CSimpleBattalion[GlobalConfiguration.Assignemnt.BattalionCount + GlobalConfiguration.Assignemnt.ReservedCount];
            for (int i = 0; i < 21; i++)
            {
                Battalions[i] = this.CreateBattalion(i, "Bat" + i, EConstraints.Land);
            }

            for (int i = 21; i < 33; i++)
            {
                Battalions[i] = this.CreateBattalion(i, "Armor" + i, EConstraints.ArmoredBattalion);
            }

            for (int i = 33; i < 38; i++)
            {
                Battalions[i] = this.CreateBattalion(i, "Bomber" + i, EConstraints.Bombers);
            }

            for (int i = 38; i < Battalions.Length; i++)
            {
                Battalions[i] = this.CreateBattalion(i, "res" + i, EConstraints.All, true);
            }

            return(Battalions);
        }
        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 CSimpleBattalion[] GetBatalionData()
        {
            CSimpleBattalion[] Battalions = new CSimpleBattalion[GlobalConfiguration.Assignemnt.BattalionCount];
            int Land             = (int)(GlobalConfiguration.Assignemnt.BattalionCount * .23);
            int ArmoredBattalion = (int)(GlobalConfiguration.Assignemnt.BattalionCount * .1);

            for (int i = 0; i < Land; i++)
            {
                Battalions[i] = new CSimpleBattalion(EConstraints.Land, 0);
                Battalions[i].SetUID(i);

                int Reseversions = Shared.Next(2);
                for (int j = 0; j < Reseversions; j++)
                {
                    Reservation r = new Reservation();
                    r.Date       = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
                    r.Importance = (EImportance)(Shared.Next(5) + 1);
                    Battalions[i].Reservations.Add(r);
                }
            }

            for (int i = Land; i < Land + ArmoredBattalion; i++)
            {
                Battalions[i] = new CSimpleBattalion(EConstraints.ArmoredBattalion, 0);
                Battalions[i].SetUID(i);

                int Reseversions = Shared.Next(3);
                for (int j = 0; j < Reseversions; j++)
                {
                    Reservation r = new Reservation();
                    r.Date       = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
                    r.Importance = (EImportance)(Shared.Next(5) + 1);
                    Battalions[i].Reservations.Add(r);
                }
            }

            for (int i = ArmoredBattalion + Land; i < Battalions.Length; i++)
            {
                Battalions[i] = new CSimpleBattalion(EConstraints.All, Shared.Next(80) + 20);
                Battalions[i].SetUID(i);

                int Reseversions = Shared.Next(2);
                for (int j = 0; j < Reseversions; j++)
                {
                    Reservation r = new Reservation();
                    r.Date       = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
                    r.Importance = (EImportance)(Shared.Next(5) + 1);
                    Battalions[i].Reservations.Add(r);
                }
            }

            return(Battalions);
        }
Exemple #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);
        }
Exemple #5
0
        private CSimpleBattalion CreateBattalion(int UID, string Name, EConstraints Constraints, bool IsReservedDuty = false)
        {
            CSimpleBattalion Battalion = new CSimpleBattalion(Name, Constraints);

            Battalion.SetUID(UID);
            Battalion.IsReservedDuty = IsReservedDuty;
            int Reseversions = Shared.Next(2);

            for (int j = 0; j < Reseversions; j++)
            {
                Reservation r = new Reservation();
                r.Date       = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
                r.Importance = (EImportance)(Shared.Next(5) + 1);
                Battalion.Reservations.Add(r);
            }

            return(Battalion);
        }
        //public CSimpleBattalion[] GetBatalionData()
        //{
        //    CSimpleBattalion[] Battalions = new CSimpleBattalion[GlobalConfiguration.Assignemnt.BattalionCount];
        //    for (int i = 0; i < 14; i++)
        //    {
        //        Battalions[i] = new CSimpleBattalion(EConstraints.Land, 0);
        //        Battalions[i].SetUID(i);

        //        int Reseversions = Shared.Next(3);
        //        for (int j = 0; j < Reseversions; j++)
        //        {
        //            Reservation r = new Reservation();
        //            r.Date = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
        //            r.Importance = (EImportance)(Shared.Next(5) + 1);
        //            Battalions[i].Reservations.Add(r);
        //        }
        //    }

        //    for (int i = 14; i < 24; i++)
        //    {
        //        Battalions[i] = new CSimpleBattalion(EConstraints.ArmoredBattalion, 0);
        //        Battalions[i].SetUID(i);

        //        int Reseversions = Shared.Next(3);
        //        for (int j = 0; j < Reseversions; j++)
        //        {
        //            Reservation r = new Reservation();
        //            r.Date = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
        //            r.Importance = (EImportance)(Shared.Next(5) + 1);
        //            Battalions[i].Reservations.Add(r);
        //        }
        //    }

        //    for (int i = 24; i < Battalions.Length; i++)
        //    {
        //        Battalions[i] = new CSimpleBattalion(EConstraints.All, Shared.Next(80) + 20);
        //        Battalions[i].SetUID(i);

        //        int Reseversions = Shared.Next(2);
        //        for (int j = 0; j < Reseversions; j++)
        //        {
        //            Reservation r = new Reservation();
        //            r.Date = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
        //            r.Importance = (EImportance)(Shared.Next(5) + 1);
        //            Battalions[i].Reservations.Add(r);
        //        }
        //    }

        //    return Battalions;
        //}

        //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 < 12; 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;
        //}

        public CSimpleBattalion[] GetBatalionData()
        {
            CSimpleBattalion[] Battalions = new CSimpleBattalion[GlobalConfiguration.Assignemnt.BattalionCount];

            for (int i = 0; i < Battalions.Length; i++)
            {
                Battalions[i] = new CSimpleBattalion("", EConstraints.All);
                Battalions[i].SetUID(i);

                int Reseversions = Shared.Next(2);
                for (int j = 0; j < Reseversions; j++)
                {
                    Reservation r = new Reservation();
                    r.Date       = (new DateTime(2018, 1, 1)).AddDays(Shared.Next(365));
                    r.Importance = (EImportance)(Shared.Next(5) + 1);
                    Battalions[i].Reservations.Add(r);
                }
            }

            return(Battalions);
        }