Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: nonlinear constraint help
Date: Fri, 18 Sep 2009 17:49:05 +0000 (UTC)
Organization: Xoran Technologies
Lines: 18
Message-ID: <h90h6h$59s$1@fred.mathworks.com>
References: <h8ufpv$2iq$1@fred.mathworks.com> <h8vuq3$5ng$2@fred.mathworks.com> <h908vv$b5f$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1253296145 5436 172.30.248.35 (18 Sep 2009 17:49:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 18 Sep 2009 17:49:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:571449


"Simone " <simonematool@gmail.com> wrote in message <h908vv$b5f$1@fred.mathworks.com>...
> Dear Alan and all,
> 
> thanks a lot for the answer and sorry for my little clarity, I am gonna try again.
> So the idea is that I have a series of linear constraints called, as usual, with the A= matrix, b=vector, Aeq=matrix and beq= vector. I never specified in my use of MATLAB (which until recently has been mostly with linear programming) the name of the variables that satisfy these constraints, then I have a nonlinear constraint in which are both the variables present in the linear constraints and other objects (that I am interested in as a solution) in something like this:
> function [c, ceq] = myconstr(x,l0,l)
> c = [l(1,1)./l0.*x(2).*x(2*n+2)+...+l(1,n)./l0.*x(n+1).*x(3*n+1) -x(2*n+2).*x(n+2)-	x(3*n+1).*x(2*n+1) ]
> ceq=[]
> l0 and l are data given. I assumed that the variables of the system in the linear constraints are all in the vector x as given in the example from the Mathworks website (and I'm calling also my solution x as per below command). In the linear part I have 2*n+1 variables in the constraints so I started calling these new variables I would like to pass onto the system with x(2*n+2) until x(3*n+1), is it possible to do this?
=========================

No. 

You must define both myobj(X) and myconstr(X) so that the input vector X is of length 3*n+1 and contains all variables that ever appear in the problem. It is not necessary that myobj() and myconstr actually use all 3*n+1 components of X. It is okay if they just use the first 2*n+1 of them.

You must also modify A and Aeq so that they have  3*n+1 columns. The columns 2*n+2 through 3*n+1 should be zero.

Similarly, you must extend ub and lb to be of length 3*n+1...