Example #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();
        }
Example #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();
        }
Example #3
0
        protected override void PrepareTestData()
        {
            base.PrepareTestData();

            exchanges = CurrencyGraphHelper.ConstructCycle(4577 * testNumber,
                                                           Enumerable.Range(0, testSize).ToArray(),
                                                           expectedBestPrices,
                                                           false).ToArray();
        }
Example #4
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();
            }
        }