Exemple #1
0
def capture(topology, wavelengths, iterations, arrivals, departures, reference):
    # Use a fixed seed if you want to see the real difference
    sim = Simulator(topology, wavelengths, iterations, arrivals, departures, reference, None)

    # snapshot = sim.simple_run(3000)
    # samples = random.sample(snapshot, min(3000, len(snapshot)))

    samples = sim.simple_run(3000)

    if len(samples) > 10:
        statistics = stats(map(lambda x: float(x[0]) / float(x[1]), samples))

        average, confidence = statistics[0], statistics[-1]

        print statistics
        print "Collected:", average, confidence

        return average, confidence
    else:
        return 0, 0