예제 #1
0
        /// <summary>
        /// Gets the interval of the intersection with the intervals of this table and the given interval.
        /// </summary>
        /// <param name="interval">The interval that overlap with an existing one.</param>
        /// <returns>The overlapping interval</returns>
        public ReservationTable.Interval GetOverlappingInterval(ReservationTable.Interval interval)
        {
            double start;
            double end;

            _intervallTrees[interval.Node].GetOverlappingInterval(interval.Start, interval.End, out start, out end);
            return(new ReservationTable.Interval(interval.Node, start, end));
        }
예제 #2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Node"/> class.
            /// </summary>
            /// <param name="childrenCount">The children count.</param>
            public Node(int agentId, ReservationTable.Interval constraint, Node parent, int childrenCount = 2)
            {
                Children           = new Node[childrenCount];
                AgentId            = agentId;
                IntervalConstraint = constraint;
                _solution          = new Dictionary <int, Path>();
                _reservation       = new Dictionary <int, List <ReservationTable.Interval> >();

                //set backpointer to parent
                if (parent != null)
                {
                    parent._addChild(this);
                    Parent = parent;
                    Depth  = parent.Depth + 1;
                }
                else
                {
                    Depth = 0;
                }

                Debug.Assert(validate());
            }