mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2ef55fd440
1 changed files with 16 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
|
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleType;
|
import com.graphhopper.jsprit.core.problem.vehicle.VehicleType;
|
||||||
|
import com.graphhopper.jsprit.core.util.Solutions;
|
||||||
|
|
||||||
import org.apache.commons.configuration.ConfigurationException;
|
import org.apache.commons.configuration.ConfigurationException;
|
||||||
import org.apache.commons.configuration.XMLConfiguration;
|
import org.apache.commons.configuration.XMLConfiguration;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
@ -67,6 +69,14 @@ public class VrpXMLWriter {
|
||||||
|
|
||||||
private Collection<VehicleRoutingProblemSolution> solutions;
|
private Collection<VehicleRoutingProblemSolution> solutions;
|
||||||
|
|
||||||
|
private boolean onlyBestSolution = false;
|
||||||
|
|
||||||
|
public VrpXMLWriter(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions, boolean onlyBestSolution) {
|
||||||
|
this.vrp = vrp;
|
||||||
|
this.solutions = new ArrayList<VehicleRoutingProblemSolution>(solutions);
|
||||||
|
this.onlyBestSolution = onlyBestSolution;
|
||||||
|
}
|
||||||
|
|
||||||
public VrpXMLWriter(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions) {
|
public VrpXMLWriter(VehicleRoutingProblem vrp, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
this.vrp = vrp;
|
this.vrp = vrp;
|
||||||
this.solutions = solutions;
|
this.solutions = solutions;
|
||||||
|
|
@ -102,6 +112,12 @@ public class VrpXMLWriter {
|
||||||
writeShipments(xmlConfig, jobs);
|
writeShipments(xmlConfig, jobs);
|
||||||
|
|
||||||
writeInitialRoutes(xmlConfig);
|
writeInitialRoutes(xmlConfig);
|
||||||
|
if(onlyBestSolution && solutions != null) {
|
||||||
|
VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
|
||||||
|
solutions.clear();
|
||||||
|
solutions.add(solution);
|
||||||
|
}
|
||||||
|
|
||||||
writeSolutions(xmlConfig);
|
writeSolutions(xmlConfig);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue