help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question - sqp solver equality constraints function


From: alexegin
Subject: Re: Newbie question - sqp solver equality constraints function
Date: Thu, 29 Jun 2017 05:12:55 -0700 (PDT)

Juan Pablo Carbajal-2 wrote
> ...
> Yeah, that's fine.
> Make sure your initial guess is also compatible with Lb and Ub.

It is amazing, but  - *yes, it is fine*! After answering you I put it that
way and - it works! Now I have the following code with the initial guess
setting:

R = ones( rows( Y ), 1 );
if ( Lb < 0.0 )
  R( 2:2:end ) = R( 2:2:end ) * ( ( Ub - Lb ) / rows( Y ) ) * Ub;
  R( 1:2:end ) = R( 1:2:end ) * ( ( Ub - Lb ) / rows( Y ) ) * Lb;
  R( 2, 1 ) += 1.0 - sum( R( R >= 0.0 ) );
  R( 1, 1 ) -= sum( R( R <= 0.0 ) ) + 1.0;
else
  R = R * ( Ub + Lb ) / rows( Y );
endif

if ( Lb < 0.0 )
  g = @( x ) [ sum( x( x <= 0.0 ) ); sum( x( x >= 0.0 ) ) ] - [ Lb; Ub ];
else
  g = @( x ) sum( x ) - Ub;
endif

Everithing works, but ... one more thing - although initial guess is met
equality constraints exactly, i.e. *sum( R( R <= 0.0 ) ) = -1.0* and *sum(
R( R >= 0.0 ) ) = 1.0*, the result of sqp solver is not - *sum( x( x <= 0.0
) )* is a bit less than -1.0 and *sum( x( x >= 0.0 ) )* is a bit more than
1.0.
Do you have any ideas why it is so - maybe tune the tolerance of sqp?



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]