Got Questions? Get Answers.
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:
quadprog too slow

Subject: quadprog too slow

From: hicham bouchnaif

Date: 27 May, 2008 11:14:02

Message: 1 of 15

Hi there
I am trying to solve a quadratic problem with linear
constraints using quadprog function. I get the solution but
it's just too slow .it takes about 10min to get the problem
solved.
the problem consists of 1000 (one thousand variables) and
the hessian matrix is a sparse matrix thus I guess the
problem should be solved much faster.
is it possible to make it faster by changing the options.I
tried suitching on the LargeScale option,but nothing
changed. does anyone have any idea?
thanx a lot in advance.
 

Subject: quadprog too slow

From: Johan Löfberg

Date: 27 May, 2008 12:58:02

Message: 2 of 15

Are the constraints sparse too?

Have you tried an alternative solver, such as clpmex,
bpmpdmex, ooqp

http://control.ee.ethz.ch/~joloef/wiki/pmwiki.php?n=Solvers.Solvers

Sparse problems of size 1000 is solved in ~10 seconds using
clp when I tried it

"hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
<g1gqdq$ns6$1@fred.mathworks.com>...
> Hi there
> I am trying to solve a quadratic problem with linear
> constraints using quadprog function. I get the solution but
> it's just too slow .it takes about 10min to get the problem
> solved.
> the problem consists of 1000 (one thousand variables) and
> the hessian matrix is a sparse matrix thus I guess the
> problem should be solved much faster.
> is it possible to make it faster by changing the options.I
> tried suitching on the LargeScale option,but nothing
> changed. does anyone have any idea?
> thanx a lot in advance.
>

Subject: quadprog too slow

From: hicham bouchnaif

Date: 28 May, 2008 01:29:02

Message: 3 of 15


> Are the constraints sparse too?

yes the constraints are aparse too.
 
> Have you tried an alternative solver, such as clpmex,
> bpmpdmex, ooqp

haven'tried yet but I d like to make the tool 100%matlab
for some technical reasons.

Subject: quadprog too slow

From: Johan L&#xF6;fberg

Date: 28 May, 2008 09:25:05

Message: 4 of 15

"hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
<g1icgu$b2a$1@fred.mathworks.com>...
>
> > Are the constraints sparse too?
>
> yes the constraints are aparse too.
>
> > Have you tried an alternative solver, such as clpmex,
> > bpmpdmex, ooqp
>
> haven'tried yet but I d like to make the tool 100%matlab
> for some technical reasons.
>

The alternatives are interfaced to MATLAB, or do you mean
that you won't accept mex?

Subject: quadprog too slow

From: Stefan

Date: 28 May, 2008 11:07:02

Message: 5 of 15

Hi there,

maybe this helps:

http://sigpromu.org/quadprog/index.html

Regards,
Stefan

"Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in
message <g1j8dh$nbj$1@fred.mathworks.com>...
> "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> <g1icgu$b2a$1@fred.mathworks.com>...
> >
> > > Are the constraints sparse too?
> >
> > yes the constraints are aparse too.
> >
> > > Have you tried an alternative solver, such as clpmex,
> > > bpmpdmex, ooqp
> >
> > haven'tried yet but I d like to make the tool
100%matlab
> > for some technical reasons.
> >
>
> The alternatives are interfaced to MATLAB, or do you mean
> that you won't accept mex?
>
>

Subject: quadprog too slow

From: hicham bouchnaif

Date: 29 May, 2008 00:50:18

Message: 6 of 15

Hi Stefan
thanx for the link.
I think that QPC supports only dense matrices which means
that it doesn't suit large scale problems.

Regards


> Hi there,
>
> maybe this helps:
>
> http://sigpromu.org/quadprog/index.html
>
> Regards,
> Stefan
>
> "Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in
> message <g1j8dh$nbj$1@fred.mathworks.com>...
> > "hicham bouchnaif" <bouchnaif@gmail.com> wrote in
message
> > <g1icgu$b2a$1@fred.mathworks.com>...
> > >
> > > > Are the constraints sparse too?
> > >
> > > yes the constraints are aparse too.
> > >
> > > > Have you tried an alternative solver, such as
clpmex,
> > > > bpmpdmex, ooqp
> > >
> > > haven'tried yet but I d like to make the tool
> 100%matlab
> > > for some technical reasons.
> > >
> >
> > The alternatives are interfaced to MATLAB, or do you
mean
> > that you won't accept mex?
> >
> >
>

