help-octave
[Top][All Lists]
Advanced

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

Re: fmincon and quadprog in octave


From: Rajiv Bhutani
Subject: Re: fmincon and quadprog in octave
Date: Mon, 14 Sep 2015 16:47:35 -0400

Hello Olaf,

Thanks for your suggestion to check exitflag. I got exitflag=0 in octave which means number of iterations exceed MaxIter. In MATLAB, I got exitflag = -3 which means problem is unbounded.

1) I knew something was wrong in this case because I checked against MATLAB. But in future, if I don't want to cross-check against MATLAB and if not running exitflag, is there a way I can quickly find whether solution given by Octave is correct or not? E.g. my initial reaction was that octave found a solution with 
x =

    86.638
  -180.261
which is wrong since running exitflag clearly shows that it is not a solution. 

2) Also, does this discrepant behavior of Octave vs MATLAB output qualify as a bug in octave, or is it too small to be considered a bug?
Thanks.

Best Regards,
Rajiv

On Mon, Sep 14, 2015 at 9:12 AM, Olaf Till <address@hidden> wrote:
On Mon, Sep 14, 2015 at 03:35:11AM -0400, Rajiv Bhutani wrote:
> Hello Olaf,
>
> Thank you for suggesting mailing list!
>
> So, I went ahead and copied Octave quadprog function from
> http://sourceforge.net/p/octave/optim/ci/4dda96629be38394acd2037fef875f74213d716a/tree/inst/quadprog.m#l1
>
> and pasted it in relevant (I hope I put it in the right directory)
> directory on my laptop:
>
> D:\octave-4.0.0\share\octave\packages\optim-1.4.1
>
> I notice some discrepancies between MATLAB's quadprog and octave's qp
> function and octave's quadprog function.
>
> For Example: Consider below
> >> H = [6 10; 5 -6];
> f = [-2; 3];
> A = [];
> b = [];
>
> *In MATLAB:* >> quadprog(H,f,A,b)
> Warning: Your Hessian is not symmetric. Resetting H=(H+H')/2.
> > In quadprog at 333
> Warning: Trust-region-reflective algorithm does not solve this type of
> problem, using
> active-set algorithm. For more help, see Choosing the Algorithm in the
> documentation.
> > In quadprog at 371
> Warning: Your current settings will run a different algorithm
> (interior-point-convex) in
> a future release.
> > In quadprog at 375
> Exiting: the solution is unbounded and at infinity;
>  the constraints are not restrictive enough.
>
> ans =
>
>    1.0e+16 *
>
>     1.2500
>    -1.0000
>
> *In Octave:*>> quadprog(H,f)
> ans =
>
>     86.638
>   -180.261
>
> *In Octave:* >> qp([],H,f)
> ans =
>
>     86.638
>   -180.261
>
>
> Hope either you or someone from the mailing list can comment on what is
> wrong, and if quadprog function needs to be modified further, since its not
> giving identical results to MATLAB at least in above example.
>
> Best Regards,
> Rajiv Bhutani

You get no result in both cases (check the exitflag). Octave quadprog
and qp don't detect that there is no solution. But they don't pretend
they have found one.

Olaf

> On Mon, Sep 14, 2015 at 3:01 AM, Olaf Till <address@hidden> wrote:
>
> > On Mon, Sep 14, 2015 at 12:55:34AM -0400, Rajiv Bhutani wrote:
> > > Hello,
> > >
> > > I have started work on octave couple days ago and I am trying to locate
> > > fmincon and quadprog in octave.
> > >
> > > I see quadprog is available here and has been recently developed jointly
> > by
> > > you and Asma.
> > >
> > http://sourceforge.net/p/octave/optim/ci/4dda96629be38394acd2037fef875f74213d716a/tree/inst/quadprog.m#l2
> > >
> > > but it is not available in optim package that got installed on my laptop
> > > with octave.
> > >
> > > Is development work on quadprog still going on? Is that the reason why it
> > > is not available on sourceforge yet?
> > >
> > > Also, can you please tell me a good replacement for fmincon function of
> > > MATLAB? Is anyone developing fmincon function for octave currently?
> > > Thank You.
> > > Best Regards.
> > > Rajiv Bhutani
> >
> > Hello Rajiv,
> >
> > please use the help mailing list (is now in CC).
> >
> > 'quadprog' seems finished and is available in optim, but not yet in a
> > released version of optim. 'qp' of core Octave is an
> > alternative. 'fmincon' did not seem to be ready and I heard nothing
> > new about it from Asma. Maybe I should take a look at it to see if it
> > can be commited to optim. You can use 'nonlin_min' of optim instead,
> > which is what 'fmincon' also does, or 'sqp' of core Octave.
> >
> > Olaf
> >
> > --
> > public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
> >

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net


reply via email to

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