fmincon



Hi, I need help!!!!!!!!! I've just started to program in Matlab and I
have a problem... obviously!
I need to use fmincon inside 4 cycle for, but the problem is that the
optimization doesn't run. It sees the cycle but it gives out an error
message that I can't understand:

Optimization terminated: first-order optimality measure less
than options.TolFun and maximum constraint violation is less
than options.TolCon.


What can I do? Here it is the code.


global b; global or; global e; global
alfa;
global nofVal; global t0E; global Tstep Lstep;
global i j h k n;


t0E=1440
b = [100 300 500]
or = [5 10 15]
e = [600 900 1200]


alfa =[0.083 0.165
0.284]


nofVal = 10


for i=1:length(b) %cycle on the n of b
for j=1:length(or) %cycle on the n of or
for h=1:length(e) %cycle on the class of e
for k=1:length(alfa) %cycle on the patient mix alfa


Tstep(i,j,h,k)= (T(3,i,j,h,k)-T(2,i,j,h,k))/nofVal;
Lstep(i,j,h,k)= (L(2,i,j,h,k)-L(1,i,j,h,k))/nofVal;


options =
optimset('LargeScale','off','Display','iter');
[t1(i,j,h,k),fval,exitflag,output] =
fmincon(@objfun1TaE,t1s(i,j,h,k),[],[],[],[],lb,[],[],options)
t1(i,j,h,k)
end
end
end
end


And the objective function is:


function Sum1 = objfun1TaE(t1)


global nofVal;
global i j h k;
global b or e alfa;
global t0E;
global Tstep Lstep;
global NortE;
global A B;
global L;
global TrC;
t1(i,j,h,k)=1
%The interval lambdaU - lambdaL is divided into nofValues steps
%inizialization of the objective function
%Wti=ith observation during transient period (simulation for base
case)


%Value of Tf is obtained from simulation
%ln(Tf)=a+b*lambda for any arrival
rate
Wti(i,j,h,k)= exp(A(i,j,h,k)+B(i,j,h,k)*NortE(1,2));


t=zeros(length(b),length(or),length(e),length(alfa),nofVal);
for n=1:nofVal
Tstep(i,j,h,k);
t(i,j,k,h,n)=t0E+(n-1)*Tstep(i,j,h,k);


Tf(i,j,h,k,n)=exp(A(i,j,h,k)+B(i,j,h,k)*...
(L(1,i,j,h,k)+(n-1)*Lstep(i,j,h,k)));
Tf(1,1,1,1,1) ;
if n==1
Sum1=0;
TrC(i,j,h,k,n)= t0E+(Tf(i,j,h,k,n)-t0E)*(1-exp(((t0E-
t(i,j,h,k,n))/t1(i,j,h,k))));


else
TrC(i,j,h,k,n)= TrC(i,j,h,k,n-1)+...
(Tf(i,j,h,k,n)-t0E)*(1-
exp((TrC(i,j,h,k,n-1)-...
t(i,j,k,h,n))/t1(i,j,h,k)));
end
TrC(i,j,h,k,n);
Wti(i,j,h,k);
Sum1 = Sum1 + (Wti(i,j,h,k)-TrC(i,j,h,k,n))^2


end


Thank you really much for your attention and your help!

.



Relevant Pages

  • fmincon
    ... I need to use fmincon inside 4 cycle for, but the problem is that the ... Optimization terminated: first-order optimality measure less ... alfa =[0.083 0.165 ... And the objective function is: ...
    (comp.soft-sys.matlab)
  • Re: I know sidecars arent practical anymore (might as well have a car)
    ... Either if they are both based on the 1930s (beyond the obvious capacity ... the cycle parts of a Urinal are still stuck firmly in the 30s. ... SteveH 'You're not a real petrolhead unless you've owned an Alfa Romeo' ... Alfa 156 TSpark Sportwagon Veloce Selespeed - Alfa 75 TSpark Lusso ...
    (uk.rec.cars.modifications)
  • Variable name of variables
    ... I have to insert in my matlab program a " for " ... cycle in wich the name of variables is a function of cycle index so ... ALFA i =...... ...
    (comp.soft-sys.matlab)
  • hidden error
    ... Can anyone tell me why the for cycle does not work? ... double alfa = 0; ... the fact is that i don't get any error message, ... the calculation. ...
    (microsoft.public.dotnet.framework.aspnet)
  • where is the error?
    ... Can anyone tell me why the for cycle does not work? ... double alfa = 0; ... the fact is that i don't get any error message, ... the calculation. ...
    (microsoft.public.dotnet.languages.csharp)