Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2011-2014 Rinde van Lon, iMinds DistriNet, KU Leuven
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *         http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.github.rinde.rinsim.scenario.gendreau06;
 
 import java.util.List;
 import java.util.Set;
 
 
 
The length of the scenario is a soft constraint. There is a pre defined length of the day (either 4 hours or 7.5 hours), vehicles are allowed to continue driving after the end of the day.

Once a vehicle is moving towards a Parcel it is obliged to service it. This means that diversion is not allowed.

Distance is expressed in km, time is expressed in ms (the original format is in seconds, however it allows fractions as such it was translated to ms), speed is expressed as km/h.

Author(s):
Rinde van Lon
 
 public final class Gendreau06Scenario extends Scenario {
   static final Point MIN = new Point(0, 0);
   static final Point MAX = new Point(5, 5);
   static final Measure<DoubleVelocityMAX_SPEED = Measure.valueOf(
       30d, .);
 
   private final long tickSize;
   private final GendreauProblemClass problemClass;
   private final int instanceNumber;
   private final boolean allowDiversion;
 
   Gendreau06Scenario(List<? extends TimedEventpEvents,
       Set<Enum<?>> pSupportedTypeslong tsGendreauProblemClass problemClass,
       int instanceNumberboolean diversion) {
     super(pEventspSupportedTypes);
      = ts;
     this. = problemClass;
     this. = instanceNumber;
      = diversion;
   }
 
   @Override
   public String toString() {
     return ToStringBuilder.reflectionToString(this,
         .);
   }
 
   @Override
   public TimeWindow getTimeWindow() {
     return .;
   }
 
   @Override
   public long getTickSize() {
     return ;
   }
  }
  public ImmutableList<? extends Supplier<? extends Model<?>>> getModelSuppliers() {
    return ImmutableList.<Supplier<? extends Model<?>>> builder()
        .build();
  }
  static PDPModel createPDPModel() {
  }
  public Unit<DurationgetTimeUnit() {
    return SI.MILLI(.);
  }
  public Unit<VelocitygetSpeedUnit() {
    return .;
  }
  public Unit<LengthgetDistanceUnit() {
    return .;
  }
    return ;
  }
    return Integer.toString();
  }
  static class RoadModelSupplier implements Supplier<PDPRoadModel> {
    private final Unit<LengthdistanceUnit;
    private final boolean allowDiversion;
    RoadModelSupplier(Unit<Lengthduboolean ad) {
       = du;
       = ad;
    }
    @Override
    public PDPRoadModel get() {
      return new PDPRoadModel(new PlaneRoadModel(,
          ), );
    }
  }
New to GrepCode? Check out our FAQ X