From: Alan Weiss on
On 6/2/2010 6:12 AM, JOHN pip wrote:
> "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message
> <hu4jop$njm$1(a)fred.mathworks.com>...
>> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message
>> <hu4f6h$oe3$1(a)fred.mathworks.com>...
>> > "JOHN pip" <johny-pip(a)hotmail.com> wrote in message
>> <hu459n$s4u$1(a)fred.mathworks.com>...
>> > > > g1,g2,g3 integers
>> > > > > > > So i am wondering, is it proper for Fmincon to be slower
>> than an exhaustive search which is considered to be an extremely
>> simple method?Can someone tell me why something like this is happening
>> and is it the right thing?
>> > =================
>> > > you're obviously not constraining the gi to integers when using
>> fmincon because fmincon cannot process such constraints.
>> > > When you constrain the gi to integers the number of feasible
>> solutions becomes very small and easy to enumerate, so there is really
>> no surprise that exhaustive search is faster. > > Also, the
>> expressions for the nonlinear constraints are monstrous, with many
>> repeated sub-expressions. Evaluating them iteratively in fmincon would
>> consume much computation time if you implemented them as written,
>> rather than carefully optimizing them.
>> >
>> And if you are somehow TRYING to constrain the parameters
>> to be integer, then this explains why fmincon is having a
>> problem. It can't do that.
>>
>> John
>
>
>
> And can i somehow constrain gi to integers when using fmincon in order
> to reduce the number of feasibles solutions?Is there any option that can
> do this?

You seem to have the impression that fmincon might be appropriate for
solving an integer programming problem. It is not. fmincon is a
gradient-based algorithm, meaning it requires derivatives of functions.
It usually estimates them by making small changes in the location. This
means the location cannot be integer-valued for fmincon.

Currently there is no MATLAB solver that addresses integer programming
problems without additional programming. For a genetic algorithm
approach (that still requires some additional programming), see
http://www.mathworks.com/support/solutions/en/data/1-10PDHC/

Alan Weiss
MATLAB mathematical toolbox documentation
From: Walter Roberson on
JOHN pip wrote:

> Thank's for your advise but i'm pretty sure tha there is no 'bug' if i
> got it right in my objfun.Is it impossible to be another mistake and
> mostly related to fmincon?

It is _possible_, as the Mathworks programmers are only human.

On the other hand, the routine has undergone quite a bit of user
testing, whereas your objective function has undergone little. The
probability that the error is on your side is considerably higher than
the probability that the error is on Mathwork's side.