Matty,
Glad that last post helped.
Here is what I had meant by using a penalty. It might be faster in some cases where the improved constraint setup remains slow. Also I did not try to adjust the method so that could perhaps give further speed gains.
I include my version of "errindex". I obtained it by multiple use of Chop. It might or might not improve the FindMinimum computation speed but at least it makes the code easier to read. I'd be surprised if this in any way lead to a worsened quality of result 9and if it did, that would indicate you're dealing with a numerically unstable computation).
errindex = (0.8988621286229235 - ((-1.*gam3^2 + 1.*lam1)^2)^(-1/
4))^2 + (0.04410530083035308 + (1.*
gam3)/((-1.*gam3^2 + 1.*lam1)^2)^(1/
4))^2 + (1.114681824560056 - (1.*
lam1)/((-1.*gam3^2 + 1.*lam1)^2)^(1/
4))^2 + (0.3334610964453241 -
1./((-1.*gam1^2 + 1.*lam3)^2)^(1/
4))^2 + (0.07055833545418581 + (1.*
gam1)/((-1.*gam1^2 + 1.*lam3)^2)^(1/
4))^2 + (3.013780286261509 - (1.*
lam3)/((-1.*gam1^2 + 1.*lam3)^2)^(1/
4))^2 + (0.4795936666881171 - (1.*
gam2)/((-1.*gam2^2 + 1.*lam1*lam3)^2)^(1/
4))^2 + (0.3499718837183906 - (1.*
lam1)/((-1.*gam2^2 + 1.*lam1*lam3)^2)^(1/
4))^2 + (3.5145968643500987 - (1.*
lam3)/((-1.*gam2^2 + 1.*lam1*lam3)^2)^(1/4))^2;
errindex2 =
100*(Max[(-1 - lam1 - lam3), 0] -
Min[(-gam1^2 - gam2^2 - gam3^2 + lam1 + lam3 + lam1 lam3), 0] +
Max[(gam2^2 - 2 gam1 gam2 gam3 + gam1^2 lam1 + gam3^2 lam3 -
lam1 lam3), 0]) + errindex;
Timing[
fm1 = FindMinimum[
errindex2, {lam1, .01}, {lam3, .11}, {gam1, 0.0}, {gam2,
0.0}, {gam3, 0.0}]]
During evaluation of In[55]:= FindMinimum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances. >>
Out[55]= {0.120000, {0.0308505996903, {lam1 -> 1.02544451853,
lam3 -> 9.4231233029, gam1 -> -0.182347320429,
gam2 -> 1.50192314333, gam3 -> -0.0452412621552}}}