help-octave
[Top][All Lists]
Advanced

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

Re: limiting the range of solutions with fsolve


From: Bob Walton
Subject: Re: limiting the range of solutions with fsolve
Date: Thu, 1 Nov 2012 06:15:28 -0700 (PDT)

One thing that has worked for me is to add penalties to the objective
function to "punish" the solver for violating the bounds.  One must keep
"knife edges" out of the objective function (that is, the partial derivative
of the function with respect to each parameter must be continuous) or the
solver will probably get stuck at a "knife edge".  Suitable
continuous-derivative penalties for your situation could be of the form:

10e6*max(abs(x1)-1),0)^4

The "10e6" is a scaling factor that depends upon the range of your objective
functions and your sensitivity to penetrating your bounds.  In the context
of "fsolve", you may find that adding these penalties as three additional
outputs to the function will work.  As long as you're in the range of -1 to
+1 with all three variables, it should behave as it presently does, since
the penalties will be zero.  When a variable gets outside of this range, the
penalty for that variable will kick in and the solver will avoid that area. 
Some penetration of the range may occur.  The power used may be any power of
2 or more, but I wouldn't exceed 10.  If "fsolve" takes "branches to left
field" (i.e., occasionally generates outrageous values for x1, x2 or x3),
you might want to consider reformulating for fminsearch -- it doesn't
generate "branches to left field".  fminsearch is in the optim package. 
Your mileage may vary with installing the optim package -- it won't install
for me on MinGW Octave built with the GNU compiler -- but one can just copy
fminsearch.m, fmins.m and nmsmax.m from the optim tar archive to somewhere
on your Octave path (like .../share/octave/3.6.2/m/optimization) and it
(that is, fminsearch, not the remainder of the optim package) will work.
-- 
Bob Walton



--
View this message in context: 
http://octave.1599824.n4.nabble.com/limiting-the-range-of-solutions-with-fsolve-tp4645953p4645977.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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