Hi!
I'm running an optimization code as follows:
[xval,betaval] = fmincon(@betaindex,[1500 23 1800],... [-1 0 0;0 -1 0 ; 0 0 -1],[0; 0; 0],... [],[],[],[],@constraints,options);
The constraint function as follows:
function [c, ceq] = constraints(xval) a=MLR();ceq = a(1)*xval(1)+a(2)*((xval(1))^2)+a(3)*tan(DR(xval(2)))+a(4)*((tan(DR(xval(2))))^2)+a(5)*xval(3)+...+a(6)*((xval(3))^2)+a(7)*xval(1)*tan(DR(xval(2)))+a(8)*tan(DR(xval(2)))*xval(3)+a(9)*xval(1)*xval(3); c=[];
This is running well, but my only problem is how much time is required to run all the program. As this is an iterative procedure, in every iteration the whole @constraint function is evaluated and it takes to much time to get MLR() in every single iteration. Is there any way i can "freeze" the results in the first one and prevent this function from being evaluated in subsequent iterations ?
Thank you very much and sorry for this newbs question!
Best Answer