static void Main(string[] args) { double MillionD = 1000d * 1000d; //uint H = 48; //uint threshold = H - 4; uint n = 1 << 29; double requestFraction = 1d; double f_c = requestFraction / MillionD; // one in a million double f_u = requestFraction / (50d * MillionD); string basePath = @"..\..\..\"; // StreamWriter writer = new StreamWriter(basePath + "params_" + H + "_" + Math.Round(1/f_c) + "=" + Math.Round(1/f_u) + ".csv"); BinomialLadderParameters blf64 = new BinomialLadderParameters(64, n: n); BinomialLadderParameters blf48 = new BinomialLadderParameters(48, n: n); // BinomialLadderParameters blfPIN = // new BinomialLadderParameters(1 << 19, 1 << 20); //double[] dist = BinomialLadderParameters.BLFDistribution(1 << 19, 1 << 20); //double[] cum = new double[dist.Length]; //double total = 0; //for (int h = dist.Length - 1; h >= 0; h--) // cum[h] = total += dist[h]; //double middle = dist[(1 << 19)]; //double plus100 = dist[(1 << 19) + 100]; //double plus1000 = dist[(1 << 19) + 1000]; //BinomialLadderParameters blf20 = // new BinomialLadderParameters(48, n: n); //blf20.SimulateStochastic(basePath + "BLF_20_Detect_Twenty_Sticky", .05, 100, true); //blf20.SimulateStochastic(basePath + "BLF_20_Detect_Twenty_Perpetual", .05, 100, false); //blf64.SimulateStochastic(basePath + "BLF_48_DetectStochastic_OneMillion", (1d / MillionD), 60, false); //blfPIN.SimulateStochastic(basePath + "BLF_PIN20_Perpetual_Hundred", (1d / 5000), ); Task[] tasks = new Task[] { Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Perpetual_Million", (1d / MillionD), 120, false)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Sticky_Million", (1d / MillionD), 120, true)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Perpetual_FiftyMillion", (1d / (50d * MillionD)), 65, false)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Sticky_FiftyMillion", (1d / (50d * MillionD)), 65, true)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Perpetual_Million", (1d / MillionD), 100, false)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Sticky_Million", (1d / MillionD), 100, true)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Perpetual_FiftyMillion", (1d / (50d * MillionD)), 65, false)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Sticky_FiftyMillion", (1d / (50d * MillionD)), 65, true)), }; Task.WaitAll(tasks); }
static void Main(string[] args) { double MillionD = 1000d*1000d; //uint H = 48; //uint threshold = H - 4; uint n = 1 << 29; double requestFraction = 1d; double f_c = requestFraction / MillionD; // one in a million double f_u = requestFraction / (50d*MillionD); string basePath = @"..\..\..\"; // StreamWriter writer = new StreamWriter(basePath + "params_" + H + "_" + Math.Round(1/f_c) + "=" + Math.Round(1/f_u) + ".csv"); BinomialLadderParameters blf64 = new BinomialLadderParameters(64, n: n); BinomialLadderParameters blf48 = new BinomialLadderParameters(48, n: n); // BinomialLadderParameters blfPIN = // new BinomialLadderParameters(1 << 19, 1 << 20); //double[] dist = BinomialLadderParameters.BLFDistribution(1 << 19, 1 << 20); //double[] cum = new double[dist.Length]; //double total = 0; //for (int h = dist.Length - 1; h >= 0; h--) // cum[h] = total += dist[h]; //double middle = dist[(1 << 19)]; //double plus100 = dist[(1 << 19) + 100]; //double plus1000 = dist[(1 << 19) + 1000]; //BinomialLadderParameters blf20 = // new BinomialLadderParameters(48, n: n); //blf20.SimulateStochastic(basePath + "BLF_20_Detect_Twenty_Sticky", .05, 100, true); //blf20.SimulateStochastic(basePath + "BLF_20_Detect_Twenty_Perpetual", .05, 100, false); //blf64.SimulateStochastic(basePath + "BLF_48_DetectStochastic_OneMillion", (1d / MillionD), 60, false); //blfPIN.SimulateStochastic(basePath + "BLF_PIN20_Perpetual_Hundred", (1d / 5000), ); Task[] tasks = new Task[] { Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Perpetual_Million", (1d / MillionD), 120, false)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Sticky_Million", (1d / MillionD), 120, true)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Perpetual_FiftyMillion", (1d / (50d*MillionD)), 65, false)), Task.Run(() => blf64.SimulateStochastic(basePath + "BLF_64_Sticky_FiftyMillion", (1d / (50d*MillionD)), 65, true)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Perpetual_Million", (1d / MillionD), 100, false)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Sticky_Million", (1d / MillionD), 100, true)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Perpetual_FiftyMillion", (1d / (50d*MillionD)), 65, false)), Task.Run(() => blf48.SimulateStochastic(basePath + "BLF_48_Sticky_FiftyMillion", (1d / (50d*MillionD)), 65, true)), }; Task.WaitAll(tasks); }