Subject: quadprog too slow

From: hicham bouchnaif

Date: 29 May, 2008 00:55:04

Message: 7 of 15


> The alternatives are interfaced to MATLAB, or do you mean
> that you won't accept mex?
 
no it's just a matter of accuracy, I ll try this OOQP stuff
and see how it works.

Regards

Subject: quadprog too slow

From: Johan L&#xF6;fberg

Date: 29 May, 2008 12:32:01

Message: 8 of 15

"hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
<g1kut8$g50$1@fred.mathworks.com>...
>
> > The alternatives are interfaced to MATLAB, or do you mean
> > that you won't accept mex?
>
> no it's just a matter of accuracy, I ll try this OOQP stuff
> and see how it works.
>
> Regards
>
>

Correct, QPC is not applicable due to sparsity. clpmex
should work straight out of the box, so will bpmpdmex. I
think I had problems obtaining compiled versions of ooqp
last time I tried.

Subject: quadprog too slow

From: hicham bouchnaif

Date: 2 Jun, 2008 06:55:04

Message: 9 of 15

I tried clpmex, it's realy fast, quite impressing.
I ll try to test it for a higher scale.
by the way do you happen to know any other free soft that
you recommand for solving problems of type QP with
quadratic and linear constraints?

thanx alot.


> >
> > > The alternatives are interfaced to MATLAB, or do you
mean
> > > that you won't accept mex?
> >
> > no it's just a matter of accuracy, I ll try this OOQP
stuff
> > and see how it works.
> >
> > Regards
> >
> >
>
> Correct, QPC is not applicable due to sparsity. clpmex
> should work straight out of the box, so will bpmpdmex. I
> think I had problems obtaining compiled versions of ooqp
> last time I tried.

Subject: quadprog too slow

From: Johan L&#xF6;fberg

Date: 2 Jun, 2008 09:21:02

Message: 10 of 15

Those listed on the page I referenced are the ones with
MATLAB interfaces that I am aware of

"hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
<g205g8$kam$1@fred.mathworks.com>...
> I tried clpmex, it's realy fast, quite impressing.
> I ll try to test it for a higher scale.
> by the way do you happen to know any other free soft that
> you recommand for solving problems of type QP with
> quadratic and linear constraints?
>
> thanx alot.
>
>
> > >
> > > > The alternatives are interfaced to MATLAB, or do you
> mean
> > > > that you won't accept mex?
> > >
> > > no it's just a matter of accuracy, I ll try this OOQP
> stuff
> > > and see how it works.
> > >
> > > Regards
> > >
> > >
> >
> > Correct, QPC is not applicable due to sparsity. clpmex
> > should work straight out of the box, so will bpmpdmex. I
> > think I had problems obtaining compiled versions of ooqp
> > last time I tried.
>

Subject: quadprog too slow

From: Min

Date: 6 Oct, 2008 18:35:06

Message: 11 of 15

Hi All,

I'm facing almost exactly the same problem.
Therefore I would like to try out clpmex as well.
I wonder should I download the file from
"http://control.ee.ethz.ch/~hybrid/cplexint.msql"?
And do I need to download the cplex library from http://www.ilog.com/ as well?
I tried to use the mex file directly but failed (libstdc++.so.5: cannot open shared object file: No such file or directory).
Any suggestions and pointers will be a great help for me.

Best,
MS

"Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in message <g20e1u$dop$1@fred.mathworks.com>...
> Those listed on the page I referenced are the ones with
> MATLAB interfaces that I am aware of
>
> "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> <g205g8$kam$1@fred.mathworks.com>...
> > I tried clpmex, it's realy fast, quite impressing.
> > I ll try to test it for a higher scale.
> > by the way do you happen to know any other free soft that
> > you recommand for solving problems of type QP with
> > quadratic and linear constraints?
> >
> > thanx alot.
> >
> >
> > > >
> > > > > The alternatives are interfaced to MATLAB, or do you
> > mean
> > > > > that you won't accept mex?
> > > >
> > > > no it's just a matter of accuracy, I ll try this OOQP
> > stuff
> > > > and see how it works.
> > > >
> > > > Regards
> > > >
> > > >
> > >
> > > Correct, QPC is not applicable due to sparsity. clpmex
> > > should work straight out of the box, so will bpmpdmex. I
> > > think I had problems obtaining compiled versions of ooqp
> > > last time I tried.
> >
>

Subject: quadprog too slow

From: Min

Date: 6 Oct, 2008 19:00:27

Message: 12 of 15

Hi Johan,

Clpmex seems to need a license. Therefore, bpmpdmex might be the only free option for large-scale sparse QP problems.
However, the bpmpdmex that I downloaded only has a pre-compiled 32bit linux version.
Do you know how to compile bpmpdmex for a 64bit linux machine? The reason I can'y compile it is because I do not find the source code of bpmpd and any documents on using bpmpdlib.

Best,
-MS


"Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in message <g1m7o1$dgi$1@fred.mathworks.com>...
> "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> <g1kut8$g50$1@fred.mathworks.com>...
> >
> > > The alternatives are interfaced to MATLAB, or do you mean
> > > that you won't accept mex?
> >
> > no it's just a matter of accuracy, I ll try this OOQP stuff
> > and see how it works.
> >
> > Regards
> >
> >
>
> Correct, QPC is not applicable due to sparsity. clpmex
> should work straight out of the box, so will bpmpdmex. I
> think I had problems obtaining compiled versions of ooqp
> last time I tried.

Subject: quadprog too slow

From: sally

Date: 11 Jul, 2012 20:00:19

Message: 13 of 15

I was able to speed up my solver significantly using the following recommendations from the documentation:

If you have a convex problem, or if you don't know whether your problem is convex, use interior-point-convex.
If you have only bounds, or only linear equalities, use trust-region-reflective.
If you have a nonconvex problem that does not satisfy the restrictions of trust-region-reflective, use active-set.


"Min " <aliensunmin@gmail.com> wrote in message <gcdn8b$6pn$1@fred.mathworks.com>...
> Hi Johan,
>
> Clpmex seems to need a license. Therefore, bpmpdmex might be the only free option for large-scale sparse QP problems.
> However, the bpmpdmex that I downloaded only has a pre-compiled 32bit linux version.
> Do you know how to compile bpmpdmex for a 64bit linux machine? The reason I can'y compile it is because I do not find the source code of bpmpd and any documents on using bpmpdlib.
>
> Best,
> -MS
>
>
> "Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in message <g1m7o1$dgi$1@fred.mathworks.com>...
> > "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> > <g1kut8$g50$1@fred.mathworks.com>...
> > >
> > > > The alternatives are interfaced to MATLAB, or do you mean
> > > > that you won't accept mex?
> > >
> > > no it's just a matter of accuracy, I ll try this OOQP stuff
> > > and see how it works.
> > >
> > > Regards
> > >
> > >
> >
> > Correct, QPC is not applicable due to sparsity. clpmex
> > should work straight out of the box, so will bpmpdmex. I
> > think I had problems obtaining compiled versions of ooqp
> > last time I tried.

Subject: quadprog too slow

From: Saad

Date: 27 Nov, 2012 19:52:15

Message: 14 of 15

