Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/25/17 16:20:27 (6 years ago)
Author:
abeham
Message:

#2205: added GetSolution() method to FLP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode1.cs

    r14606 r14607  
    278278
    279279      var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value;
    280       var bestFlpQuality = FlpParameter.Value.Evaluate(bestFlpSolution);
    281       var flpCustomerDemands = (DoubleArray)FlpParameter.Value.CustomerDemandsParameter.Value.Clone();
    282       var flpDeliveryCosts = (DoubleMatrix)FlpParameter.Value.DeliveryCostsParameter.Value.Clone();
    283       var flpDepotCapacities = (DoubleArray)FlpParameter.Value.DepotCapacitiesParameter.Value.Clone();
    284       var flpOpeningCosts = (DoubleArray)FlpParameter.Value.OpeningCostsParameter.Value.Clone();
    285       double totalOpeningCosts, totalDeliveryCosts; double[] depotUsage;
    286       FacilityLocationProblem.Evaluate(bestFlpSolution.ToArray(), flpOpeningCosts, flpDepotCapacities, flpCustomerDemands, flpDeliveryCosts, out totalOpeningCosts, out totalDeliveryCosts, out depotUsage);
    287       var flpSolution = new FacilityLocationSolution {
    288         OpeningCosts = flpOpeningCosts,
    289         DepotCapacities = flpDepotCapacities,
    290         CustomerDemands = flpCustomerDemands,
    291         DeliveryCosts = flpDeliveryCosts
    292       };
    293       flpSolution.CustomerToDepotAssignmentParameter.Value = bestFlpSolution;
    294       flpSolution.FitnessValueParameter.Value = new DoubleValue(bestFlpQuality);
    295       flpSolution.TotalOpeningCostsParameter.Value = new DoubleValue(totalOpeningCosts);
    296       flpSolution.TotalDeliveryCostsParameter.Value = new DoubleValue(totalDeliveryCosts);
    297       flpSolution.TotalOverbookedCapacityParameter.Value = new DoubleValue(bestFlpQuality - totalOpeningCosts - totalDeliveryCosts);
    298 
     280      var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution);
     281     
    299282      var depots = bestFlpSolution.Select((x, i) => Tuple.Create(x, i)).GroupBy(x => x.Item1, x => x.Item2);
    300283      var vrpSolutions = new ResultCollection(depots.Count());
     
    305288        var vrp = (VehicleRoutingProblem)VrpParameter.Value.Clone();
    306289        var vrpInstance = (CVRPProblemInstance)vrp.ProblemInstance;
    307         var coordinates = LrpUtils.GetVrpCoordinates(depotCoordinates, customerCoordinates, depot.Key, customers);
     290        var coordinates = LrpUtils.GetVrpCoordinates(depotCoordinates, customerCoordinates, depotIdx, customers);
    308291        var distances = LrpUtils.GetVrpDistances(coordinates, distanceType);
    309292        vrpInstance.Coordinates = new DoubleMatrix(coordinates);
Note: See TracChangeset for help on using the changeset viewer.