Program: 72739
Project: 72739
Buggy source:
@Override public void fire() throws IllegalActionException {
  Calcfc calcfc=new Calcfc(){
    @Override public double Compute(    int n,    int m,    double[] x,    double[] con,    boolean[] terminate) throws IllegalActionException {
      double evalX=0;
      DoubleToken[] xTokens=new DoubleToken[x.length];
      for (int i=0; i < xTokens.length; i++) {
        xTokens[i]=new DoubleToken(x[i]);
      }
      ArrayToken xAsToken=new ArrayToken(xTokens);
      CompositeOptimizer.this.x.sendInside(0,xAsToken);
      CompositeActor container=(CompositeActor)getContainer();
      if (_firstIteration) {
        _firstIteration=false;
      }
 else {
        Iterator<IOPort> inports=container.inputPortList().iterator();
        while (inports.hasNext()) {
          IOPort p=inports.next();
          if (!(p instanceof ParameterPort)) {
            _retransferInputs(p);
          }
        }
      }
      OptimizerDirector.super.fire();
      if (_stopRequested) {
        terminate[0]=_stopRequested;
        con[0]=-1;
        return evalX;
      }
 else {
        Iterator<IOPort> outports=container.outputPortList().iterator();
        while (outports.hasNext()) {
          IOPort p=outports.next();
          if (p.getName().equals(INTERMEDIATE_VALUE_PORT_NAME)) {
            if (p.hasTokenInside(0)) {
              Token t=p.getInside(0);
              evalX=((DoubleToken)t).doubleValue();
            }
 else {
              throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + INTERMEDIATE_VALUE_PORT_NAME + "String_Node_Str");
            }
          }
 else           if (p.getName().equals(CONSTRAINTS_PORT_NAME)) {
            if (p.hasTokenInside(0)) {
              Token t=p.getInside(0);
              Token[] constraintArray=((ArrayToken)t).arrayValue();
              for (int i=0; i < constraintArray.length; i++) {
                con[i]=((DoubleToken)constraintArray[i]).doubleValue();
              }
            }
 else {
              throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + CONSTRAINTS_PORT_NAME + "String_Node_Str");
            }
          }
        }
        if (_mode == MAXIMIZE) {
          evalX=-1.0 * evalX;
        }
 else {
        }
        terminate[0]=_stopRequested;
      }
      return evalX;
    }
  }
;
  _optInput=new double[_dimension];
  int nVariables=_dimension;
  _firstIteration=true;
  boolean[] terminateArray=new boolean[1];
  terminateArray[0]=_stopRequested;
  CobylaExitStatus status=Cobyla.FindMinimum(calcfc,nVariables,_numConstraints,_optInput,_rhobeg,_rhoend,iprint,_maxEvaluations,terminateArray);
  _firstIteration=true;
  DoubleToken[] outTokens=new DoubleToken[_dimension];
  for (int i=0; i < outTokens.length; i++) {
    outTokens[i]=new DoubleToken(_optInput[i]);
  }
  ArrayToken outputArrayToken=new ArrayToken(outTokens);
  optimalValue.send(0,outputArrayToken);
switch (status) {
case Normal:
    break;
case MaxIterationsReached:
  throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
case DivergingRoundingErrors:
throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
case TerminateRequested:
throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
}
}

Fixed version (ground truth):
@Override public void fire() throws IllegalActionException {
  Calcfc calcfc=new Calcfc(){
    @Override public double Compute(    int n,    int m,    double[] x,    double[] con,    boolean[] terminate) throws IllegalActionException {
      double evalX=0;
      DoubleToken[] xTokens=new DoubleToken[x.length];
      for (int i=0; i < xTokens.length; i++) {
        xTokens[i]=new DoubleToken(x[i]);
      }
      ArrayToken xAsToken=new ArrayToken(xTokens);
      (CompositeOptimizer.this).x.sendInside(0,xAsToken);
      CompositeActor container=(CompositeActor)getContainer();
      if (_firstIteration) {
        _firstIteration=false;
      }
 else {
        Iterator<IOPort> inports=container.inputPortList().iterator();
        while (inports.hasNext()) {
          IOPort p=inports.next();
          if (!(p instanceof ParameterPort)) {
            _retransferInputs(p);
          }
        }
      }
      OptimizerDirector.super.fire();
      if (_stopRequested) {
        terminate[0]=_stopRequested;
        con[0]=-1;
        return evalX;
      }
 else {
        Iterator<IOPort> outports=container.outputPortList().iterator();
        while (outports.hasNext()) {
          IOPort p=outports.next();
          if (p.getName().equals(INTERMEDIATE_VALUE_PORT_NAME)) {
            if (p.hasTokenInside(0)) {
              Token t=p.getInside(0);
              evalX=((DoubleToken)t).doubleValue();
            }
 else {
              throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + INTERMEDIATE_VALUE_PORT_NAME + "String_Node_Str");
            }
          }
 else           if (p.getName().equals(CONSTRAINTS_PORT_NAME)) {
            if (p.hasTokenInside(0)) {
              Token t=p.getInside(0);
              Token[] constraintArray=((ArrayToken)t).arrayValue();
              for (int i=0; i < constraintArray.length; i++) {
                con[i]=((DoubleToken)constraintArray[i]).doubleValue();
              }
            }
 else {
              throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + CONSTRAINTS_PORT_NAME + "String_Node_Str");
            }
          }
        }
        if (_mode == MAXIMIZE) {
          evalX=-1.0 * evalX;
        }
 else {
        }
        terminate[0]=_stopRequested;
      }
      return evalX;
    }
  }
;
  _optInput=new double[_dimension];
  int nVariables=_dimension;
  _firstIteration=true;
  boolean[] terminateArray=new boolean[1];
  terminateArray[0]=_stopRequested;
  CobylaExitStatus status=Cobyla.FindMinimum(calcfc,nVariables,_numConstraints,_optInput,_rhobeg,_rhoend,iprint,_maxEvaluations,terminateArray);
  _firstIteration=true;
  DoubleToken[] outTokens=new DoubleToken[_dimension];
  for (int i=0; i < outTokens.length; i++) {
    outTokens[i]=new DoubleToken(_optInput[i]);
  }
  ArrayToken outputArrayToken=new ArrayToken(outTokens);
  optimalValue.send(0,outputArrayToken);
switch (status) {
case Normal:
    break;
case MaxIterationsReached:
  throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
case DivergingRoundingErrors:
throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
case TerminateRequested:
throw new IllegalActionException(CompositeOptimizer.this,"String_Node_Str" + "String_Node_Str");
}
}