Пример #1
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            int                 negativeCycleLength = testSize / 2;
            int                 positiveCycleLength = testSize - negativeCycleLength + 1;
            List <int>          negativeCycle       = new List <int>(Enumerable.Range(0, negativeCycleLength));
            List <int>          positiveCycle       = new List <int>(Enumerable.Range(negativeCycle.Last(), positiveCycleLength));
            List <ExchangePair> edges = new List <ExchangePair>();

            Random rng = new Random(10113);

            if (rng.NextDouble() > 0.5)
            {
                positiveCycle.Reverse();
            }

            edges.AddRange(CurrencyGraphHelper.ConstructCycle(12609 * testNumber,
                                                              negativeCycle.ToArray(),
                                                              expectedBestPrices,
                                                              true));
            edges.AddRange(CurrencyGraphHelper.ConstructCycle(13413 * testNumber,
                                                              positiveCycle.ToArray(),
                                                              expectedBestPrices,
                                                              false));

            negativeCycle.Add(0);
            for (int i = 0; i < testSize; i++)
            {
                expectedBestPrices[i]      = null;
                expectedArbitrages[i]      = true;
                expectedArbitrageCycles[i] = negativeCycle.ToArray();
            }
            exchanges = edges.ToArray();
        }
Пример #2
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            int                 cycleLength = testSize / 2;
            int                 pathLength  = testSize - cycleLength + 1;
            List <int>          cycle       = new List <int>(Enumerable.Range(0, cycleLength));
            List <ExchangePair> edges       = new List <ExchangePair>();

            edges.AddRange(CurrencyGraphHelper.ConstructCycle(6171 * testNumber,
                                                              cycle.ToArray(),
                                                              expectedBestPrices,
                                                              true));
            edges.AddRange(CurrencyGraphHelper.ConstructPath(7291 * testNumber,
                                                             Enumerable.Range(cycle.Last(), pathLength).Reverse().ToArray(),
                                                             null));

            cycle.Add(0);
            for (int i = 0; i < testSize; i++)
            {
                expectedBestPrices[i]      = null;
                expectedArbitrages[i]      = true;
                expectedArbitrageCycles[i] = cycle.ToArray();
            }
            exchanges = edges.ToArray();
        }
Пример #3
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            // start = 0
            // end = 1
            int firstPathLength  = (testSize - 2) / 2;
            int secondPathLength = testSize - 2 - firstPathLength;

            List <ExchangePair> edges = new List <ExchangePair>();
            List <int>          firstPath, secondPath;

            firstPath  = new List <int>(new int[] { 0, 1 });
            secondPath = new List <int>(new int[] { 0, 1 });
            firstPath.InsertRange(1, Enumerable.Range(2, firstPathLength));
            secondPath.InsertRange(1, Enumerable.Range(firstPathLength + 2, secondPathLength));

            edges.AddRange(CurrencyGraphHelper.ConstructPath(2057 * testNumber,
                                                             firstPath.ToArray(),
                                                             expectedBestPrices));
            edges.AddRange(CurrencyGraphHelper.ConstructPath(3043 * testNumber,
                                                             secondPath.ToArray(),
                                                             expectedBestPrices));
            exchanges = edges.ToArray();
        }
Пример #4
0
 protected override void PrepareTestData()
 {
     base.PrepareTestData();
     exchanges = CurrencyGraphHelper.ConstructPath(1013 * testNumber,
                                                   Enumerable.Range(0, testSize).Reverse().ToArray(),
                                                   expectedBestPrices).ToArray();
 }
Пример #5
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            exchanges = CurrencyGraphHelper.ConstructCycle(4577 * testNumber,
                                                           Enumerable.Range(0, testSize).ToArray(),
                                                           expectedBestPrices,
                                                           false).ToArray();
        }
Пример #6
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            List <int> cycle = new List <int>(Enumerable.Range(0, testSize));

            exchanges = CurrencyGraphHelper.ConstructCycle(5797 * testNumber,
                                                           cycle.ToArray(),
                                                           expectedBestPrices,
                                                           true).ToArray();

            cycle.Add(0);
            for (int i = 0; i < testSize; i++)
            {
                expectedBestPrices[i]      = null;
                expectedArbitrages[i]      = true;
                expectedArbitrageCycles[i] = cycle.ToArray();
            }
        }