Program: 72688
Project: 72688
Buggy source:
/** 
 * Minimizes the objective function F with respect to a set of inequality constraints CON, and returns the optimal variable array. F and CON may be non-linear, and should preferably be smooth.
 * @param calcfc Interface implementation for calculating objective function and constraints.
 * @param n Number of variables.
 * @param m Number of constraints.
 * @param x On input initial values of the variables (zero-based array). On outputoptimal values of the variables obtained in the COBYLA minimization.
 * @param rhobeg Initial size of the simplex.
 * @param rhoend Final value of the simplex.
 * @param iprint Print level, 0 &lt;= iprint &lt;= 3, where 0 provides no output and3 provides full output to the console.
 * @param maxfun Maximum number of function evaluations before terminating.
 * @return Exit status of the COBYLA2 optimization.
 * @throws IllegalActionException 
 */
public static CobylaExitStatus FindMinimum(final Calcfc calcfc,int n,int m,double[] x,double rhobeg,double rhoend,int iprint,int maxfun,boolean[] terminate) throws IllegalActionException {
  int mpp=m + 2;
  double[] iox=new double[n + 1];
  System.arraycopy(x,0,iox,1,n);
  Calcfc fcalcfc=new Calcfc(){
    /** 
 * @param n the value of n
 * @param m the value of m
 * @param x the value of x
 * @param con the value of con
 * @return the double
 */
    @Override public double Compute(    int n,    int m,    double[] x,    double[] con,    boolean[] terminate) throws IllegalActionException {
      double[] ix=new double[n];
      System.arraycopy(x,1,ix,0,n);
      double[] ocon=new double[m];
      double f=calcfc.Compute(n,m,ix,ocon,terminate);
      System.arraycopy(ocon,0,con,1,m);
      return f;
    }
  }
;
  CobylaExitStatus status=cobylb(fcalcfc,n,m,mpp,iox,rhobeg,rhoend,iprint,maxfun,terminate);
  System.arraycopy(iox,1,x,0,n);
  return status;
}

Fixed version (ground truth):
/** 
 * Minimizes the objective function F with respect to a set of inequality constraints CON, and returns the optimal variable array. F and CON may be non-linear, and should preferably be smooth.
 * @param calcfc Interface implementation for calculating objective function and constraints.
 * @param n Number of variables.
 * @param m Number of constraints.
 * @param x On input initial values of the variables (zero-based array). On outputoptimal values of the variables obtained in the COBYLA minimization.
 * @param rhobeg Initial size of the simplex.
 * @param rhoend Final value of the simplex.
 * @param iprint Print level, 0 &lt;= iprint &lt;= 3, where 0 provides no output and3 provides full output to the console.
 * @param maxfun Maximum number of function evaluations before terminating.
 * @return Exit status of the COBYLA2 optimization.
 * @exception IllegalActionException 
 */
public static CobylaExitStatus FindMinimum(final Calcfc calcfc,int n,int m,double[] x,double rhobeg,double rhoend,int iprint,int maxfun,boolean[] terminate) throws IllegalActionException {
  int mpp=m + 2;
  double[] iox=new double[n + 1];
  System.arraycopy(x,0,iox,1,n);
  Calcfc fcalcfc=new Calcfc(){
    /** 
 * @param n the value of n
 * @param m the value of m
 * @param x the value of x
 * @param con the value of con
 * @return the double
 */
    @Override public double Compute(    int n,    int m,    double[] x,    double[] con,    boolean[] terminate) throws IllegalActionException {
      double[] ix=new double[n];
      System.arraycopy(x,1,ix,0,n);
      double[] ocon=new double[m];
      double f=calcfc.Compute(n,m,ix,ocon,terminate);
      System.arraycopy(ocon,0,con,1,m);
      return f;
    }
  }
;
  CobylaExitStatus status=cobylb(fcalcfc,n,m,mpp,iox,rhobeg,rhoend,iprint,maxfun,terminate);
  System.arraycopy(iox,1,x,0,n);
  return status;
}