/// <summary>
        /// Try to plan the intersection heavily penalizing the interconnect
        /// </summary>
        /// <param name="iTraversableWaypoint"></param>
        /// <param name="iArbiterWaypoint"></param>
        /// <param name="arbiterInterconnect"></param>
        /// <returns></returns>
        public IntersectionPlan PlanIntersectionWithoutInterconnect(ITraversableWaypoint exit, IArbiterWaypoint goal, ArbiterInterconnect interconnect)
        {
            // save old blockage
            NavigationBlockage tmpBlockage = interconnect.Blockage;

            // create new
            NavigationBlockage newerBlockage = new NavigationBlockage(Double.MaxValue);

            newerBlockage.BlockageExists = true;
            interconnect.Blockage        = newerBlockage;

            KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> > tmpCurrentTimes = currentTimes;

            this.currentTimes = new KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> >();

            // plan
            IntersectionPlan ip = this.PlanIntersection(exit, goal);

            this.currentTimes = tmpCurrentTimes;

            // reset interconnect blockage
            interconnect.Blockage = tmpBlockage;

            // return plan
            return(ip);
        }
        /// <summary>
        /// Get a road plan while setting partition costs very high
        /// </summary>
        /// <param name="partition"></param>
        /// <param name="goal"></param>
        /// <param name="blockAdjacent"></param>
        /// <param name="c"></param>
        /// <returns></returns>
        public RoadPlan PlanRoadOppositeWithoutPartition(ArbiterLanePartition partition, ArbiterLanePartition opposite, IArbiterWaypoint goal, bool blockAdjacent, Coordinates c, bool sameWay)
        {
            KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> > tmpCurrentTimes = currentTimes;

            this.currentTimes = new KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> >();
            RoadPlan rp = null;

            if (!blockAdjacent)
            {
                NavigationBlockage nb  = partition.Blockage;
                NavigationBlockage tmp = new NavigationBlockage(double.MaxValue);
                partition.Blockage = tmp;
                rp = this.PlanNavigableArea(partition.Lane, c, goal, new List <ArbiterWaypoint>());
                partition.Blockage = nb;
            }
            else
            {
                // save
                List <KeyValuePair <ArbiterLanePartition, NavigationBlockage> > savedBlockages = new List <KeyValuePair <ArbiterLanePartition, NavigationBlockage> >();

                // set
                savedBlockages.Add(new KeyValuePair <ArbiterLanePartition, NavigationBlockage>(partition, partition.Blockage));
                // create new
                NavigationBlockage anewerBlockage = new NavigationBlockage(Double.MaxValue);
                anewerBlockage.BlockageExists = true;
                partition.Blockage            = anewerBlockage;

                foreach (ArbiterLanePartition alp in partition.NonLaneAdjacentPartitions)
                {
                    if (alp.IsInside(c) && (!sameWay || (sameWay && partition.Lane.Way.Equals(alp.Lane.Way))))
                    {
                        savedBlockages.Add(new KeyValuePair <ArbiterLanePartition, NavigationBlockage>(alp, alp.Blockage));

                        // create new
                        NavigationBlockage newerBlockage = new NavigationBlockage(Double.MaxValue);
                        newerBlockage.BlockageExists = true;
                        alp.Blockage = newerBlockage;
                    }
                }

                // plan
                rp = this.PlanNavigableArea(opposite.Lane, c, goal, new List <ArbiterWaypoint>());

                // restore
                foreach (KeyValuePair <ArbiterLanePartition, NavigationBlockage> saved in savedBlockages)
                {
                    saved.Key.Blockage = saved.Value;
                }
            }

            // restore
            this.currentTimes = tmpCurrentTimes;

            // return
            return(rp);
        }
        /// <summary>
        /// Try to plan the intersection heavily penalizing the interconnect
        /// </summary>
        /// <param name="iTraversableWaypoint"></param>
        /// <param name="iArbiterWaypoint"></param>
        /// <param name="arbiterInterconnect"></param>
        /// <returns></returns>
        public IntersectionPlan PlanIntersectionWithoutInterconnect(ITraversableWaypoint exit, IArbiterWaypoint goal, ArbiterInterconnect interconnect, bool blockAllRelated)
        {
            ITraversableWaypoint entry = (ITraversableWaypoint)interconnect.FinalGeneric;

            if (!blockAllRelated)
            {
                return(this.PlanIntersectionWithoutInterconnect(exit, goal, interconnect));
            }
            else
            {
                Dictionary <IConnectAreaWaypoints, NavigationBlockage> saved = new Dictionary <IConnectAreaWaypoints, NavigationBlockage>();
                if (entry.IsEntry)
                {
                    foreach (ArbiterInterconnect ai in entry.Entries)
                    {
                        saved.Add(ai, ai.Blockage);

                        // create new
                        NavigationBlockage newerBlockage = new NavigationBlockage(Double.MaxValue);
                        newerBlockage.BlockageExists = true;
                        ai.Blockage = newerBlockage;
                    }
                }

                if (entry is ArbiterWaypoint && ((ArbiterWaypoint)entry).PreviousPartition != null)
                {
                    ArbiterLanePartition alp = ((ArbiterWaypoint)entry).PreviousPartition;
                    saved.Add(alp, alp.Blockage);

                    // create new
                    NavigationBlockage newerBlockage = new NavigationBlockage(Double.MaxValue);
                    newerBlockage.BlockageExists = true;
                    alp.Blockage = newerBlockage;
                }

                KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> > tmpCurrentTimes = currentTimes;
                this.currentTimes = new KeyValuePair <int, Dictionary <ArbiterWaypointId, DownstreamPointOfInterest> >();

                // plan
                IntersectionPlan ip = this.PlanIntersection(exit, goal);

                this.currentTimes = tmpCurrentTimes;

                // reset the blockages
                foreach (KeyValuePair <IConnectAreaWaypoints, NavigationBlockage> savedPair in saved)
                {
                    savedPair.Key.Blockage = savedPair.Value;
                }

                // return plan
                return(ip);
            }
        }