I am using the optimisation toolbox in R2008b. I have noticed that when I run fgoalattain with no constraints, some constraints appear to be violated throughout iterations of the algorithm and the algorithm returns a solution with active nonlinear inequalities. My understanding is that this should not happen, since I have not provided any constraints, but perhaps there is a good reason for it.
Here is an example:
function x = testoptions = optimset('Display','iter',... 'GoalsExactAchieve',2);weight = [1,1];goal = [2,2];x0 = [1,2];x = fgoalattain(@FitF,x0,goal,weight,[],[],[],[],[],[],[],options);function ObjF = FitF(x)ObjF = [exp(2*x(2))-exp(x(1)); exp(x(1))-2*exp(x(2))];
In the above code, I am optimising a relatively simple set of equations and am providing no linear or nonlinear constraints. This returns the following output:
>> x = test Attainment Max Line search Directional Iter F-count factor constraint steplength derivative Procedure 0 4 0 49.8799 1 8 2.114 8.168 1 0.704 2 12 2.451 1.567 1 0.615 Hessian modified twice 3 16 1.906e-008 0.8339 1 -0.984 4 20 0 0.0666 1 -1.3e-007 5 24 1.388e-017 0.0005193 1 1.04e-015 6 28 0 3.063e-008 1 -1.38e-013 Hessian modified Optimization terminated: magnitude of search direction less than 2*options.TolX and maximum constraint violation is less than options.TolCon. Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 1 2 3 4x = 2.1368 1.1744>>
As you can see, fgoalattain works just fine. But why is Max constraint non-zero and why does my solution have active nonlinear inequalities when I have not provided any nonlinear constraints?
Best Answer