help-octave
[Top][All Lists]
Advanced

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

Re: fmincon versus sqp


From: Julian Schnidder
Subject: Re: fmincon versus sqp
Date: Wed, 30 Apr 2008 14:52:53 +0200

Hi,

Am 29.04.2008 um 17:35 schrieb Riccardo Corradini:

I am trying to use the octave function sqp to translate some Matlab code that uses
fmincon.
I found on the web the following example for fmincon:
http://www.wam.umd.edu/~petersd/660/fmincon_ex.html

The complete documentation for fmincon can be found under
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ index.html?/access/helpdesk/help/toolbox/optim/ug/fmincon.html

On the help on line of octave 3.1 I didn't understand how to use inequality constraints.
Could somebody give any hints on this issue?

sqp doesn't distinguish between linear and nonlinear constraints (as fmincon does). The constraints are modeled by functions, that return a vector. Each entry in that vector stands for a single constraint, e.g. you want the solution of the optimization to lie in the unit disc and the first variable to be nonnnegative: That means
1-norm(x)^2 >= 0 (<=> norm(x)^2 <= 1 <=> norm(x) <= 1)
x_1 >= 0.

Now you have to implement that as a function

function c=h(x)
  c(1)=1-norm(x)^2;
  c(2)=x(1);
endfunction

and use it in the sqp command (assuming the presence of the objective functions and a starting point x0)

sqp (x0, @objective_function, [], @h)

With "help -i sqp" within octave you can also see an example. Hope, that helps.

Kind regards,

JCS



reply via email to

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