PDA

View Full Version : how to deal with the error like this



yumiaoyun
12-17-2012, 04:28 AM
error IMSL_STEPSIZE_SELECTION from imsl_f_constrained_nlp
no acceptable stepsize in [sigsm sigla]
this is oftem due to a programming error in the user supplied gradients.
I am new,hope to get some help in the forum.
thanks.

below is the code :function of "fcn()"
fcn(.......)
{
int i=0;
float lamda=0;
float htemp;
float J=0; //
float h;
float hnext;
float gama;
float gamanext;

mark++;
if(mark==17)
{
//cout<<mark<<endl;
}
float rou;
float q;
float ha=x[0];float hb=x[1];float hc=x[2];float rf=x[3];
float ru=x[4];float rd=x[5];float M0=x[6];

float M=M0;
float L,T,D;
float afa;
float CL;
float Isp;
float s;
float dgamadt;
//r [0 rf]
float w=2.0*pi/rf;
float step=1000,r;
int ncount=rf/1000;

switch(iact)
{
case 0:
for(i=0;i<ncount+1;i++)
{
r=i*step;
getH_y(ha,hb,hc,rf,r,h,gama);// h,gama is known
getH_y(ha,hb,hc,rf,r+step,hnext,gamanext);

rou=exp(-2.1844*pow(10.0,-5)*pow(h/1000.0,3)+0.0037*pow(h/1000.0,2)-0.3309*h/1000.0+3.2173);//h/1000
q=0.5*rou*M*M*a*a;
// get afa
if((r>ru)&&(r<rd))
{
s=1.0;
}
else
{
s=0.0;
}
dgamadt=(gamanext-gama)/step;
//afa=fun_afa(h,M,gama,s,q,dgamadt);
afa=5.34;
//
CL=atan(10*M-10)/(20*pi)-0.035+afa*(0.057*exp(-0.654*M)+0.014);
L=q*CL*Aw; //getL
D=q*(0.008+1.85*(1-exp(-0.23568*M))*CL*CL)*Aw;//getD
//getT
T=s*q*(15*pow(afa+5.0,0.25)/pow(M,(float)1.15))*exp(-(pow(M,(float)0.08)/200)*pow(afa+5-(35/pow(M,(float)0.6)),2))*Ae;

Isp=-245*M+5480-10*(h/1000.0-20);
J+=step*(T/(g*Isp*M*a*cos(gama)))*(1+h/R0);
M+=step*((T*cos(afa*pi/180.0)-D-m*g*sin(gama))/(M*a*a*m*cos(gama)))*(1+h/R0);
if(M<14)
{
//cout<<M<<endl;
}
}
Mf=M;
*result=J/rf+100*(Mf-M0)*(Mf-M0);
for(i=0;i<7;i++)
{
cout<<x[i]<<" ";
}
cout<<endl;
cout<<*result<<endl;
break;
//case 1:
//*result=M0-Mf;
//break;
case 1:
*result=rf-rd;
break;
case 2:
*result=rd-ru;
break;
default:
break;
}
*ierr=0;
//cout<<mark<<endl;
return;
}

mecej4
12-18-2012, 06:09 AM
The amount of information provided is insufficient. Please provide

(i) complete code for the example that exhibits the problem, including the driver that calls imsl_f_constrained_nlp,

(ii) complete data for running the example,

(iii) the version numbers of the IMSL library, the compiler used, and

(iv) the OS/CPU on which the problem was experienced.