Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Preventing negative values in fmincon
Replies: 10   Last Post: May 28, 2008 12:03 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
John D'Errico

Posts: 9,060
Registered: 12/7/04
Re: Preventing negative values in fmincon
Posted: May 23, 2008 10:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Bruno Eklund" <bruno.eklund@talktalk.net> wrote in message
<g16ku5$714$1@fred.mathworks.com>...
> "Mike " <michael.gerstREMOVE@yale.edu> wrote in message
> <g11ahl$f9o$1@fred.mathworks.com>...

> > Hi all,
> >
> > I have setup a minimization problem using fmincon with
> > linear and non linear inequality constraints. I am

> having
> > the problem where fmincon will guess negative values for
> > some of the decision variables, even though I have

> included
> > a zero lower bound in the constraint matrix (instead of
> > using "lb").
> >
> > After looking through the results in more detail, this
> > appears to happen when certain variables have been

> minimized
> > to zero. In order to further decrease the value of the
> > objective function, fmincon will try to assign a negative
> > value to some of the decision variables which are

> already at
> > zero. Also, this usually happens when the objective
> > function is nearing a minimum.
> >
> > Why is this happening when I have coded in a lower bound

> of
> > zero? Are there any ways to prevent this from
> happening?
> > Any help would be greatly appreciated, as this has turned
> > out to be a very frustrating problem.
> >
> > Thanks,
> > Mike

>
>
> Hi Mike,
> making sure that parameters are positive during estimation
> is a quite common problem. Instead of using the bounded
> estimation method, I usually find it simpler to estimate
> the square of the parameter. For example, if I have a
> parameter b that should be at least zero, I use b^2 as a
> parameter in the estimation, and insert the estimated
> parameter a = b^2 into the model as sqrt(a).
> That should make the estimation routine to never assign
> a negative value to your parameter.
>
> Good luck,
> Bruno
>


This is a good way to enforce a non-negativity
constraint. It is how I do so in my fminsearchbnd.

It does introduce additional solutions to the
problem, but as they are all equivalent, that
is a non-issue.

John





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.