# What is error(19) or error(15): out of bound(1)...how to resolve?

3 messages
Open this post in threaded view
|

## What is error(19) or error(15): out of bound(1)...how to resolve?

 please tell me...m solving an optimization problem with inequality constraints.  The error m getting while running my code is : "error: x(15): out of bound 1" please let me know...what is the error and how to resolve this. My code: clear all; format short e; % global variable declaration for all constants global P=6000 L=14 E=30e6 Delmax=0.25 G=12e6 Taumax=13.6e3 Sigmax=30e3; %defining initial values, max no.of iterations and tolerance x0=[1;1;0.5;0.5]; lb=[0.125; 0.1; 0.01; 0.01]; ub=[inf; inf; 10; 2]; maxiter=1000; tol=1e-8; %defining objective function function obj=f(x)   obj=1.10471*x(1)^2*x(2)+0.04811*x(3)*x(4)*(14+x(2)) endfunction %definging gradient of objective function function gradf=df(x)   gradf=[2.20942*x(1)*x(2);1.10471*x(1)^2+0.04811*x(3)*x(4);0.04811*x(4)*(14+x(2));          0.04811*x(3)*(14+x(2))]; endfunction %defining Hessian of objective function function Hessobj=ddf(x)   Hessobj=[2.20942*x(2) 2.20942*x(1) 0 0;2.20942*x(1) 0 0.04811*x(4) 0.04811*x(3);            0 0.04811*x(4) 0 0.04811*(14+x(2));0 0.04811*x(3) 0.04811*(14+x(2)) 0]; endfunction %defining constraints function ineqcons=g(x)   global P L E Delmax G Taumax Sigmax;   %display(E);   Tau1=P/(sqrt(2)*x(1)*x(2));   M=P*(L+x(2)/2);   R=sqrt(x(2)^2/4+((x(1)+x(3))/2)^2);   J=2*sqrt(2)*x(1)*x(2)*(x(2)^2/12+((x(1)+x(3))/2)^2);   Tau2=M*R/J;   Tau=sqrt(Tau1^2+2*Tau1*Tau2*x(2)/(2*R)+Tau2^2);   Sigma=6*P*L/(x(4)*x(3)^2);   Delta=4*P*L^3/(E*x(3)^3*x(4));   Pc=(4.103*E/L^2)*(x(3)*x(4)^3/6)*(1-(x(3)/2*L)*sqrt(E/(4*G)));   ineqcons=[-(Tau-Taumax); -(Sigma-Sigmax); -(x(1)-x(4)); -(Delta-Delmax);             -(0.10471*x(1)^2+0.04811*x(3)*x(4)(14+x(2))-5); -(P-Pc)]; endfunction %Supplying Objective function including Gradient and Hessian Objfun={@(x)f(x),@(x)df(x),@(x)ddf(x)}; [x,obj,info,iter,nf,lambda] = ... sqp(x0,Objfun,[],@g,lb,ub, maxiter, tol); Error message: /obj =    1.2851e+00 error: x(15): out of bound 1 error: called from     g at line 44 column 11     sqp>cf_ub_lb at line 698 column 9     sqp>@ at line 316 column 21     sqp at line 367 column 6     Project_Question2_1 at line 51 column 28*/ -- Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html