Actual source code: ProblemInitialize.m

      1: % Sample calling syntax for testing taopounders and comparing to fminsearch
      2: % ProblemInitialize is called prior to solving the instance
      3: %   The taopounders driver sets np, the problem instance number
      4: %   This code then initializes the rest of the information needed

      6: nprob = dfo(np,1);    % Internal index for the problem
      7: n = dfo(np,2);        % Number of variables
      8: m = dfo(np,3);        % Number of residuals

     10: % Initialize the starting point
     11: factor = 10;
     12: factor_power = dfo(np,4);
     13: X0 = dfoxs(n,nprob,factor^factor_power)';

     15: % Initialize the function handle for evaluating the residuals
     16: func = @(x)dfovec_wrap(m,n,x,nprob,1);
     17: jac = @(x)jacobian(m,n,x,nprob);

     19: % Initialize the algorithmic parameters for taopounders
     20: nfmax = nf_const*(n+1);   % Maximum number of function evaluations
     21: npmax = 2*n+1;            % Maximum number of interpolation points
     22: delta = 0.1;              % Initial trust region radius

     24: % Reset the global history of the evaluations
     25: nfev = 0;
     26: fvals = zeros(nfmax,1);
     27: fvecs = zeros(nfmax,m);
     28: X_hist = zeros(nfmax,n);

     30: % Control returns to taopounders interface to solve the problem