fmincon
- From: crisf78@xxxxxxxxxxx
- Date: 30 May 2007 15:37:40 -0700
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!
.
- Follow-Ups:
- Re: fmincon
- From: Tim De Meyer
- Re: fmincon
- Prev by Date: Re: OC curve for multiple sampling plan in Excel
- Next by Date: Chib (1995) Calculation Query
- Previous by thread: Linear Regression to study the mediating effect of a var
- Next by thread: Re: fmincon
- Index(es):
Relevant Pages
|