Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
CoMISo
Commits
e811b6b1
Commit
e811b6b1
authored
Feb 22, 2022
by
David Bommes
Browse files
remove regularization in OSQP solver but make sure that diagonal entries are always created
parent
00f899f7
Pipeline
#20227
failed with stages
in 12 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
NSolver/OSQPSolver.cc
View file @
e811b6b1
...
...
@@ -34,14 +34,13 @@ namespace
using
ContraintVector
=
OSQPSolver
::
ContraintVector
;
void
regularize_hessian
(
NProblemInterface
::
SMatrixNP
&
_H
)
void
regularize_hessian
(
NProblemInterface
::
SMatrixNP
&
_H
,
const
double
_reg_factor
=
1e-8
)
{
NProblemInterface
::
SMatrixNP
id
;
id
.
resize
(
_H
.
rows
(),
_H
.
cols
());
id
.
setIdentity
();
double
reg_factor
=
1e-8
;
auto
diag
=
_H
.
diagonal
();
_H
=
_H
+
reg_factor
*
diag
.
sum
()
/
diag
.
rows
()
*
id
;
// perturbation?!
_H
=
_H
+
_
reg_factor
*
diag
.
sum
()
/
diag
.
rows
()
*
id
;
// perturbation?!
}
NProblemInterface
::
SMatrixNP
get_hessian
(
NProblemInterface
*
_problem
)
...
...
@@ -49,7 +48,7 @@ NProblemInterface::SMatrixNP get_hessian(NProblemInterface* _problem)
std
::
vector
<
double
>
zero
(
_problem
->
n_unknowns
(),
0
);
NProblemInterface
::
SMatrixNP
H
;
_problem
->
eval_hessian
(
zero
.
data
(),
H
);
regularize_hessian
(
H
);
//
TODO: some docs why this is need
ed
?
regularize_hessian
(
H
,
0.0
);
//
make sure that diagonal entries are creat
ed
!
return
H
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment