Пример #1
0
 public ControlledLRxTravelHyperNetwork(DPNProblemContext ctx, DiscreteTimeAdapter adapter,
                                        ObjectTravelHyperNetwork objNet,
                                        CustomerArrival customer,                                              //旅客
                                        Dictionary <CustomerArrival, List <TravelPath> > PathDict,
                                        Dictionary <IServiceSegment, decimal> LM_rho,                          //拉格朗日乘子 ρ
                                        Dictionary <CustomerArrival, Dictionary <TravelPath, decimal> > LM_mu, //拉格朗日乘子 μ
                                        Dictionary <IEdge <TravelHyperNode>, decimal> LM_lambda,
                                        Dictionary <IEdge <TravelHyperNode>, bool> y) : base(ctx, adapter, objNet, customer, PathDict, LM_rho, LM_mu, LM_lambda)
 {
     _y = y;
 }
Пример #2
0
        //one argument class constructor
        public RunAutomation(Platform platform)
        {
            this.platform = platform;

            #region Reference initialization
            helperObj        = new Helper();
            mainPageObj      = new MainPage();
            loginPageObj     = new LoginPage();
            comptTempObj     = new ComptTempPage();
            actStockObj      = new ActualStockPage();
            comptEditObj     = new ComptEditPage();
            comptCapacityObj = new ComptCapacity();
            selShiftObj      = new ShiftStartPage();
            trpStartObj      = new TripStartPage();
            trvlToObj        = new TravellingToPage();
            kmCtrlObj        = new KMControlPage();
            xlRdrObj         = new ExcelReader();
            comptStatusObj   = new ComptStatusPage();
            cnfrmDepotObj    = new ConfirmDepotPage();
            cnfrmNameObj     = new ConfirmNamePage();
            plannedLdgObj    = new PlannedLoading();
            actualLdgObj     = new ActualLoading();
            ldgSummaryObj    = new LoadingSummary();
            ldgInfoObj       = new LoadingInfo();
            ovrdCodeobj      = new OverrideNoMixCode();
            comptAssgnObj    = new ComptAssignmentPage();
            custSelObj       = new CustomerSelection();
            delDetailsObj    = new DeliveryDetails();
            custArrivalObj   = new CustomerArrival();
            plndDelDetObj    = new PlannedDeliveryDetails();
            rvwTnkDipsObj    = new ReviewTankDips();
            delSchemeObj     = new DeliveryScheme();
            prodDschgObj     = new ProductDischarge();
            cnfrmDelObj      = new ConfirmDelivery();
            adrobj           = new ADRStart();
            breakObj         = new BreakPage();
            tripendObj       = new TripEndPage();
            shiftendObj      = new ShiftEndPage();
            #endregion

            xlRdrObj.GetCompleteExcelData();
            isSpotTrailer = Convert.ToBoolean(xlRdrObj.GetValueFromSheet("TrailerDetails", "SpotTrailer"));
            noOfCompt     = xlRdrObj.GetValueFromSheet("TrailerDetails", "NoOfCompartments");
            comptCapacity = xlRdrObj.GetValueFromSheet("TrailerDetails", "CompartmentCapacity");
            tankNo1       = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber1");
            tankNo2       = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber2");
            tankNo3       = xlRdrObj.GetValueFromSheet("TrailerDetails", "TankNumber3");
            stockVal1     = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue1"));
            stockVal2     = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue2"));
            stockVal3     = Convert.ToInt32(xlRdrObj.GetValueFromSheet("TrailerDetails", "StockValue3"));
            stockVal      = stockVal1 + stockVal1 + stockVal3;

            calculatedValue = new int[Convert.ToUInt32(noOfCompt)];
        }
Пример #3
0
        public LRxSimNetwork(DPNProblemContext ctx, DiscreteTimeAdapter adapter,
                             ObjectTravelHyperNetwork objNet,
                             CustomerArrival customer,                                              //旅客
                             Dictionary <CustomerArrival, List <TravelPath> > PathDict,
                             Dictionary <IServiceSegment, decimal> LM_rho,                          //拉格朗日乘子 ρ
                             Dictionary <CustomerArrival, Dictionary <TravelPath, decimal> > LM_mu, //拉格朗日乘子 μ
                             Dictionary <IEdge <TravelHyperNode>, decimal> LM_lambda,
                             Dictionary <IEdge <TravelHyperNode>, bool> y) : base(ctx, adapter, y)
        {
            _LM_rho    = LM_rho;
            _LM_mu     = LM_mu;
            _LM_lambda = LM_lambda;
            _u         = (PathDict.ContainsKey(customer) ? PathDict[customer].Sum(i => LM_mu[customer][i]) : 0m);

            _objNet = objNet;
        }
Пример #4
0
        public void LRxPathSearchTest()
        {
            DPNProblemContext   ctx      = GenerateProblemContext();
            CustomerArrival     customer = new CustomerArrival();
            DiscreteTimeAdapter adapter  = new DiscreteTimeAdapter(ctx.StartTime, ctx.EndTime, 1);

            TravelPath p     = new TravelPath();
            var        graph = new LRxTravelHyperNetwork(ctx, adapter,
                                                         ObjectNetworkFactory.Create("", ctx, adapter),
                                                         customer,
                                                         new Dictionary <CustomerArrival, List <TravelPath> >()//path dict
            {
                { customer, new List <TravelPath>()
                  {
                      p
                  } }
            },
                                                         new Dictionary <IServiceSegment, decimal>()//rho
            {
                { ctx.Wor.RailwayTimeTable.Trains.First().ServiceSegments.First(), 0 },
                { ctx.Wor.RailwayTimeTable.Trains.First().ServiceSegments.Last(), 0 },
                { ctx.Wor.RailwayTimeTable.Trains.Last().ServiceSegments.First(), 0 }
            },
                                                         new Dictionary <CustomerArrival, Dictionary <TravelPath, decimal> >()
            {
                { customer, new Dictionary <TravelPath, decimal>()
                  {
                      { p, 1 }
                  } }
            },//mu
                                                         new Dictionary <IEdge <TravelHyperNode>, decimal>());

            graph.Build();

            DijkstraShortestPaths <DirectedWeightedSparseGraph <TravelHyperNode>, TravelHyperNode> dijkstra
                = new DijkstraShortestPaths <DirectedWeightedSparseGraph <TravelHyperNode>, TravelHyperNode>(graph,
                                                                                                             new TravelHyperNode()
            {
                Time = 0, Station = ctx.Wor.Net.StationCollection.First(), Price = 0
            });

            Assert.IsTrue(dijkstra.HasPathTo(new TravelHyperNode()
            {
                Time = adapter.Horizon + 1440, Station = ctx.Wor.Net.StationCollection.Last(), Price = 0
            }) == true);

            var desNode = new TravelHyperNode()
            {
                Time = adapter.Horizon + 1440, Station = ctx.Wor.Net.StationCollection.Last(), Price = 0
            };
            var pathToC      = string.Empty;
            var shortestPath = dijkstra.ShortestPathTo(desNode);

            foreach (var node in shortestPath)
            {
                pathToC = String.Format("{0}({1}) -> ", pathToC, node);
            }

            pathToC = pathToC.TrimEnd(new char[] { ' ', '-', '>' });
            Console.WriteLine("Shortest path to Station 'C': " + pathToC + "\r\n");
            Assert.AreEqual(202m, Math.Round(dijkstra.DistanceTo(desNode)));
        }