A bit of help with the Quadratic Programming solver

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

A bit of help with the Quadratic Programming solver

Al Mo
Hi everyone,

This is the first time I'm using CGAL's QP solver and I ran into an issue where I don't get the expected result in a very simple scenario.

I put everything on a document so it's easier for you to check it out (including minimal source code). The document is here: https://www.docdroid.net/jEFGEEt/cgal-qp.pdf (I didn't want to attach it, as I don't know if that's allowed)

If someone could take a quick look at it and help me out I will greatly appreciate it. It may be something very trivial that I missed.

Thank you all and best regards,
Alex.

Reply | Threaded
Open this post in threaded view
|

Re: A bit of help with the Quadratic Programming solver

MaelRL
Hello,

'D' must be a symmetric matrix
(https://doc.cgal.org/latest/QP_solver/classCGAL_1_1Quadratic__program__from__iterators.html).
Thus you matrix D should be

( 2 0.5
( 0.5 1)

and not

(2 0)
(1 1)

That means:

   double  D1[] = { 4.0, 1.0 };
   double  D2[] = { 1.0, 2.0 };

and then you get

   double  D1[] = { 4.0, 1.0 };
   double  D2[] = { 1.0, 2.0 };

Best,
Mael

On 12/06/2019 01:25, Al Mo wrote:

> Hi everyone,
>
> This is the first time I'm using CGAL's QP solver and I ran into an
> issue where I don't get the expected result in a very simple scenario.
>
> I put everything on a document so it's easier for you to check it out
> (including minimal source code). The document is here:
> https://www.docdroid.net/jEFGEEt/cgal-qp.pdf (I didn't want to attach
> it, as I don't know if that's allowed)
>
> If someone could take a quick look at it and help me out I will
> greatly appreciate it. It may be something very trivial that I missed.
>
> Thank you all and best regards,
> Alex.
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: A bit of help with the Quadratic Programming solver

MaelRL
Bad copy paste, I meant :

status:          OPTIMAL
objective value: 60/32
variable values:
   0: 1/4
   1: 3/4

On 17/06/2019 09:16, Mael wrote:

> Hello,
>
> 'D' must be a symmetric matrix
> (https://doc.cgal.org/latest/QP_solver/classCGAL_1_1Quadratic__program__from__iterators.html).
> Thus you matrix D should be
>
> ( 2 0.5
> ( 0.5 1)
>
> and not
>
> (2 0)
> (1 1)
>
> That means:
>
>   double  D1[] = { 4.0, 1.0 };
>   double  D2[] = { 1.0, 2.0 };
>
> and then you get
>
>   double  D1[] = { 4.0, 1.0 };
>   double  D2[] = { 1.0, 2.0 };
>
> Best,
> Mael
>
> On 12/06/2019 01:25, Al Mo wrote:
>> Hi everyone,
>>
>> This is the first time I'm using CGAL's QP solver and I ran into an
>> issue where I don't get the expected result in a very simple scenario.
>>
>> I put everything on a document so it's easier for you to check it out
>> (including minimal source code). The document is here:
>> https://www.docdroid.net/jEFGEEt/cgal-qp.pdf (I didn't want to attach
>> it, as I don't know if that's allowed)
>>
>> If someone could take a quick look at it and help me out I will
>> greatly appreciate it. It may be something very trivial that I missed.
>>
>> Thank you all and best regards,
>> Alex.
>>
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: A bit of help with the Quadratic Programming solver

Marc Glisse
In reply to this post by MaelRL
On Mon, 17 Jun 2019, Mael wrote:

> 'D' must be a symmetric matrix
> (https://doc.cgal.org/latest/QP_solver/classCGAL_1_1Quadratic__program__from__iterators.html).

Is there code to check this in debug mode? It looks like there is at least
some check in the _mps version.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: A bit of help with the Quadratic Programming solver

Al Mo
Thank you all,

My confusion arised when in the sample code (https://doc.cgal.org/latest/QP_solver/index.html : 3.3 Constructing a Program from Iterators
) you only define one element for D1. Then I thought, "well, since the upper part is ignored, they are probably taking it as zeroes and I need to put everything in the lower part of D to compensate". Now I see, that was a wrong assumption. Thank you for clearing up this.

While it is mentioned explicitly in the documentation:

"> D is a symmetric positive-semidefinite n×n matrix (the quadratic objective function)"

Maybe adding small note later to remind us that the ignored values are taken as their symmetric counterpart would be helpful for newcomers.

Best to all and thanks again!

On Mon, Jun 17, 2019 at 10:48 AM Marc Glisse <[hidden email]> wrote:
On Mon, 17 Jun 2019, Mael wrote:

> 'D' must be a symmetric matrix
> (https://doc.cgal.org/latest/QP_solver/classCGAL_1_1Quadratic__program__from__iterators.html).

Is there code to check this in debug mode? It looks like there is at least
some check in the _mps version.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss