xref: /petsc/src/tao/leastsquares/tutorials/matlab/TestingPlot.m (revision ecceeb7d86a3b9d2c0da2aced471d46acf67b452)
1c4762a1bSJed Brown% Sample calling syntax for testing taopounders and comparing to fminsearch
2c4762a1bSJed Brown% TestingPlot is called after taopounders completes.  It reads the results
3c4762a1bSJed Brown% from results.mat and produces a performance profile comparing
4c4762a1bSJed Brown% taopounders to fminsearch.
5c4762a1bSJed Brown
6*21afe8ebSBarry Smith% Make the test problem accessible to the MATLAB session and load the data matrix
7c4762a1bSJed Brownaddpath('more_wild_probs/')
8c4762a1bSJed Brownload dfo.dat
9c4762a1bSJed Brown
10c4762a1bSJed Brown% Initialize the problems that are being solved and retrieve the results
11c4762a1bSJed Brownto_solve = 1:53;
12c4762a1bSJed Brownload results Results;
13c4762a1bSJed Brown
14c4762a1bSJed Brown% Initialize the constant factor for the number of allowable function evaluations
15c4762a1bSJed Brownnf_const = 10;
16c4762a1bSJed Brown
17c4762a1bSJed Brown% Produce the performance profile and save the plot for the two solvers
18c4762a1bSJed BrownSolverNumber = 2;
19c4762a1bSJed BrownH = inf(nf_const*(max(dfo(to_solve,2))+1),length(to_solve),SolverNumber);
20c4762a1bSJed Brownfor np = to_solve
21c4762a1bSJed Brown    for s = 1:SolverNumber
22c4762a1bSJed Brown        H(1:length(Results{s,np}.H),np,s) = Results{s,np}.H;
23c4762a1bSJed Brown    end
24c4762a1bSJed Brownend
25c4762a1bSJed Brownh = perf_profile(H,1e-3,0);
26c4762a1bSJed Brownlegend(h,{Results{1,1}.alg, Results{2,1}.alg});
27c4762a1bSJed Brownsaveas(gca,'perf.png');
28c4762a1bSJed Brown
29