Esempio n. 1
0
  @Override
  protected FeasibilityState checkFeasibility(ITRSPTour tour) {
    TRSPInstance instance = tour.getInstance();

    AttributeWithIdSet tools = instance.getFleet().getVehicle(tour.getTechnicianId()).getToolSet();

    ITourIterator it = tour.iterator();
    boolean checkTools = true;

    while (it.hasNext() && checkTools) {
      int node = it.next();
      if (instance.isMainDepot(node)) {
        // Assume all tools are now available
        return new FeasibilityState();
      } else if (instance.isRequest(node)) {
        if (!instance.getRequest(node).getToolSet().isCompatibleWith(tools)) {
          // Tool i is required but missing
          return new FeasibilityState(
              node,
              "Missing tools for request %s (%s)",
              node,
              instance.getRequest(node).getToolSet());
        }
      }
    }

    return new FeasibilityState();
  }
Esempio n. 2
0
  @Override
  public boolean isFeasible(ITRSPTour tour) {
    TRSPInstance instance = tour.getInstance();
    AttributeWithIdSet tools = instance.getFleet().getVehicle(tour.getTechnicianId()).getToolSet();

    ITourIterator it = tour.iterator();

    boolean checkTools = true;

    while (it.hasNext() && checkTools) {
      int node = it.next();
      if (instance.isMainDepot(node)) {
        return true;
      } else if (instance.isRequest(node)) {
        if (!instance.getRequest(node).getToolSet().isCompatibleWith(tools)) {
          // Tool i is required but missing
          return false;
        }
      }
    }

    return true;
  }