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 03:47:43 -0700 (PDT)

Juan Pablo Carbajal-2 wrote
> Nevertheless the function g is not meaningful when Lb or Ub are 0  ... 
> Do you set the initial guess with this property?
> What are you trying to achieve?

You are right - when Lb ( Ub ) is zero, equality constraint function becomes
just:

g = @( x ) sum( x ) - Ub;

I am trying to achieve a kind of /universal solution/ - I run Octave script
from another process, prepearing data for it (see dlmread above). I would
like to have an opportunity to set Lb to -1.0 or to 0.0 while /runnig the
same script/, somewhat:

#  I am not sure the following syntax is possible
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

As for initial guess, I set it this way (assume that Lb = -1.0):

R = ones( rows( Y ), 1 ); 
R( 2:2:end ) = R( 2:2:end ) * ( 2.0 / rows( Y ) ) * Ub; # sum( R( R >= 0.0 )
) = 1.0
R( 1:2:end ) = R( 1:2:end ) * ( 2.0 / rows( Y ) ) * Lb; # sum( R( R <= 0.0 )
) = -1.0




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



reply via email to

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