mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
modify to use external RNG
This commit is contained in:
parent
d55c080fee
commit
358010de91
2 changed files with 8 additions and 4 deletions
|
|
@ -58,6 +58,7 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory {
|
|||
if (vehicles.isEmpty()) throw new IllegalStateException("vehicle-collection is empty. this must not be");
|
||||
VehicleFleetManagerImpl vehicleFleetManager = new VehicleFleetManagerImpl(vehicles);
|
||||
vehicleFleetManager.setRandom(random);
|
||||
vehicleFleetManager.init();
|
||||
return vehicleFleetManager;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,20 +81,23 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
|
||||
private Random random = RandomNumberGeneration.getRandom();
|
||||
|
||||
public VehicleFleetManagerImpl(Collection<Vehicle> vehicles) {
|
||||
VehicleFleetManagerImpl(Collection<Vehicle> vehicles) {
|
||||
super();
|
||||
this.vehicles = vehicles;
|
||||
int arrSize = vehicles.size() + 2;
|
||||
locked = new boolean[arrSize];
|
||||
vehicleArr = new Vehicle[arrSize];
|
||||
initializeVehicleTypes();
|
||||
logger.debug("initialise {}",this);
|
||||
}
|
||||
|
||||
public void setRandom(Random random) {
|
||||
void setRandom(Random random) {
|
||||
this.random = random;
|
||||
}
|
||||
|
||||
void init(){
|
||||
initializeVehicleTypes();
|
||||
logger.debug("initialise {}",this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[name=finiteVehicles]";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue