Program: 72702
Project: 72702
Buggy source:
/** 
 * Return g(x). This function is called by the solver to evaluate the loop function.
 * @param x Input to the loop function.
 * @return Result of the loop function.
 * @exception IllegalActionException If the prefire() methodreturns false having previously returned true in the same iteration, or if the prefire() or fire() method of the actor throws it, or if evaluating the function yields a value that is not a double.
 */
protected double[] _evaluateLoopFunction(double[] x) throws IllegalActionException {
  int iRec=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        DoubleToken t=new DoubleToken(x[iRec]);
        receiver.put(t);
        if (_debugging) {
          _debug("String_Node_Str" + receiver.getContainer().getName() + "String_Node_Str"+ x[iRec]);
        }
        iRec++;
      }
    }
  }
  Schedule schedule=getScheduler().getSchedule();
  Iterator firingIterator=schedule.firingIterator();
  while (firingIterator.hasNext() && !_stopRequested) {
    Actor actor=((Firing)firingIterator.next()).getActor();
    if (!_actorsFinishedExecution.contains(actor)) {
      _fireActor(actor);
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str" + actor.getFullName());
      }
      _clearAllDestinationReceivers(actor);
    }
  }
  double[] g=new double[_nVars];
  int i=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        Token t=receiver.get();
        if (t instanceof DoubleToken) {
          g[i]=((DoubleToken)(t)).doubleValue();
          if (_debugging) {
            _debug("String_Node_Str" + receiver.getContainer().getName(getContainer()) + "String_Node_Str"+ g[i]);
          }
          i++;
        }
 else {
          throw new IllegalActionException("String_Node_Str" + t + "String_Node_Str"+ port.getName(getContainer()));
        }
      }
    }
  }
  return g;
}

Fixed version (ground truth):
/** 
 * Return g(x). This function is called by the solver to evaluate the loop function.
 * @param x Input to the loop function.
 * @return Result of the loop function.
 * @exception IllegalActionException If the prefire() methodreturns false having previously returned true in the same iteration, or if the prefire() or fire() method of the actor throws it, or if evaluating the function yields a value that is not a double.
 */
protected double[] _evaluateLoopFunction(double[] x) throws IllegalActionException {
  int iRec=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        DoubleToken t=new DoubleToken(x[iRec]);
        receiver.put(t);
        if (_debugging) {
          _debug("String_Node_Str" + receiver.getContainer().getName() + "String_Node_Str"+ x[iRec]);
        }
        iRec++;
      }
    }
  }
  Schedule schedule=getScheduler().getSchedule();
  Iterator firingIterator=schedule.firingIterator();
  while (firingIterator.hasNext() && !_stopRequested) {
    Actor actor=((Firing)firingIterator.next()).getActor();
    if (!_actorsFinishedExecution.contains(actor)) {
      _fireActor(actor);
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str" + actor.getFullName());
      }
      _clearAllDestinationReceivers(actor);
    }
  }
  double[] g=new double[_nVars];
  int i=0;
  for (  IOPort port : _breakVariables) {
    Receiver[][] receivers=port.getReceivers();
    for (    Receiver[] receivers2 : receivers) {
      for (      Receiver receiver : receivers2) {
        Token t=receiver.get();
        if (t instanceof DoubleToken) {
          g[i]=((DoubleToken)(t)).doubleValue();
          if (_debugging) {
            _debug("String_Node_Str" + port.getName(getContainer()) + "String_Node_Str"+ g[i]);
          }
          i++;
        }
 else {
          throw new IllegalActionException("String_Node_Str" + t + "String_Node_Str"+ port.getName(getContainer()));
        }
      }
    }
  }
  return g;
}