public void TestDepotDynamicAsymmetricRouteReplaceEdge()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));

            route.InsertAfter(0, 1);
            route.InsertAfter(1, 2);
            route.InsertAfter(2, 3);
            route.InsertAfter(3, 4);

            var customers = new List <int>(route);

            Assert.AreEqual(5, customers.Count);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);
            Assert.AreEqual(3, customers[3]);
            Assert.AreEqual(4, customers[4]);
            //route.ReplaceEdgeFrom(0, 1);
            Assert.IsTrue(route.IsValid());

            route.ReplaceEdgeFrom(2, 4);
            route.ReplaceEdgeFrom(4, 3);
            route.ReplaceEdgeFrom(3, 0);

            customers = new List <int>(route);
            Assert.AreEqual(5, customers.Count);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);
            Assert.AreEqual(4, customers[3]);
            Assert.AreEqual(3, customers[4]);
            Assert.IsTrue(route.IsValid());

            route.ReplaceEdgeFrom(0, 0);
            customers = new List <int>(route);
            Assert.AreEqual(1, customers.Count);
            Assert.AreEqual(0, customers[0]);

            Assert.IsTrue(route.IsValid());
        }
        public void TestDepotDynamicAsymmetricRouteEmpty()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));

            route.InsertAfter(0, 1);

            var customers = new List <int>(route);

            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
        }
        public void TestDepotDynamicAsymmetricRouteInsertAfter()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));

            route.InsertAfter(0, 1);

            var customers = new List <int>(route);

            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);

            route.InsertAfter(1, 2);

            customers = new List <int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);

            route.InsertAfter(1, 3);

            customers = new List <int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(3, customers[2]);
            Assert.AreEqual(2, customers[3]);

            route.InsertAfter(0, 4);

            customers = new List <int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(4, customers[1]);
            Assert.AreEqual(1, customers[2]);
            Assert.AreEqual(3, customers[3]);
            Assert.AreEqual(2, customers[4]);
        }
Exemple #4
0
        public void TestDepotDynamicAsymmetricRouteReplaceEdge()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));
            route.InsertAfter(0, 1);
            route.InsertAfter(1, 2);
            route.InsertAfter(2, 3);
            route.InsertAfter(3, 4);

            var customers = new List<int>(route);
            Assert.AreEqual(5, customers.Count);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);
            Assert.AreEqual(3, customers[3]);
            Assert.AreEqual(4, customers[4]);
            //route.ReplaceEdgeFrom(0, 1);
            Assert.IsTrue(route.IsValid());

            route.ReplaceEdgeFrom(2, 4);
            route.ReplaceEdgeFrom(4, 3);
            route.ReplaceEdgeFrom(3, 0);

            customers = new List<int>(route);
            Assert.AreEqual(5, customers.Count);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);
            Assert.AreEqual(4, customers[3]);
            Assert.AreEqual(3, customers[4]);
            Assert.IsTrue(route.IsValid());

            route.ReplaceEdgeFrom(0, 0);
            customers = new List<int>(route);
            Assert.AreEqual(1, customers.Count);
            Assert.AreEqual(0, customers[0]);

            Assert.IsTrue(route.IsValid());
        }
Exemple #5
0
        public void TestDepotDynamicAsymmetricRouteInsertAfter()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));

            route.InsertAfter(0, 1);

            var customers = new List<int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);

            route.InsertAfter(1, 2);

            customers = new List<int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(2, customers[2]);

            route.InsertAfter(1, 3);

            customers = new List<int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
            Assert.AreEqual(3, customers[2]);
            Assert.AreEqual(2, customers[3]);

            route.InsertAfter(0, 4);

            customers = new List<int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(4, customers[1]);
            Assert.AreEqual(1, customers[2]);
            Assert.AreEqual(3, customers[3]);
            Assert.AreEqual(2, customers[4]);
        }
Exemple #6
0
        public void TestDepotDynamicAsymmetricRouteEmpty()
        {
            var route = new DepotRoute(
                new DynamicAsymmetricRoute(10, false));

            route.InsertAfter(0, 1);

            var customers = new List<int>(route);
            Assert.AreEqual(0, customers[0]);
            Assert.AreEqual(1, customers[1]);
        }