"sally" wrote in message <jtkm0j$rm2$1@newscl01ah.mathworks.com>...
> I was able to speed up my solver significantly using the following recommendations from the documentation:
>
> If you have a convex problem, or if you don't know whether your problem is convex, use interior-point-convex.
> If you have only bounds, or only linear equalities, use trust-region-reflective.
> If you have a nonconvex problem that does not satisfy the restrictions of trust-region-reflective, use active-set.
>
>
> "Min " <aliensunmin@gmail.com> wrote in message <gcdn8b$6pn$1@fred.mathworks.com>...
> > Hi Johan,
> >
> > Clpmex seems to need a license. Therefore, bpmpdmex might be the only free option for large-scale sparse QP problems.
> > However, the bpmpdmex that I downloaded only has a pre-compiled 32bit linux version.
> > Do you know how to compile bpmpdmex for a 64bit linux machine? The reason I can'y compile it is because I do not find the source code of bpmpd and any documents on using bpmpdlib.
> >
> > Best,
> > -MS
> >
> >
> > "Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in message <g1m7o1$dgi$1@fred.mathworks.com>...
> > > "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> > > <g1kut8$g50$1@fred.mathworks.com>...
> > > >
> > > > > The alternatives are interfaced to MATLAB, or do you mean
> > > > > that you won't accept mex?
> > > >
> > > > no it's just a matter of accuracy, I ll try this OOQP stuff
> > > > and see how it works.
> > > >
> > > > Regards
> > > >
> > > >
> > >
> > > Correct, QPC is not applicable due to sparsity. clpmex
> > > should work straight out of the box, so will bpmpdmex. I
> > > think I had problems obtaining compiled versions of ooqp
> > > last time I tried.

Dear All,

I have the same problem with quadprog. It seems that my quaprog gets stuck and doesn't optimize my problem. Could you please give advice on more powerful optimization function. I did read the thread above and I could not find a straight answer as everyone seemed to use different functions. Any advice is most welcome. For example which optimization function can I use as an alternative to gradprog (without the need to compile anything). Thanks again

Subject: quadprog too slow

From: Saad

Date: 28 Nov, 2012 15:09:18

Message: 15 of 15

"Saad" wrote in message <k935lf$ele$1@newscl01ah.mathworks.com>...
> "sally" wrote in message <jtkm0j$rm2$1@newscl01ah.mathworks.com>...
> > I was able to speed up my solver significantly using the following recommendations from the documentation:
> >
> > If you have a convex problem, or if you don't know whether your problem is convex, use interior-point-convex.
> > If you have only bounds, or only linear equalities, use trust-region-reflective.
> > If you have a nonconvex problem that does not satisfy the restrictions of trust-region-reflective, use active-set.
> >
> >
> > "Min " <aliensunmin@gmail.com> wrote in message <gcdn8b$6pn$1@fred.mathworks.com>...
> > > Hi Johan,
> > >
> > > Clpmex seems to need a license. Therefore, bpmpdmex might be the only free option for large-scale sparse QP problems.
> > > However, the bpmpdmex that I downloaded only has a pre-compiled 32bit linux version.
> > > Do you know how to compile bpmpdmex for a 64bit linux machine? The reason I can'y compile it is because I do not find the source code of bpmpd and any documents on using bpmpdlib.
> > >
> > > Best,
> > > -MS
> > >
> > >
> > > "Johan L?fberg" <loefberg@control.ee.ethz.ch> wrote in message <g1m7o1$dgi$1@fred.mathworks.com>...
> > > > "hicham bouchnaif" <bouchnaif@gmail.com> wrote in message
> > > > <g1kut8$g50$1@fred.mathworks.com>...
> > > > >
> > > > > > The alternatives are interfaced to MATLAB, or do you mean
> > > > > > that you won't accept mex?
> > > > >
> > > > > no it's just a matter of accuracy, I ll try this OOQP stuff
> > > > > and see how it works.
> > > > >
> > > > > Regards
> > > > >
> > > > >
> > > >
> > > > Correct, QPC is not applicable due to sparsity. clpmex
> > > > should work straight out of the box, so will bpmpdmex. I
> > > > think I had problems obtaining compiled versions of ooqp
> > > > last time I tried.
>
> Dear All,
>
> I have the same problem with quadprog. It seems that my quaprog gets stuck and doesn't optimize my problem. Could you please give advice on more powerful optimization function. I did read the thread above and I could not find a straight answer as everyone seemed to use different functions. Any advice is most welcome. For example which optimization function can I use as an alternative to gradprog (without the need to compile anything). Thanks again


I finally found the answer to my problem and I found that the function QPC (free of use for acamedia) solve my quad programming issue.....

http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Solvers.QPC

The reason why I used it, is because quadprog was too slow and sometimes it didnt give me any output even though the optimization problem I had seemed to perfectly fit the problem that the function solves. Hope this will help others matlab users

Tags for 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