Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Optimization Problem

Subject: Optimization Problem

From: C K

Date: 4 Apr, 2008 09:27:02

Message: 1 of 3

Hello everybody,
I'm trying to solve an optimization problem by using fmincon.
I have non-linear objective function and linear constraints
and I would like the return values of x(see below) to be in
the range [0,1].
Unfortunately I get negative values and values greater than 1.

The function I use for calling fmincon is as follows:
(I also use java-builder if it has anything to do with the
problem )

function [x,fval] = doOptim(xW, x0, cons, no, fileName)
options=optimset('Largescale','on');
A = csvread(fileName);
B = zeros(cons,1)
[x,fval] = fmincon(@(w)obj(w, xW,
no),x0,A,B,[],[],0,1,[],options);

The results I get are:
Warning: Trust-region-reflective method does not currently
solve this type of
problem,
 using active-set (line search) instead.
> In fmincon at 422
  In doOptim at 8

Optimization terminated: magnitude of directional derivative
in search
 direction less than 2*options.TolFun and maximum constraint
violation
  is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
  lower upper ineqlin ineqnonlin
                          2
                          3
** Finished OPTIMIZATION *********************************
RESULTS
WEIGHTS:0.0093 0.0676 -0.0200 -0.0060
FUNCTION VALUE:0.1868

Thank you in advance,
CK.

Subject: Optimization Problem

From: John D'Errico

Date: 4 Apr, 2008 10:12:02

Message: 2 of 3

"C K" <angrypeng@yahoo.com> wrote in message
<ft4s96$j1c$1@fred.mathworks.com>...
> Hello everybody,
> I'm trying to solve an optimization problem by using fmincon.
> I have non-linear objective function and linear constraints
> and I would like the return values of x(see below) to be in
> the range [0,1].
> Unfortunately I get negative values and values greater than 1.
>
> The function I use for calling fmincon is as follows:
> (I also use java-builder if it has anything to do with the
> problem )
>
> function [x,fval] = doOptim(xW, x0, cons, no, fileName)
> options=optimset('Largescale','on');
> A = csvread(fileName);
> B = zeros(cons,1)
> [x,fval] = fmincon(@(w)obj(w, xW,
> no),x0,A,B,[],[],0,1,[],options);
>
> The results I get are:
> Warning: Trust-region-reflective method does not currently
> solve this type of
> problem,
> using active-set (line search) instead.
> > In fmincon at 422
> In doOptim at 8

Note that you have linear inequality constraints,
So you cannot use the largescale method.

If you have more than one parameter, then
why have you only passed in scalars for the
bounds. You must pass in one bound for EACH
variable.

John

Subject: Optimization Problem

From: Nicolas

Date: 9 Apr, 2008 08:55:03

Message: 3 of 3

"John D'Errico" <woodchips@rochester.rr.com> wrote in
message <ft4uti$a7q$1@fred.mathworks.com>...
> "C K" <angrypeng@yahoo.com> wrote in message
> <ft4s96$j1c$1@fred.mathworks.com>...
> > Hello everybody,
> > I'm trying to solve an optimization problem by using
fmincon.
> > I have non-linear objective function and linear
constraints
> > and I would like the return values of x(see below) to
be in
> > the range [0,1].
> > Unfortunately I get negative values and values greater
than 1.
> >
> > The function I use for calling fmincon is as follows:
> > (I also use java-builder if it has anything to do with
the
> > problem )
> >
> > function [x,fval] = doOptim(xW, x0, cons, no, fileName)
> > options=optimset('Largescale','on');
> > A = csvread(fileName);
> > B = zeros(cons,1)
> > [x,fval] = fmincon(@(w)obj(w, xW,
> > no),x0,A,B,[],[],0,1,[],options);
> >
> > The results I get are:
> > Warning: Trust-region-reflective method does not
currently
> > solve this type of
> > problem,
> > using active-set (line search) instead.
> > > In fmincon at 422
> > In doOptim at 8
>
> Note that you have linear inequality constraints,
> So you cannot use the largescale method.
>
> If you have more than one parameter, then
> why have you only passed in scalars for the
> bounds. You must pass in one bound for EACH
> variable.
>
> John

If you use the R2008a of the optimization toolbox and if
you think you need it (It handles linear inequality
constraints), I can provide you a one-month trial version
of knitro that you can call with the ktrlink function
available in the toolbox.

Nicolas

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us