help-octave
[Top][All Lists]

## Re: Newbie question - sqp solver equality constraints function

 From: alexegin Subject: Re: Newbie question - sqp solver equality constraints function Date: Thu, 29 Jun 2017 02:11:57 -0700 (PDT)

```Juan Pablo Carbajal-2 wrote
> Good luck and come back soon!

Hello again :)
I have the following code working:

clear all;
Y = 2.0 * rand( 5, 1 ) - 1.0;
f = 0.0025;
Lb = -1.0; # Lower bound
Ub = 1.0; # Upper bound

# Initial guess
R = ones( rows( Y ), 1 );
R( 2:2:end ) = R( 2:2:end ) * ( 2.0 / rows( Y ) ) * Ub;
R( 1:2:end ) = R( 1:2:end ) * ( 2.0 / rows( Y ) ) * Lb;

# Objective function
phi = @( x ) sumsq( x );

# Equality constraint function
g = @( x ) [ sum( x( x <= 0.0 ) ); sum( x( x >= 0.0 ) ) ] - [ Lb; Ub ];

# Non-equality constraint function
h = @( x ) f - x.' * Y;

# Solver
tic;
[ x, obj, info, iter, nf, l ] = sqp( R, phi, g, h, Lb, Ub );
tm = toc();

But if I set lower bound to zero ( *Lb = 0.0* ) I have the following error:

*error: qp: equality constraint matrix must be full row rank*

What am I doing wrong? I am stuck ...

--
View this message in context:
http://octave.1599824.n4.nabble.com/Newbie-question-sqp-solver-equality-constraints-function-tp4683834p4683938.html
Sent from the Octave - General mailing list archive at Nabble.com.

```