Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a random plan filled out from this partial plan
 /// </summary>
 /// <returns> A tuple with the full time amb int[] and the part time amb int[], in that order </returns>
 public new Tuple <int[], int[]> GetRandomElement()
 {
     int[] planToTestFull = (int[])FullAmbs.Clone();
     int[] planToTestPart = (int[])PartAmbs.Clone();
     // Fill out the rest of the plan randomly
     for (int i = 0; i < TargetAmbulanceCount - CurrentAmbulancesCount; i++)
     {
         int idx = rand.Next(FullAmbs.Length);
         if (rand.NextDouble() < 0.5)
         {
             planToTestFull[idx]++;
         }
         else
         {
             planToTestPart[idx]++;
         }
     }
     return(new Tuple <int[], int[]>(planToTestFull, planToTestPart));
 }