All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rinde.sim.pdptw.generator.HomogenousVehicleGenerator Maven / Gradle / Ivy

The newest version!
/**
 * 
 */
package rinde.sim.pdptw.generator;

import static java.util.Collections.nCopies;

import org.apache.commons.math3.random.RandomGenerator;

import rinde.sim.pdptw.common.AddVehicleEvent;
import rinde.sim.pdptw.common.VehicleDTO;

import com.google.common.collect.ImmutableList;

/**
 * @author Rinde van Lon 
 * 
 */
public class HomogenousVehicleGenerator implements VehicleGenerator {

  private final VehicleDTO vehicleDto;
  private final int n;

  public HomogenousVehicleGenerator(int numberOfVehicles, VehicleDTO dto) {
    vehicleDto = dto;
    n = numberOfVehicles;
  }

  public ImmutableList generate(RandomGenerator rng) {
    return ImmutableList
        .copyOf(nCopies(n, new AddVehicleEvent(-1, vehicleDto)));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy