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