示例#1
0
  private void buildMapping(HeuristicsNet hn) {

    HNSet outputSubsets;
    HNSubSet outputSubset;
    int taskInSubset;

    mapping = new HNSet[hn.size()][hn.size()];

    for (int task = 0; task < hn.size(); task++) {
      outputSubsets = hn.getOutputSet(task);
      for (int iOutputSubsets = 0; iOutputSubsets < outputSubsets.size(); iOutputSubsets++) {
        // inserting for every element
        outputSubset = outputSubsets.get(iOutputSubsets);
        for (int iSubset = 0; iSubset < outputSubset.size(); iSubset++) {
          taskInSubset = outputSubset.get(iSubset);
          insertInMapping(taskInSubset, task, outputSubset);
        }
      }
    }
  }
示例#2
0
  /**
   * Build an initial marking for a given heuristics net.
   *
   * @param net an enhanced heuristics net to which the initial marking must be built.
   * @throws java.lang.NullPointerException whenever the net has disconnected elements. An element
   *     is disconnected when its INPUT or OUTPUT set is null.
   */
  public MarkingHeuristicsNet(HeuristicsNet net, Random generator) throws NullPointerException {

    this.generator = generator;
    size = net.size();
    hNet = net;
    // checking if all input and output sets are DIFFERENT from null...
    for (int i = 0; i < size; i++) {
      if (hNet.getInputSet(i) == null || hNet.getOutputSet(i) == null) {
        throw new NullPointerException("Net has disconnected elements!!");
      }
    }
    createMarking();
  }