Could I set 'd' as dense matrix?
when write d as set_d(), now it work only diagonal shape.
How can i reform this shape like
d =
[
1.0037 -0.9975 0.0014 0.0005 0
-0.9975 2.0018 -0.9989 0.0004 0
0.0014 -0.9989 2.0007 -0.9997 0
0.0005 0.0004 -0.9997 2.0001 -1.0000
0 0 0 -1.0000 1.0000
]
I want solve this equation, 0.5 X' d X + cX + c0
and, why this method is not working?
qp.set_d(0,0,1); qp.set_d(0,1,1); qp.set_d(0,2,0);
qp.set_d(1,0,1); qp.set_d(1,1,1); qp.set_d(1,2,0);
qp.set_d(2,0,1); qp.set_d(2,1,1); qp.set_d(2,2,1);
Could you please add more context?
I add more context, please save me--!
What do you mean by "it doesn't not work"?
set_d(i, j) should also only be used with j <= i, see its documentation.
I add more context, please save me--!
What do you mean by "it doesn't not work"?
set_d(i, j)should also only be used withj <= i, see its documentation.
Thanks you!
If i wanna do this, should I use other library...?
What I meant was that D can be a dense matrix, but since it is symmetrical, calling it with j > i is pointless.
What is your error?
What I meant was that
Dcan be a dense matrix, but since it is symmetrical, calling it withj > iis pointless.What is your error?
My 'd' is like that
d =
[
1.0037 -0.9975 0.0014 0.0005 0
-0.9975 2.0018 -0.9989 0.0004 0
0.0014 -0.9989 2.0007 -0.9997 0
0.0005 0.0004 -0.9997 2.0001 -1.0000
0 0 0 -1.0000 1.0000
]
It's not symmetrical.
How can i operate the solver by using this 'd'?
( And, the error what i saw is ' j > i' )
The matrix you gave is symmetric.
Just fill the coefficients (i,j), with j <= i and the other ones will be set up automatically.
Important: set_d() actually sets the coefficients of the matrix 2 * D with D in the formulation at the top of the doc.
The matrix you gave is symmetric.
Just fill the coefficients
(i,j), withj <= iand the other ones will be set up automatically.Important:
set_d()actually sets the coefficients of the matrix2 * DwithDin the formulation at the top of the doc.
Oh Thanks!!
It's working. 👍
But, I have one question.
At first, when my code is not working, I merged 'l <= x <= u' to 'Ax <= b'.
For example,
set_a
=
[ 1 0
0 1
-1 0
0 -1
].transpose()
set_b
=
[
0.5
0.5
-0.5
-0.5
]
But, It's not working. So, when I separated it as 'set_l' and 'set_u', It working. For example
set_l
=
[
-0.5
-0.5
]
set_u
=
[
0.5
0.5
]
.
Why it is not working when I merge the variable set_l and set_u as set_a and set_b ?
The matrix A is an m x n matrix, with m the number of constraints and n the number of variables. With your (transposed) set_a, the matrix is an n x m matrix.
Note that the function set_a() has signature set_a(j, i) to write the coefficient A(i, j).