Closed baharehhj closed 9 months ago
Hi @baharehhj, thanks for the issue.
First of all, let me remark that this repo is only a C++ interface to the ospq
solver. So for a more dedicated support, I would suggest you to open a ticket in the upstream repo: https://github.com/osqp/osqp
Nonetheless, I would suggest you to check the rank of H. If the Hessian is singular, there could be infinite minima. This might explain why the optimal cost value is very close in the two cases but with very different values for the variables.
Hi, @S-Dafarra, thank you for your reply.
I apologize for the delay. I will consider asking it in the repository you recommended.
I will check if the Hessian matrix is singular. I corrected the lower bound constraint but I still did not get the same answer as matlab and it is important for me to get the same answer.
Thanks again for your assistance.
disp(options); quadprog options:
Options used by current Algorithm ('interior-point-convex'): (Other available algorithms: 'active-set', 'trust-region-reflective')
Set properties: No options set.
Default properties: Algorithm: 'interior-point-convex' ConstraintTolerance: 1.0000e-08 Display: 'final' LinearSolver: 'auto' MaxIterations: 200 OptimalityTolerance: 1.0000e-08 StepTolerance: 1.0000e-12
these are setting for guadprog function in matlab
Hello,
I have implemented the "quadprog" function in MATLAB using the library you provided. I expect that my C++ code will yield the same answer as the MATLAB function. I anticipate that the solution in C++ will match the 'x' variable in MATLAB, but it is different. However, the optimal objective is close to the 'fval' value in MATLAB. It is important to have same answer as matlab. Am I doing something wrong? I appreciate any help.
matlab code
part of expected answer: fval:-65600.5031027019
c++ code
answer in terminal
4.78641 1.06484 27.2492 20.226 13.5775 10.0481 1.06484 1.06484 106.544 204.121 151.687 45.4514 23.29 14.5737 2.85424 1.06484 1.06484 1651.04 2681.07 2667.71 2488.53 746.985 47.8401 27.2042 8.38749 1.06484 1.06484 1025.8 2629.15 2638.96 2218.94 2187.01 2092.31 71.3086 23.6676 11.7751 1.06484 1.06484 525.9 2690.49 2671.57 2533.4 2345.48 2101.57