Examples of Vehicle


Examples of exercise3.exercise3_10.vehicles.Vehicle

    final String OWNER = "Kubota";
    Vehicle[] vehicles = new Vehicle[VEHICLE_NUM];
   
    
    for(int i = 0; i < vehicles.length; i++) {
      vehicles[i] = new Vehicle();
      vehicles[i].setOwner(OWNER);
      vehicles[i].changeSpeed(Math.random() * i);
      vehicles[i].setDirection(Math.random() * i);
    }
   
    LinkedListImpl<Vehicle> startNode = new LinkedListImpl<Vehicle>(vehicles[0]);
   
    LinkedListImpl<Vehicle> node = startNode;
    for(int i = 1; i < vehicles.length; i++) {
      node.setNext(vehicles[i]);
      node = node.next;
    }
   
    LinkedListImpl<Vehicle> cloned = startNode.clone();
    ((Vehicle)cloned.next.value).setOwner("CHANGE");
    cloned.next.next.next = new LinkedListImpl<Vehicle>(new Vehicle("CHANGE"));
   
    System.out.println(startNode.toString());
    System.out.println(cloned.toString());
  }
View Full Code Here

Examples of github.priyatam.springrest.domain.Vehicle

    @RequestMapping(method = RequestMethod.GET, value = "/vehicle/{vin}")
    @ResponseBody
    public ResponseEntity<Vehicle> getVehicle(@PathVariable String vin) {
        logger.debug(String.format("Retrieving Vehicle %s :", vin));

        Vehicle vehicle = persistenceHelper.loadVehicleByVin(vin);
        if (vehicle == null) {
            logger.warn("No Vehicle found");
            return new ResponseEntity<Vehicle>(null, new HttpHeaders(), HttpStatus.NOT_FOUND);
        }
View Full Code Here

Examples of it.polito.appeal.traci.Vehicle

      conn.nextSimStep();
      conn.nextSimStep();
     
      Collection<Vehicle> vehicles = conn.getVehicleRepository().getAll().values();

      Vehicle aVehicle = vehicles.iterator().next();
     
      System.out.println("Vehicle " + aVehicle
          + " will traverse these edges: "
          + aVehicle.queryReadCurrentRoute().get());
     
      conn.close();
    }
    catch(Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    logger.info("set vehicleSwitchAllowed to " + vehicleSwitchAllowed);
    this.vehicleSwitchAllowed = vehicleSwitchAllowed;
  }

  public InsertionData getInsertionData(final VehicleRoute currentRoute, final Job jobToInsert, final Vehicle vehicle, double newVehicleDepartureTime, final Driver driver, final double bestKnownCost) {
    Vehicle selectedVehicle = currentRoute.getVehicle();
    Driver selectedDriver = currentRoute.getDriver();
    InsertionData bestIData = InsertionData.createEmptyInsertionData();
    double bestKnownCost_ = bestKnownCost;
    Collection<Vehicle> relevantVehicles = new ArrayList<Vehicle>();
    if(!(selectedVehicle instanceof NoVehicle)) {
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    Shipment s = mock(Shipment.class);
    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(true);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    when(vehicle.getEndLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    when(vehicle.getLatestArrival()).thenReturn(200.0);
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

 
  public double getCosts(JobInsertionContext insertionContext){
    double delta_access = 0.0;
    double delta_egress = 0.0;
    VehicleRoute currentRoute = insertionContext.getRoute();
    Vehicle newVehicle = insertionContext.getNewVehicle();
    Driver newDriver = insertionContext.getNewDriver();
    double newVehicleDepartureTime = insertionContext.getNewDepTime();
    if(!currentRoute.isEmpty()){
      double accessTransportCostNew = routingCosts.getTransportCost(newVehicle.getStartLocationId(), currentRoute.getActivities().get(0).getLocationId(), newVehicleDepartureTime, newDriver, newVehicle);
      double accessTransportCostOld = routingCosts.getTransportCost(currentRoute.getStart().getLocationId(), currentRoute.getActivities().get(0).getLocationId(), currentRoute.getDepartureTime(), currentRoute.getDriver(), currentRoute.getVehicle());
     
      delta_access = accessTransportCostNew - accessTransportCostOld;
     
      if(newVehicle.isReturnToDepot()){
        TourActivity lastActivityBeforeEndOfRoute = currentRoute.getActivities().get(currentRoute.getActivities().size()-1);
        double lastActivityEndTimeWithOldVehicleAndDepartureTime = lastActivityBeforeEndOfRoute.getEndTime();
        double lastActivityEndTimeEstimationWithNewVehicleAndNewDepartureTime = Math.max(0.0, lastActivityEndTimeWithOldVehicleAndDepartureTime + (newVehicleDepartureTime - currentRoute.getDepartureTime()));
        double egressTransportCostNew = routingCosts.getTransportCost(lastActivityBeforeEndOfRoute.getLocationId(), newVehicle.getEndLocationId() , lastActivityEndTimeEstimationWithNewVehicleAndNewDepartureTime, newDriver, newVehicle);
        double egressTransportCostOld = routingCosts.getTransportCost(lastActivityBeforeEndOfRoute.getLocationId(), currentRoute.getEnd().getLocationId(), lastActivityEndTimeWithOldVehicleAndDepartureTime, currentRoute.getDriver(), currentRoute.getVehicle());
       
        delta_egress = egressTransportCostNew - egressTransportCostOld;
      }
    }
View Full Code Here

Examples of jsprit.core.problem.vehicle.Vehicle

    }
  }
 
  @Test
  public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectStartLocation(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    assertTrue(vRoute.getStart().getLocationId().equals("start"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.