1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

add profile

This commit is contained in:
oblonski 2015-03-24 09:27:36 +01:00
parent 1cd1733a7a
commit 5b4d47a546
3 changed files with 70 additions and 27 deletions

View file

@ -55,4 +55,6 @@ public interface VehicleType {
*/
public VehicleCostParams getVehicleCostParams();
public String getProfile();
}

View file

@ -80,6 +80,8 @@ public class VehicleTypeImpl implements VehicleType {
private double fixedCost = 0.0;
private double perDistance = 1.0;
private double perTime = 0.0;
private String profile = "car";
private Capacity.Builder capacityBuilder = Capacity.Builder.newInstance();
@ -197,6 +199,11 @@ public class VehicleTypeImpl implements VehicleType {
this.capacityDimensions = capacity;
return this;
}
public Builder setProfile(String profile){
this.profile = profile;
return this;
}
}
@Override
@ -231,6 +238,8 @@ public class VehicleTypeImpl implements VehicleType {
private final String typeId;
private final int capacity;
private final String profile;
private final VehicleTypeImpl.VehicleCostParams vehicleCostParams;
@ -249,6 +258,7 @@ public class VehicleTypeImpl implements VehicleType {
maxVelocity = builder.maxVelo;
vehicleCostParams = new VehicleCostParams(builder.fixedCost, builder.perTime, builder.perDistance);
capacityDimensions = builder.capacityDimensions;
profile = builder.profile;
}
/* (non-Javadoc)
@ -283,4 +293,8 @@ public class VehicleTypeImpl implements VehicleType {
public Capacity getCapacityDimensions() {
return capacityDimensions;
}
@Override
public String getProfile(){ return profile; }
}

View file

@ -2,24 +2,9 @@
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetSize>INFINITE</fleetSize>
</problemType>
<vehicles>
<vehicle>
<id>v2</id>
<typeId>vehType2</typeId>
<startLocation>
<id>loc</id>
</startLocation>
<endLocation>
<id>loc</id>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>1.7976931348623157E308</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle>
<id>v1</id>
<typeId>vehType</typeId>
@ -48,16 +33,58 @@
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType2</id>
<capacity-dimensions>
<dimension index="0">200</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="1" type="service">
<location>
<id>loc</id>
</location>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
<duration>2.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.7976931348623157E308</end>
</timeWindow>
</timeWindows>
</service>
<service id="2" type="service">
<location>
<id>loc2</id>
</location>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
<duration>4.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>1.7976931348623157E308</end>
</timeWindow>
</timeWindows>
</service>
</services>
<solutions>
<solution>
<cost>10.0</cost>
<routes>
<route>
<driverId>noDriver</driverId>
<vehicleId>v1</vehicleId>
<start>0.0</start>
<act type="service">
<serviceId>1</serviceId>
<arrTime>0.0</arrTime>
<endTime>0.0</endTime>
</act>
<end>0.0</end>
</route>
</routes>
<unassignedJobs>
<job id="2"/>
</unassignedJobs>
</solution>
</solutions>
</problem>