Exemplo n.º 1
0
 // Two partial plans are equal if they agree on how many ambulances have been assigned to each place/time slot
 public bool Equals(PartialEMSPlanBranch other)
 {
     for (int i = 0; i < FullAmbs.Length; i++)
     {
         if (FullAmbs[i] != other.FullAmbs[i] ||
             PartAmbs[i] != other.PartAmbs[i])
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
        public override Branch[] GetBranches()
        {
            Branch[] regions = new Branch[2 * FullAmbs.Length];
            for (int i = 0; i < FullAmbs.Length; i++)
            {
                // Add a plan with an extra full time ambulance in each possible way
                int[] newPlanFull = (int[])FullAmbs.Clone();
                newPlanFull[i]++;
                regions[i] = new PartialEMSPlanBranch(newPlanFull, PartAmbs, TargetAmbulanceCount, rand);

                // Do the same for part time
                int[] newPlanPart = (int[])PartAmbs.Clone();
                newPlanPart[i]++;
                regions[i + FullAmbs.Length] = new PartialEMSPlanBranch(FullAmbs, newPlanPart, TargetAmbulanceCount, rand);
            }

            return(regions);
        }