Package jsprit.core.algorithm.state

Examples of jsprit.core.algorithm.state.StateManager$States_


                return vrp.copyAndGetActivities(job);
            }
        };
        route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(activityFactory).addService(s1).addService(s2).addService(s3).build();

        stateManager = new StateManager(mock(VehicleRoutingProblem.class));
        stateManager.addStateUpdater(new UpdateVariableCosts(activityCosts,routingCosts,stateManager));
        stateManager.informInsertionStarts(Arrays.asList(route), Collections.<Job>emptyList());
        constraintManager = new ConstraintManager(vrp,stateManager);
    }
View Full Code Here


        VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(builder).read("src/test/resources/pdp.xml");

        VehicleRoutingProblem vrp = builder.build();

        final StateManager stateManager = new StateManager(vrp);
        stateManager.updateLoadStates();
//        stateManager.updateTimeWindowStates();
        stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager));

        ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
//        constraintManager.addTimeWindowConstraint();
        constraintManager.addLoadConstraint();

        VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();

        BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager,constraintManager);
        InsertionStrategy bestInsertion = bestIBuilder.build();


        RuinStrategy radial = new RadialRuinStrategyFactory( 0.3, new AvgServiceAndShipmentDistance(vrp.getTransportCosts())).createStrategy(vrp);
        RuinStrategy random = new RandomRuinStrategyFactory(0.5).createStrategy(vrp);


        SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() {

            @Override
            public double getCosts(VehicleRoutingProblemSolution solution) {
                double costs = 0.0;
                for(VehicleRoute route : solution.getRoutes()){
                    costs += stateManager.getRouteState(route, InternalStates.COSTS, Double.class);
                }
                return costs;
            }
        };
View Full Code Here

    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(currentLoad);
    when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(currentLoad);

    constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
   
    stateManager = new StateManager(mock(VehicleRoutingProblem.class));
    stateManager.updateLoadStates();
  }
View Full Code Here

  public void setup(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder).read("src/test/resources/vrpnc1-jsprit.xml");
    vrp = builder.build();
   
    final StateManager stateManager = new StateManager(vrp);
    stateManager.updateLoadStates();
    stateManager.updateTimeWindowStates();
    stateManager.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), stateManager));


    ConstraintManager cManager = new ConstraintManager(vrp, stateManager);
    cManager.addLoadConstraint();
    cManager.addTimeWindowConstraint();
   
       
    VehicleFleetManager fleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
   
    InsertionStrategy bestInsertion = new BestInsertionBuilder(vrp, fleetManager, stateManager, cManager).build();
   
    RuinStrategy radial = new RadialRuinStrategyFactory(0.15, new AvgServiceDistance(vrp.getTransportCosts())).createStrategy(vrp);
    RuinStrategy random = new RandomRuinStrategyFactory(0.25).createStrategy(vrp);
   
    SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() {
     
      @Override
      public double getCosts(VehicleRoutingProblemSolution solution) {
        double costs = 0.0;
        for(VehicleRoute route : solution.getRoutes()){
          costs += stateManager.getRouteState(route, InternalStates.COSTS,Double.class);
        }
        return costs;
      }
    };
   
View Full Code Here

    jobs.add(second);
    jobs.add(third);
   
    vrp = VehicleRoutingProblem.Builder.newInstance().addAllJobs(jobs).addVehicle(vehicle).addVehicle(newVehicle).setRoutingCost(costs).build();
   
    states = new StateManager(vrp);
    states.updateLoadStates();
    states.updateTimeWindowStates();
    states.addStateUpdater(new UpdateVariableCosts(vrp.getActivityCosts(), vrp.getTransportCosts(), states));
   
    ConstraintManager cManager = new ConstraintManager(vrp,states);
View Full Code Here

   
    Inserter inserter = new Inserter(new InsertionListeners(), vrp);
    inserter.insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
    inserter.insertJob(shipment2, new InsertionData(0,1,2,vehicle,null), route);

        StateManager stateManager = new StateManager(vrp);
    stateManager.updateLoadStates();   
    stateManager.informInsertionStarts(Arrays.asList(route), null);
   
    ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
    constraintManager.addConstraint(new PickupAndDeliverShipmentLoadActivityLevelConstraint(stateManager),Priority.CRITICAL);
    constraintManager.addConstraint(new ShipmentPickupsFirstConstraint(),Priority.CRITICAL);
       
View Full Code Here

    Inserter inserter = new Inserter(new InsertionListeners(), vrp);
   
    inserter.insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
    inserter.insertJob(shipment2, new InsertionData(0,1,2,vehicle,null), route);

    StateManager stateManager = new StateManager(vrp);
    stateManager.updateLoadStates();
    stateManager.informInsertionStarts(Arrays.asList(route), null);

    ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
    constraintManager.addLoadConstraint();
   
    stateManager.informInsertionStarts(Arrays.asList(route), null);
   
    JobCalculatorSwitcher switcher = new JobCalculatorSwitcher();
    ServiceInsertionCalculator serviceInsertionCalc = new ServiceInsertionCalculator(routingCosts, activityInsertionCostsCalculator, constraintManager);
    ShipmentInsertionCalculator insertionCalculator = new ShipmentInsertionCalculator(routingCosts, activityInsertionCostsCalculator, constraintManager);
    switcher.put(Pickup.class, serviceInsertionCalc);
View Full Code Here

    vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
      .addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
   
    final StateManager stateManager = new StateManager(vrp);
   

    ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
    constraintManager.addLoadConstraint();
    constraintManager.addTimeWindowConstraint();
View Full Code Here

//    vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
      .addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
   
    final StateManager stateManager = new StateManager(vrp);

    ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
    constraintManager.addLoadConstraint();
    constraintManager.addTimeWindowConstraint();
   
View Full Code Here

    jobs.add(third);
    jobs.add(second);
   
    vrp = VehicleRoutingProblem.Builder.newInstance().addAllJobs(jobs).addVehicle(vehicle).setRoutingCost(costs).build();
   
    states = new StateManager(vrp);
    states.updateLoadStates();
    states.updateTimeWindowStates();
   
    ConstraintManager cManager = new ConstraintManager(vrp,states);
    cManager.addLoadConstraint();
View Full Code Here

TOP

Related Classes of jsprit.core.algorithm.state.StateManager$States_

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.