// getDelay function
  // It takes in an optimized path and packet type as input.
  // Based on input, the function calculates delay occured when traveling
  // through the optimized path
  public double getDelay(int[] opath, PacketType type) {
    double delay = 0;

    for (int i = 1; i < 4; i++) {
      Router temp = statMux.getRouter(opath[i] - 4);
      int flow = temp.getFlowLevel();
      int delayR = temp.getDelay();
      int priority = temp.getPriority(type);
      int thr = temp.getThroughput();
      packThrough[i - 1] = thr;

      if (priority == 1) {
        loss[i - 1] = thr / 10.0;
      }
      if (priority == 2) {
        loss[i - 1] = thr / 5.0;
      }

      delay += numPack / thr + delayR + priority * flow;
    }

    return delay;
  }