mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
breakId fix & custom
This commit is contained in:
parent
7590be9794
commit
e2c9c59568
3 changed files with 6 additions and 4 deletions
|
|
@ -701,7 +701,8 @@ public class VrpXMLReader {
|
|||
List<HierarchicalConfiguration> breakTWConfigs = vehicleConfig.configurationsAt("breaks.timeWindows.timeWindow");
|
||||
if (!breakTWConfigs.isEmpty()) {
|
||||
String breakDurationString = vehicleConfig.getString("breaks.duration");
|
||||
Break.Builder current_break = Break.Builder.newInstance(vehicleId);
|
||||
String id = vehicleConfig.getString("breaks.id");
|
||||
Break.Builder current_break = Break.Builder.newInstance(id);
|
||||
current_break.setServiceTime(Double.parseDouble(breakDurationString));
|
||||
for (HierarchicalConfiguration twConfig : breakTWConfigs) {
|
||||
current_break.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
|
||||
|
|
|
|||
|
|
@ -203,12 +203,12 @@ public class VrpXMLWriter {
|
|||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ")[@type]", act.getName());
|
||||
if (act instanceof TourActivity.JobActivity) {
|
||||
Job job = ((TourActivity.JobActivity) act).getJob();
|
||||
if (job instanceof Service) {
|
||||
if (job instanceof Break) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").breakId", job.getId());
|
||||
} else if (job instanceof Service) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").serviceId", job.getId());
|
||||
} else if (job instanceof Shipment) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").shipmentId", job.getId());
|
||||
} else if (job instanceof Break) {
|
||||
xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").breakId", job.getId());
|
||||
} else {
|
||||
throw new IllegalStateException("cannot write solution correctly since job-type is not know. make sure you use either service or shipment, or another writer");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,6 +395,7 @@
|
|||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="duration" type="xs:double" minOccurs="1" maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue