예제 #1
0
  public void setNextPartialSolution(OptimizerNode solutionSetDelta, OptimizerNode nextWorkset) {
    // check whether the next partial solution is itself the join with
    // the partial solution (so we can potentially do direct updates)
    if (solutionSetDelta instanceof TwoInputNode) {
      TwoInputNode solutionDeltaTwoInput = (TwoInputNode) solutionSetDelta;
      if (solutionDeltaTwoInput.getFirstPredecessorNode() == this.solutionSetNode
          || solutionDeltaTwoInput.getSecondPredecessorNode() == this.solutionSetNode) {
        this.solutionDeltaImmediatelyAfterSolutionJoin = true;
      }
    }

    // attach an extra node to the solution set delta for the cases where we need to repartition
    UnaryOperatorNode solutionSetDeltaUpdateAux =
        new UnaryOperatorNode(
            "Solution-Set Delta",
            getSolutionSetKeyFields(),
            new SolutionSetDeltaOperator(getSolutionSetKeyFields()));
    solutionSetDeltaUpdateAux.setDegreeOfParallelism(getDegreeOfParallelism());
    solutionSetDeltaUpdateAux.setSubtasksPerInstance(getSubtasksPerInstance());

    PactConnection conn = new PactConnection(solutionSetDelta, solutionSetDeltaUpdateAux);
    solutionSetDeltaUpdateAux.setIncomingConnection(conn);
    solutionSetDelta.addOutgoingConnection(conn);

    this.solutionSetDelta = solutionSetDeltaUpdateAux;
    this.nextWorkset = nextWorkset;

    this.singleRoot = new SingleRootJoiner();
    this.solutionSetDeltaRootConnection =
        new PactConnection(solutionSetDeltaUpdateAux, this.singleRoot);
    this.nextWorksetRootConnection = new PactConnection(nextWorkset, this.singleRoot);
    this.singleRoot.setInputs(this.solutionSetDeltaRootConnection, this.nextWorksetRootConnection);

    solutionSetDeltaUpdateAux.addOutgoingConnection(this.solutionSetDeltaRootConnection);
    nextWorkset.addOutgoingConnection(this.nextWorksetRootConnection);
  }