Class VRPODInstance

java.lang.Object
es.urjc.etsii.grafo.io.Instance
es.urjc.etsii.grafo.vrpod.model.instance.VRPODInstance
All Implemented Interfaces:
Comparable<Instance>
Direct Known Subclasses:
VRPODInstanceProfitODDependant

public abstract class VRPODInstance extends Instance
  • Field Details

    • FILE_PATTERN

      protected static final Pattern FILE_PATTERN
    • INSTANCE_COMPARATOR

      protected static final Comparator<VRPODInstance> INSTANCE_COMPARATOR
    • numOcassionalDrivers

      protected final int numOcassionalDrivers
    • rho

      protected final double rho
      Rho value, extracted from the filename. 0.2, 0.05, 1.2, etc.
    • zeta

      protected final double zeta
      Zeta value, extracted from the filename. 1.1, 1.2, etc
    • generator

      protected final String generator
      Generator name, extracted from the filename. C101, C102... RC201
    • name

      protected final String name
      Instance name
    • numberOfDestinations

      protected int numberOfDestinations
      Number of destinations where we have to make a delivery +1, the origin counts as a destination
    • capacity

      protected int capacity
      Capacity of each vehicle used, each destination has an associated cost, the vehicle route must: capacity < sum(each destination cost)
    • _dist

      protected double[][] _dist
      Distances between all destinations, _dist[0][2] returns the distance between the vertex 0 (the warehouse) and vertex 2 (a customer).
    • locations

      protected Location[] locations
    • packetSizes

      protected int[] packetSizes
      Weigth of the packet to deliver
    • odsCoordinates

      protected Point2D[] odsCoordinates
      Occasional driver destination coordinates
    • ods2Clients

      protected Set<Integer>[] ods2Clients
      Each occasional driver can potentially deliver a packet to a set of customers, as long as the total distance does not exceed a preconfigured margin
    • clients2Ods

      protected Set<Integer>[] clients2Ods
  • Constructor Details

    • VRPODInstance

      public VRPODInstance(String name, int numOccasionalDrivers, int capacity, int numberOfDestinations)
  • Method Details

    • getLocations

      protected Location[] getLocations()
    • computeDistances

      protected void computeDistances()
      Computation of Euclidean distances among all vertices.
    • distanceBetween

      protected double distanceBetween(Point2D a, Point2D b)
      Calculate the Euclidean distance between two points
      Parameters:
      a - First point, array of coordinates
      b - Second point, array of coordinates
      Returns:
      The Euclidean distance between the two points
      Throws:
      AssertionError - If any point is null or the points have different number of dimensions
    • initializeClients

      protected void initializeClients(Point2D[] clientsCoordinates)
    • inverseOds2Customer

      protected void inverseOds2Customer()
    • getNumberOfDestinations

      public int getNumberOfDestinations()
      Returns the total number of nodes (including the depot)
      Returns:
    • getNumberOfClients

      public int getNumberOfClients()
      Returns the number of locations
      Returns:
      Number of locations
    • getNumOccasionalDrivers

      public int getNumOccasionalDrivers()
      Returns the number of occasional drivers that are available in this instance.
      Returns:
    • getClientsOfOccasionalDriver

      public Set<Integer> getClientsOfOccasionalDriver(int driver)
      Returns the set of locations that an ocassional driver can attend
      Parameters:
      driver -
    • getOdsOfClient

      public Set<Integer> getOdsOfClient(int client)
      Returns the set of ocasional drivers that can attend a given customer
      Parameters:
      client -
    • getPacketSize

      public int getPacketSize(int client)
      Returns the packetSizes of the given customer id.
      Parameters:
      client -
      Returns:
    • getCapacity

      public int getCapacity()
      Returns the capacity of the regular vehicles.
      Returns:
    • getCost

      public abstract double getCost(int od, int customer)
      Get the profit an OD would get if he(she delivers the packet to the given customer
      Parameters:
      od - The ocassional driver id
      customer - The customer id
      Returns:
      The profit
    • getDistance

      public double getDistance(int a, int b)
      Returns the distance between the given elements (vertices)
      Parameters:
      a -
      b -
      Returns:
    • getName

      public String getName()
    • getRho

      public double getRho()
    • getZeta

      public double getZeta()
    • getGenerator

      public String getGenerator()
    • getRecommendedNumberOfShakes

      public int getRecommendedNumberOfShakes()
    • compareTo

      public int compareTo(Instance o)
      Sort instances in this order: by od, rho, zeta, generator type
      Specified by:
      compareTo in interface Comparable<Instance>
      Overrides:
      compareTo in class Instance
    • generatorType

      public int generatorType()