com.github.rinde.rinsim.examples.pdptw.gradientfield.GradientFieldConfiguration Maven / Gradle / Ivy
/*
* Copyright (C) 2011-2015 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.examples.pdptw.gradientfield;
import com.github.rinde.rinsim.core.Simulator;
import com.github.rinde.rinsim.core.model.Model;
import com.github.rinde.rinsim.experiment.DefaultMASConfiguration;
import com.github.rinde.rinsim.pdptw.common.DynamicPDPTWProblem.Creator;
import com.github.rinde.rinsim.scenario.AddParcelEvent;
import com.github.rinde.rinsim.scenario.AddVehicleEvent;
import com.github.rinde.rinsim.util.StochasticSupplier;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
/**
*
* @author Rinde van Lon
*/
public class GradientFieldConfiguration extends DefaultMASConfiguration {
@Override
public ImmutableList extends StochasticSupplier extends Model>>> getModels() {
return ImmutableList.of(GradientModel.supplier());
}
@Override
public Creator getVehicleCreator() {
return new Creator() {
@Override
public boolean create(Simulator sim, AddVehicleEvent event) {
return sim.register(new Truck(event.vehicleDTO));
}
};
}
@Override
public Optional extends Creator> getParcelCreator() {
return Optional.of(new Creator() {
@Override
public boolean create(Simulator sim, AddParcelEvent event) {
// all parcels are accepted by default
return sim.register(new GFParcel(event.parcelDTO));
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy