Thanks for responding again, John!
>
> This is what the lb and ub inputs to fmincon do.
> They provide bound constraints.
>
> If a variable is unconstrained, then use +/ inf.
> As an example, if x1 must lie in [0,3], and x3>=2,
> but x2 and x4 are unconstrained, then
>
> lb = [0 inf 2 inf]
> ub = [3 inf inf inf]
>
I guess I just need this kind of handholding... I've never used
fmincon before, so this is all new to me. However, this is exactly
what I was looking for!
> As for the differences between the two optimizers,
> that would take a book. Fminsearch is a Nelder/Mead
> polytope method. (Some call it a simplex method,
> but then someone always gets confused that it does
> linear programming. Polytope has no such ambiguity.)
>
> These simplex/polytope methods work by reflecting
> a simplex (think triangle in 2dimensions) around
> the space. The simplex walks around, testing the
> objective at each point. They walk AWAY from high
> values, rather than towards low ones. There is a
> difference.
>
> Fmincon is a more sophisticated method, which
> requires local knowledge of the gradient of the
> surface. It computes the gradient using a finite
> difference approximation, or you can supply it
> yourself.
>
> Fminsearch is limited in the number of unknowns you
> can solve for, because it gets very slow for high
> dimensional problems. I'd rarely (if ever) use it
> for more than about 5 or 6 unknowns. Its fine for
> 2d or 3d cases that I will not need to solve often.
>
> Think of fminsearch as the 1960's era VW beetle.
> Its a fun little car that will get you where you
> want to go, as long as you don't want to get there
> too fast, or carry too many bags in the trunk. Its
> easy enough to repair when there are problems  no
> fancy diagnostic tools required and a simple shop
> manual. Don't expect much in the way of heat in the
> winter or power windows and seats.
>
> On the other hand, fmincon is a new car. Its got
> gadgets like power windows, heated seats that adjust
> at the touch of a button, dvd players in the back
> seat for the kids, gps mapping for the navigator.
> It will get you up to 75 on the expressway in a
> matter of seconds (not that I would ever exceed
> the posted speed limit.) Its a little touchy under
> the hood though.
>
> HTH,
> John
>
This really helped! thanks again! (heh, I really enjoyed the
analogy!) I've just always stuck with fminsearch (since that's what
I started using way back when) and I've never had a reason to
question it's abilities until now. It't probably time to learn some
new tricks!
A few more questions though. I'm getting a feel for constraining a
single variable bewteen bounds, but I'm still unsure of how to
express a linear combination of variables with constraint:
for instance  four variables, a(1) a(2) a(3) a(4)
0 <= a(1) <= 1 and 0 <= a(2) <= 1 while a(3) and a(4)
float,
I'll use the ub and lb as you stated above...
but also I may need:
a(1) + a(2) = 1
(or some other linear combination of variables equal to a constant)
Also, how do I pass values that are needed for fitting to fmincon.
When using fminsearch, variables that were in the first group were
minimized to fit, while everything else was passed as static
variables or arguments:
fminsearch('fitting_function',[A B C D], [], xvals, other_args,
etc...)
so [A B C D] are minimized from their starting values, while
xvals, other_args, etc... are static yet needed to fit A, B, C, and D
(or had other effects on the .m file)
I think what I need is a tutorial which explains how to put together
the correct syntax for fmincon vs fminsearch for specific problems
(the matlab help didn't help me much  maybe I'm too dense for
it!)...
Thanks again!
