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

modified activities to deal with multiple cap-dims

This commit is contained in:
oblonski 2014-02-18 09:49:24 +01:00
parent c1919649c7
commit 1b3af07e45
18 changed files with 211 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Delivery;
public final class DeliverService implements DeliveryActivity{
@ -85,4 +86,9 @@ public final class DeliverService implements DeliveryActivity{
public String toString() {
return "[act="+getName()+"][capDemand="+getCapacityDemand()+"][loc="+getLocationId()+"]";
}
@Override
public Capacity getCapacity() {
return null;
}
}

View file

@ -1,5 +1,6 @@
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Job;
import jsprit.core.problem.job.Shipment;
@ -84,4 +85,9 @@ public final class DeliverShipment implements DeliveryActivity{
public String toString() {
return "[act="+getName()+"][loc="+getLocationId()+"]";
}
@Override
public Capacity getCapacity() {
return null;
}
}

View file

@ -16,6 +16,7 @@
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.util.Coordinate;
public final class End implements TourActivity {
@ -147,4 +148,10 @@ public final class End implements TourActivity {
return new End(this);
}
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,5 +1,6 @@
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Pickup;
import jsprit.core.problem.job.Service;
@ -91,4 +92,10 @@ public final class PickupService implements PickupActivity{
return "[act="+getName()+"][capDemand="+getCapacityDemand()+"][loc="+getLocationId()+"]";
}
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,12 +1,15 @@
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Job;
import jsprit.core.problem.job.Shipment;
public final class PickupShipment implements PickupActivity{
private Shipment shipment;
private double endTime;
private double arrTime;
public PickupShipment(Shipment shipment) {
@ -85,4 +88,11 @@ public final class PickupShipment implements PickupActivity{
return "[act="+getName()+"][loc="+getLocationId()+"]";
}
@Override
public Capacity getCapacity() {
return shipment.getCapacity();
}
}

View file

@ -16,6 +16,7 @@
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Service;
import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity;
@ -166,6 +167,12 @@ public class ServiceActivity implements JobActivity{
public TourActivity duplicate() {
return new ServiceActivity(this);
}
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
}

View file

@ -16,6 +16,7 @@
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.util.Coordinate;
public final class Start implements TourActivity {
@ -153,6 +154,12 @@ public final class Start implements TourActivity {
return new Start(this);
}
@Override
public Capacity getCapacity() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -16,37 +16,130 @@
******************************************************************************/
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
import jsprit.core.problem.job.Job;
/**
* Basic interface for tour-activities.
*
* <p>A tour activity is the basic element of a tour, which is consequently a sequence of tour-activities.
*
* @author schroeder
*
*/
public interface TourActivity {
/**
* Basic interface of job-activies.
*
* <p>A job activity is related to a {@link Job}.
*
* @author schroeder
*
*/
public interface JobActivity extends TourActivity {
/**
* Returns the job that is involved with this activity.
*
* @return job
*/
public Job getJob();
}
/**
* Returns the capacity-demand of that activity, in terms of what needs to be loaded or unloaded at
* this activity.
*
* @return int
* @deprecated use <code>getCapacity()</code> instead
*/
@Deprecated
public int getCapacityDemand();
/**
* Returns the name of this activity.
*
* @return name
*/
public abstract String getName();
/**
* Returns the activity's locationId.
*
* @return locationId
*/
public abstract String getLocationId();
/**
* Returns the theoretical earliest operation start time, which is the time that is just allowed
* (not earlier) to start this activity, that is for example <code>service.getTimeWindow().getStart()</code>.
*
* @return earliest start time
*/
public abstract double getTheoreticalEarliestOperationStartTime();
/**
* Returns the theoretical latest operation start time, which is the time that is just allowed
* (not later) to start this activity, that is for example <code>service.getTimeWindow().getEnd()</code>.
*
*
* @return latest start time
*/
public abstract double getTheoreticalLatestOperationStartTime();
/**
* Returns the operation-time this activity takes.
*
* <p>Note that this is not necessarily the duration of this activity, but the
* service time a pickup/delivery actually takes, that is for example <code>service.getServiceTime()</code>.
*
* @return operation time
*/
public abstract double getOperationTime();
/**
* Returns the arrival-time of this activity.
*
* @return arrival time
*/
public abstract double getArrTime();
/**
* Returns end-time of this activity.
*
* @return end time
*/
public abstract double getEndTime();
/**
* Sets the arrival time of that activity.
*
* @param arrTime
*/
public abstract void setArrTime(double arrTime);
/**
* Sets the end-time of this activity.
*
* @param endTime
*/
public abstract void setEndTime(double endTime);
public TourActivity duplicate();
/**
* Returns the capacity-demand of that activity, in terms of what needs to be loaded or unloaded at
* this activity.
*
* @return capacity
*/
public abstract Capacity getCapacity();
/**
* Makes a deep copy of this activity.
*
* @return copied activity
*/
public abstract TourActivity duplicate();
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class DefaultShipmentActivityFactoryTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class DefaultTourActivityTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class DeliverServiceTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class DeliverShipmentTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class EndTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class PickupServiceTest {
}

View file

@ -0,0 +1,25 @@
package jsprit.core.problem.solution.route.activity;
import static org.junit.Assert.*;
import jsprit.core.problem.job.Shipment;
import org.junit.Test;
public class PickupShipmentTest {
@Test
public void whenGettingCapacity_itShouldReturnItCorrectly(){
Shipment shipment = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").setDeliveryLocation("delLoc")
.addCapacityDimension(0, 10).addCapacityDimension(1, 100).build();
PickupShipment pick = new PickupShipment(shipment);
assertEquals(10,pick.getCapacity().get(0));
assertEquals(100,pick.getCapacity().get(1));
}
@Test
public void whenCopyingAct_itShouldCopyItCorrectly(){
}
}

View file

@ -24,7 +24,7 @@ import jsprit.core.problem.solution.route.activity.ServiceActivity;
import org.junit.Test;
public class ServiceActTest {
public class ServiceActivityTest {
@Test
public void whenTwoDeliveriesHaveTheSameUnderlyingJob_theyAreEqual(){

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class StartTest {
}

View file

@ -0,0 +1,5 @@
package jsprit.core.problem.solution.route.activity;
public class TimeWindowTest {
}