Exemplo n.º 1
0
  public List<PSToken> getConflictSet(int t) {
    List<PSToken> conflictSet = new Vector<PSToken>();

    PSTokenList toks = res_.getTokens();
    for (int i = 0; i < toks.size(); i++) {
      PSToken tok = toks.get(i);
      if (RCPSPUtil.overlaps(tok, t)) conflictSet.add(tok);
    }

    List<PSToken> retval = new Vector<PSToken>();
    for (PSToken pred : conflictSet) {
      for (PSToken succ : conflictSet) {
        // Don't try to order tokens that can't be ordered
        int predEndLb = RCPSPUtil.getLb(pred.getEnd());
        int succStartUb = RCPSPUtil.getUb(pred.getStart());

        if ((pred != succ) && (predEndLb <= succStartUb)) {
          retval.add(pred);
          retval.add(succ);
        }
      }
    }

    return retval;
  }
Exemplo n.º 2
0
  public int getMostViolatedTime() {
    int t = -1;
    double lowestLevel = Double.MAX_VALUE;

    PSResourceProfile prof = res_.getLevels();
    PSTimePointList times = prof.getTimes();
    for (int i = 0; i < times.size(); i++) {
      double level = prof.getLowerBound(times.get(i));
      if (level < lowestLevel) {
        lowestLevel = level;
        if (level < 0) t = times.get(i);
      }
    }

    if (t >= 0)
      RCPSPUtil.dbgout("MaxViolation for " + res_.getName() + " " + lowestLevel + " at time " + t);

    return t;
  }