Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public AssignOrdersOperation(SolverContext context,
                                     Schedule schedule,
                                     AssignOrdersParams inputParams,
                                     SolveOptions options)
            : base(context, schedule, options)
        {
            Debug.Assert(inputParams != null);
            _inputParams = inputParams;
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public SequenceRoutesOperation(SolverContext context,
                                       Schedule schedule,
                                       SequenceRoutesParams inputParams,
                                       SolveOptions options)
            : base(context, schedule, options)
        {
            Debug.Assert(inputParams != null);
            _inputParams = inputParams;
        }
Exemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public BuildRoutesOperation(SolverContext context,
                                    Schedule schedule,
                                    SolveOptions options,
                                    BuildRoutesParameters inputParams)
            : base(context, schedule, options)
        {
            Debug.Assert(inputParams != null);
            _inputParams = inputParams;
        }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public AssignOrdersReqBuilder(SolverContext context,
                                      ICollection <Order> unlockedOrdersToAssign,
                                      ICollection <Route> unlockedTargetRoutes,
                                      bool setAssignmentSpec)
            : base(context)
        {
            _unlockedOrdersToAssign = unlockedOrdersToAssign;
            _unlockedTargetRoutes   = unlockedTargetRoutes;
            _setAssignmentSpec      = setAssignmentSpec;
        }
        /// <summary>
        /// Creates orders assigning operation result without solving.
        /// </summary>
        /// <param name="context">Solve operation context.</param>
        /// <param name="requestData">Solve operation request data.</param>
        /// <param name="violations">Violations found upon request building.</param>
        /// <returns>Result of the solve for the specified request.</returns>
        public static SolveResult CreateResultWithoutSolve(
            SolverContext context,
            SolveRequestData requestData,
            IEnumerable <Violation> violations)
        {
            foreach (var route in requestData.Routes)
            {
                context.Project.Schedules.ClearRouteResults(route);
            }

            return(new SolveResult(null, violations.ToArray(), false));
        }
Exemplo n.º 6
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructor with parameters.
        /// </summary>
        /// <param name="context">Solver context.</param>
        /// <param name="inputParams">Input parameters.</param>
        public GenDirectionsOperation(SolverContext context, GenDirectionsParams inputParams)
        {
            Debug.Assert(inputParams != null);
            Debug.Assert(inputParams.Routes != null);

            if (inputParams.Routes.Count > 0)
            {
                _schedule = inputParams.Routes.First().Schedule;
            }

            _context     = context;
            _inputParams = inputParams;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public AssignOrdersStep2(SolverContext context,
                                 Schedule schedule,
                                 SolveRequestData reqData,
                                 AssignOrdersParams inputParams,
                                 IList <RouteResult> prevRouteResults,
                                 IList <Violation> prevViolations,
                                 SolveOptions options)
            : base(context, schedule, options)
        {
            _reqData          = reqData;
            _inputParams      = inputParams;
            _prevRouteResults = prevRouteResults;
            _prevViolations   = prevViolations;
        }
Exemplo n.º 8
0
 public BuildRoutesOperation(SolverContext context,
                             Schedule schedule,
                             SolveOptions options,
                             SolveRequestData reqData,
                             List <Violation> violations,
                             BuildRoutesParameters inputParams)
     : base(context, schedule, options)
 {
     Debug.Assert(reqData != null);
     Debug.Assert(violations != null);
     Debug.Assert(inputParams != null);
     _reqData     = reqData;
     _violations  = violations;
     _inputParams = inputParams;
 }
Exemplo n.º 9
0
        public AssignOrdersOperation(SolverContext context,
                                     Schedule schedule,
                                     AssignOrdersParams inputParams,
                                     SolveOptions options,
                                     SolveRequestData reqData,
                                     AssignOrdersReqBuilder reqBuilder,
                                     List <Violation> violations)
            : base(context, schedule, options)
        {
            Debug.Assert(inputParams != null);
            Debug.Assert(reqData != null);
            Debug.Assert(reqBuilder != null);
            Debug.Assert(violations != null);

            _inputParams = inputParams;
            _reqData     = reqData;
            _reqBuilder  = reqBuilder;
            _violations  = violations;
        }
        /// <summary>
        /// Checks if orders for the specified schedule could be assigned
        /// without solving.
        /// </summary>
        /// <param name="context">Solve operation context.</param>
        /// <param name="schedule">Schedule to take orders from.</param>
        /// <returns>True if and only if orders for the specified schedule
        /// could be assigned without solving</returns>
        public static bool CanGetResultWithoutSolve(
            SolverContext context,
            Schedule schedule)
        {
            // get orders planned on schedule's date
            var dayOrders = context.Project.Orders.Search(
                (DateTime)schedule.PlannedDate);

            // check if we have at least one geocoded order
            bool haveGeocodedOrders = false;

            foreach (var order in dayOrders)
            {
                if (order.IsGeocoded)
                {
                    haveGeocodedOrders = true;
                    break;
                }
            }

            return(!haveGeocodedOrders);
        }
Exemplo n.º 11
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Create a new instance of the <c>VrpOperation</c> class.
        /// </summary>
        /// <param name="context">Solver context.</param>
        /// <param name="schedule">Current schedule.</param>
        /// <param name="options">Solve options.</param>
        public VrpOperation(SolverContext context, Schedule schedule, SolveOptions options)
        {
            _context  = context;
            _schedule = schedule;
            _options  = options;
        }
Exemplo n.º 12
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public BuildRoutesReqBuilder(SolverContext context)
            : base(context)
        {
        }
Exemplo n.º 13
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <c>RouteRequestBuilder</c> class.
        /// </summary>
        /// <param name="context">Solver context.</param>
        public RouteRequestBuilder(SolverContext context)
        {
            _context = context;
        }
Exemplo n.º 14
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public SequenceRoutesReqBuilder(SolverContext context)
            : base(context)
        {
        }