/// <summary>
        /// Resequence the route destinations.
        /// </summary>
        /// <param name="route">A route object</param>
        public void ResequenceRouteDestinations(DataObjectRoute route = null)
        {
            bool isInnerExample = route == null ? true : false;

            if (isInnerExample)
            {
                RunOptimizationSingleDriverRoute10Stops();
                OptimizationsToRemove = new List <string>()
                {
                    SD10Stops_optimization_problem_id
                };

                route = SD10Stops_route;
            }

            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            // Switch 2 addresses after departure address:

            AddressesOrderInfo addressesOrderInfo = new AddressesOrderInfo();

            addressesOrderInfo.RouteId   = route.RouteID;
            addressesOrderInfo.Addresses = new AddressInfo[0];

            for (int i = 0; i < route.Addresses.Length; i++)
            {
                Address     address     = route.Addresses[i];
                AddressInfo addressInfo = new AddressInfo();

                addressInfo.DestinationId = address.RouteDestinationId.Value;

                addressInfo.SequenceNo = i;

                addressInfo.SequenceNo = i == 1 ? 2 : 1;

                addressInfo.IsDepot = (addressInfo.SequenceNo == 0);

                var addressesList = new List <AddressInfo>(addressesOrderInfo.Addresses);

                addressesList.Add(addressInfo);

                addressesOrderInfo.Addresses = addressesList.ToArray();
            }

            // Run the query
            DataObjectRoute route1 = route4Me
                                     .GetJsonObjectFromAPI <DataObjectRoute>(addressesOrderInfo,
                                                                             R4MEInfrastructureSettings.RouteHost,
                                                                             HttpMethodType.Put,
                                                                             out string errorString1);

            // Output the result
            PrintExampleRouteResult(route1, errorString1);

            if (isInnerExample)
            {
                RemoveTestOptimizations();
            }
        }
        public void ResequenceRouteDestinations(DataObjectRoute route)
        {
            if (route.Addresses == null && route.Addresses.Length < 3)
            {
                Console.WriteLine("ResequenceRouteDestinations error {0}", "route.Addresses == null && route.Addresses.Length < 3. Number of addresses should be >= 3");
                return;
            }

            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            // Switch 2 addresses after departure address:

            AddressesOrderInfo addressesOrderInfo = new AddressesOrderInfo();

            addressesOrderInfo.RouteId   = route.RouteID;
            addressesOrderInfo.Addresses = new AddressInfo[0];
            for (int i = 0; i < route.Addresses.Length; i++)
            {
                Address     address     = route.Addresses[i];
                AddressInfo addressInfo = new AddressInfo();
                addressInfo.DestinationId = address.RouteDestinationId.Value;
                addressInfo.SequenceNo    = i;
                if (i == 1)
                {
                    addressInfo.SequenceNo = 2;
                }
                else if (i == 2)
                {
                    addressInfo.SequenceNo = 1;
                }
                addressInfo.IsDepot = (addressInfo.SequenceNo == 0);
                List <AddressInfo> addressesList = new List <AddressInfo>(addressesOrderInfo.Addresses);
                addressesList.Add(addressInfo);
                addressesOrderInfo.Addresses = addressesList.ToArray();
            }

            // Run the query
            string          errorString1 = "";
            DataObjectRoute route1       = route4Me.GetJsonObjectFromAPI <DataObjectRoute>(addressesOrderInfo,
                                                                                           R4MEInfrastructureSettings.RouteHost,
                                                                                           HttpMethodType.Put,
                                                                                           out errorString1);

            // Output the result
            PrintExampleOptimizationResult("ResequenceRouteDestinations, switch 2 addresses.", route1, errorString1);
            Console.WriteLine("");
        }
        public void ResequenceRouteDestinations(DataObjectRoute route)
        {
            if (route.Addresses == null && route.Addresses.Length < 3)
              {
            Console.WriteLine("ResequenceRouteDestinations error {0}", "route.Addresses == null && route.Addresses.Length < 3. Number of addresses should be >= 3");
            return;
              }

              // Create the manager with the api key
              Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

              // Switch 2 addresses after departure address:

              AddressesOrderInfo addressesOrderInfo = new AddressesOrderInfo();
              addressesOrderInfo.RouteId = route.RouteID;
              addressesOrderInfo.Addresses = new AddressInfo[0];
              for (int i = 0; i < route.Addresses.Length; i++)
              {
            Address address = route.Addresses[i];
            AddressInfo addressInfo = new AddressInfo();
            addressInfo.DestinationId = address.RouteDestinationId.Value;
            addressInfo.SequenceNo = i;
            if (i == 1)
              addressInfo.SequenceNo = 2;
            else if (i == 2)
              addressInfo.SequenceNo = 1;
            addressInfo.IsDepot = (addressInfo.SequenceNo == 0);
            List<AddressInfo> addressesList = new List<AddressInfo>(addressesOrderInfo.Addresses);
            addressesList.Add(addressInfo);
            addressesOrderInfo.Addresses = addressesList.ToArray();
              }

              // Run the query
              string errorString1 = "";
              DataObjectRoute route1 = route4Me.GetJsonObjectFromAPI<DataObjectRoute>(addressesOrderInfo,
                                                                                          R4MEInfrastructureSettings.RouteHost,
                                                                                          HttpMethodType.Put,
                                                                                          out errorString1);

              // Output the result
              PrintExampleOptimizationResult("ResequenceRouteDestinations, switch 2 addresses.", route1, errorString1);
              Console.WriteLine("");
        }