Skip to content

Commit 5bbaa67

Browse files
committed
naming harmonization
1 parent bf2fd50 commit 5bbaa67

File tree

13 files changed

+82
-81
lines changed

13 files changed

+82
-81
lines changed

benchmark/timings-diagonal-hessian.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ main(int /*argc*/, const char** /*argv*/)
7474
n_in,
7575
true,
7676
proxsuite::proxqp::DenseBackend::PrimalDualLDLT,
77-
proxsuite::proxqp::HESSIAN_TYPE::DIAGONAL };
77+
proxsuite::proxqp::HessianType::Diagonal };
7878
qp.settings.eps_abs = eps_abs;
7979
qp.settings.eps_rel = 0;
8080
// qp.settings.verbose = true;
@@ -112,7 +112,7 @@ main(int /*argc*/, const char** /*argv*/)
112112
n_in,
113113
true,
114114
proxsuite::proxqp::DenseBackend::PrimalDualLDLT,
115-
proxsuite::proxqp::HESSIAN_TYPE::DENSE
115+
proxsuite::proxqp::HessianType::Dense
116116
};
117117
qp_compare.settings.eps_abs = eps_abs;
118118
qp_compare.settings.eps_rel = 0;

benchmark/timings-lp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ main(int /*argc*/, const char** /*argv*/)
4646
elapsed_time = 0.0;
4747
timer.stop();
4848
proxqp::dense::QP<T> qp{
49-
dim, n_eq, n_in, false, proxqp::HESSIAN_TYPE::ZERO
49+
dim, n_eq, n_in, false, proxqp::HessianType::Zero
5050
};
5151
qp.settings.eps_abs = eps_abs;
5252
qp.settings.eps_rel = 0;
@@ -77,7 +77,7 @@ main(int /*argc*/, const char** /*argv*/)
7777

7878
elapsed_time = 0.0;
7979
proxqp::dense::QP<T> qp_compare{
80-
dim, n_eq, n_in, false, proxqp::HESSIAN_TYPE::DENSE
80+
dim, n_eq, n_in, false, proxqp::HessianType::Dense
8181
};
8282
qp_compare.settings.eps_abs = eps_abs;
8383
qp_compare.settings.eps_rel = 0;

bindings/python/src/expose-qpobject.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ exposeQpObjectDense(pybind11::module_ m)
3030
.value("PrimalLDLT", DenseBackend::PrimalLDLT)
3131
.export_values();
3232

33-
::pybind11::enum_<HESSIAN_TYPE>(m, "hessian_type", pybind11::module_local())
34-
.value("DENSE", proxsuite::proxqp::HESSIAN_TYPE::DENSE)
35-
.value("ZERO", proxsuite::proxqp::HESSIAN_TYPE::ZERO)
36-
.value("DIAGONAL", proxsuite::proxqp::HESSIAN_TYPE::DIAGONAL)
33+
::pybind11::enum_<HessianType>(m, "HessianType", pybind11::module_local())
34+
.value("Dense", proxsuite::proxqp::HessianType::Dense)
35+
.value("Zero", proxsuite::proxqp::HessianType::Zero)
36+
.value("Diagonal", proxsuite::proxqp::HessianType::Diagonal)
3737
.export_values();
3838

3939
::pybind11::class_<dense::QP<T>>(m, "QP")
@@ -42,7 +42,7 @@ exposeQpObjectDense(pybind11::module_ m)
4242
i64,
4343
i64,
4444
bool,
45-
proxsuite::proxqp::HESSIAN_TYPE,
45+
proxsuite::proxqp::HessianType,
4646
proxsuite::proxqp::DenseBackend>(),
4747
pybind11::arg_v("n", 0, "primal dimension."),
4848
pybind11::arg_v("n_eq", 0, "number of equality constraints."),
@@ -52,8 +52,8 @@ exposeQpObjectDense(pybind11::module_ m)
5252
false,
5353
"specify or not that the QP has box inequality constraints."),
5454
pybind11::arg_v("hessian_type",
55-
proxsuite::proxqp::HESSIAN_TYPE::DENSE,
56-
"specify the problem type to be solved."),
55+
proxsuite::proxqp::HessianType::Dense,
56+
"specify the problem type to be solved."),
5757
pybind11::arg_v("dense_backend",
5858
proxsuite::proxqp::DenseBackend::Automatic,
5959
"specify which backend using for solving the problem."),

doc/2-PROXQP_API/2-ProxQP_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ In this table you have on the three columns from left to right: the name of the
395395
| safe_guard | 1.E4 | Safeguard parameter ensuring global convergence of the scheme. More precisely, if the total number of iteration is superior to safe_guard, the BCL scheme accept always the multipliers (hence the scheme is a pure proximal point algorithm).
396396
| preconditioner_max_iter | 10 | Maximal number of authorized iterations for the preconditioner.
397397
| preconditioner_accuracy | 1.E-3 | Accuracy level of the preconditioner.
398-
| HESSIAN_TYPE | DENSE | Defines the type of problem solved (DENSE, ZERO or DIAGONAL). In case ZERO or DIAGONAL option are used, the solver optimize perform internally linear algebra operations involving the Hessian H.
398+
| HessianType | Dense | Defines the type of problem solved (Dense, Zero or Diagonal). In case Zero or Diagonal option are used, the solver optimize perform internally linear algebra operations involving the Hessian H.
399399

400400
\subsection OverviewInitialGuess The different initial guesses
401401

examples/python/solve_dense_lp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
n=g.shape[0],
2424
n_eq=0,
2525
n_in=u.shape[0],
26-
hessian_type=proxsuite.proxqp.dense.hessian_type.ZERO,
26+
# box_constraints = False,
27+
hessian_type=proxsuite.proxqp.dense.HessianType.Zero,
2728
)
2829
problem.settings.eps_abs = 1.0e-9
2930
problem.init(None, g, None, None, C, None, u)

include/proxsuite/proxqp/dense/helpers.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ compute_equality_constrained_initial_guess(Workspace<T>& qpwork,
3737
const Model<T>& qpmodel,
3838
const isize n_constraints,
3939
const DenseBackend& dense_backend,
40-
const HESSIAN_TYPE& hessian_type,
40+
const HessianType& hessian_type,
4141
Results<T>& qpresults)
4242
{
4343

@@ -76,21 +76,21 @@ setup_factorization(Workspace<T>& qpwork,
7676
const Model<T>& qpmodel,
7777
Results<T>& qpresults,
7878
const DenseBackend& dense_backend,
79-
const HESSIAN_TYPE& hessian_type)
79+
const HessianType& hessian_type)
8080
{
8181

8282
proxsuite::linalg::veg::dynstack::DynStackMut stack{
8383
proxsuite::linalg::veg::from_slice_mut,
8484
qpwork.ldl_stack.as_mut(),
8585
};
8686
switch (hessian_type) {
87-
case HESSIAN_TYPE::DENSE:
87+
case HessianType::Dense:
8888
qpwork.kkt.topLeftCorner(qpmodel.dim, qpmodel.dim) = qpwork.H_scaled;
8989
break;
90-
case HESSIAN_TYPE::ZERO:
90+
case HessianType::Zero:
9191
qpwork.kkt.topLeftCorner(qpmodel.dim, qpmodel.dim).setZero();
9292
break;
93-
case HESSIAN_TYPE::DIAGONAL:
93+
case HessianType::Diagonal:
9494
qpwork.kkt.topLeftCorner(qpmodel.dim, qpmodel.dim) = qpwork.H_scaled;
9595
break;
9696
}
@@ -134,7 +134,7 @@ void
134134
setup_equilibration(Workspace<T>& qpwork,
135135
const Settings<T>& qpsettings,
136136
const bool box_constraints,
137-
const HESSIAN_TYPE hessian_type,
137+
const HessianType hessian_type,
138138
preconditioner::RuizEquilibration<T>& ruiz,
139139
bool execute_preconditioner)
140140
{
@@ -349,7 +349,7 @@ setup( //
349349
const bool box_constraints,
350350
preconditioner::RuizEquilibration<T>& ruiz,
351351
PreconditionerStatus preconditioner_status,
352-
const HESSIAN_TYPE hessian_type)
352+
const HessianType hessian_type)
353353
{
354354

355355
switch (qpsettings.initial_guess) {
@@ -445,12 +445,12 @@ setup( //
445445
// zero shape
446446
assert(qpmodel.is_valid(box_constraints));
447447
switch (hessian_type) {
448-
case HESSIAN_TYPE::ZERO:
448+
case HessianType::Zero:
449449
break;
450-
case HESSIAN_TYPE::DENSE:
450+
case HessianType::Dense:
451451
qpwork.H_scaled = qpmodel.H;
452452
break;
453-
case HESSIAN_TYPE::DIAGONAL:
453+
case HessianType::Diagonal:
454454
qpwork.H_scaled = qpmodel.H;
455455
break;
456456
}

include/proxsuite/proxqp/dense/preconditioner/ruiz.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ruiz_scale_qp_in_place( //
3535
T epsilon,
3636
isize max_iter,
3737
Symmetry sym,
38-
HESSIAN_TYPE hessian_type,
38+
HessianType HessianType,
3939
const bool box_constraints,
4040
proxsuite::linalg::veg::dynstack::DynStackMut stack) -> T
4141
{
@@ -89,8 +89,8 @@ ruiz_scale_qp_in_place( //
8989
}
9090
// normalization vector
9191
{
92-
switch (hessian_type) {
93-
case HESSIAN_TYPE::ZERO:
92+
switch (HessianType) {
93+
case HessianType::Zero:
9494
for (isize k = 0; k < n; ++k) {
9595
T aux = sqrt(std::max({ n_eq > 0 ? infty_norm(A.col(k)) : T(0),
9696
n_in > 0 ? infty_norm(C.col(k)) : T(0),
@@ -102,7 +102,7 @@ ruiz_scale_qp_in_place( //
102102
}
103103
}
104104
break;
105-
case HESSIAN_TYPE::DENSE:
105+
case HessianType::Dense:
106106
for (isize k = 0; k < n; ++k) {
107107
switch (sym) {
108108
case Symmetry::upper: { // upper triangular part
@@ -151,7 +151,7 @@ ruiz_scale_qp_in_place( //
151151
}
152152
}
153153
break;
154-
case HESSIAN_TYPE::DIAGONAL:
154+
case HessianType::Diagonal:
155155
for (isize k = 0; k < n; ++k) {
156156
T aux = sqrt(std::max({ std::abs(H(k, k)),
157157
n_eq > 0 ? infty_norm(A.col(k)) : T(0),
@@ -206,10 +206,10 @@ ruiz_scale_qp_in_place( //
206206
l.array() *= delta.segment(n + n_eq, n_in).array();
207207

208208
// normalize H
209-
switch (hessian_type) {
210-
case HESSIAN_TYPE::ZERO:
209+
switch (HessianType) {
210+
case HessianType::Zero:
211211
break;
212-
case HESSIAN_TYPE::DENSE:
212+
case HessianType::Dense:
213213
switch (sym) {
214214
case Symmetry::upper: {
215215
// upper triangular part
@@ -273,7 +273,7 @@ ruiz_scale_qp_in_place( //
273273
break;
274274
}
275275
break;
276-
case HESSIAN_TYPE::DIAGONAL:
276+
case HessianType::Diagonal:
277277
// H = delta.head(n).asDiagonal() * H.asDiagonal() *
278278
// delta.head(n).asDiagonal();
279279
H.diagonal().array() *=
@@ -392,7 +392,7 @@ struct RuizEquilibration
392392
bool execute_preconditioner,
393393
const isize max_iter,
394394
const T epsilon,
395-
const HESSIAN_TYPE& hessian_type,
395+
const HessianType& HessianType,
396396
const bool box_constraints,
397397
proxsuite::linalg::veg::dynstack::DynStackMut stack)
398398
{
@@ -404,7 +404,7 @@ struct RuizEquilibration
404404
epsilon,
405405
max_iter,
406406
sym,
407-
hessian_type,
407+
HessianType,
408408
box_constraints,
409409
stack);
410410
} else {
@@ -429,8 +429,8 @@ struct RuizEquilibration
429429
delta.head(n).asDiagonal();
430430

431431
// normalize H
432-
switch (hessian_type) {
433-
case HESSIAN_TYPE::DENSE:
432+
switch (HessianType) {
433+
case HessianType::Dense:
434434
switch (sym) {
435435
case Symmetry::upper: {
436436
// upper triangular part
@@ -464,9 +464,9 @@ struct RuizEquilibration
464464
}
465465
break;
466466

467-
case HESSIAN_TYPE::ZERO:
467+
case HessianType::Zero:
468468
break;
469-
case HESSIAN_TYPE::DIAGONAL:
469+
case HessianType::Diagonal:
470470
// H = delta.head(n).asDiagonal() * H.asDiagonal() *
471471
// delta.head(n).asDiagonal();
472472
H.diagonal().array() *=

include/proxsuite/proxqp/dense/solver.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,21 @@ iterative_residual(const Model<T>& qpmodel,
244244
Workspace<T>& qpwork,
245245
const isize n_constraints,
246246
isize inner_pb_dim,
247-
const HESSIAN_TYPE& hessian_type)
247+
const HessianType& hessian_type)
248248
{
249249
auto& Hdx = qpwork.Hdx;
250250
auto& Adx = qpwork.Adx;
251251
auto& ATdy = qpwork.CTz;
252252
qpwork.err.head(inner_pb_dim) = qpwork.rhs.head(inner_pb_dim);
253253
switch (hessian_type) {
254-
case HESSIAN_TYPE::ZERO:
254+
case HessianType::Zero:
255255
break;
256-
case HESSIAN_TYPE::DENSE:
256+
case HessianType::Dense:
257257
Hdx.noalias() = qpwork.H_scaled.template selfadjointView<Eigen::Lower>() *
258258
qpwork.dw_aug.head(qpmodel.dim);
259259
qpwork.err.head(qpmodel.dim).noalias() -= Hdx;
260260
break;
261-
case HESSIAN_TYPE::DIAGONAL:
261+
case HessianType::Diagonal:
262262
Hdx.array() = qpwork.H_scaled.diagonal().array() *
263263
qpwork.dw_aug.head(qpmodel.dim).array();
264264
qpwork.err.head(qpmodel.dim).noalias() -= Hdx;
@@ -404,7 +404,7 @@ iterative_solve_with_permut_fact( //
404404
Workspace<T>& qpwork,
405405
const isize n_constraints,
406406
const DenseBackend& dense_backend,
407-
const HESSIAN_TYPE& hessian_type,
407+
const HessianType& hessian_type,
408408
T eps,
409409
isize inner_pb_dim)
410410
{
@@ -746,7 +746,7 @@ primal_dual_semi_smooth_newton_step(const Settings<T>& qpsettings,
746746
const bool box_constraints,
747747
const isize n_constraints,
748748
const DenseBackend& dense_backend,
749-
const HESSIAN_TYPE& hessian_type,
749+
const HessianType& hessian_type,
750750
T eps)
751751
{
752752

@@ -877,7 +877,7 @@ primal_dual_newton_semi_smooth(const Settings<T>& qpsettings,
877877
const isize n_constraints,
878878
preconditioner::RuizEquilibration<T>& ruiz,
879879
const DenseBackend& dense_backend,
880-
const HESSIAN_TYPE& hessian_type,
880+
const HessianType& hessian_type,
881881
T eps_int)
882882
{
883883

@@ -983,15 +983,15 @@ primal_dual_newton_semi_smooth(const Settings<T>& qpsettings,
983983
qpresults.y += alpha * dy;
984984
qpresults.z += alpha * dz;
985985
switch (hessian_type) {
986-
case HESSIAN_TYPE::ZERO:
986+
case HessianType::Zero:
987987
qpwork.dual_residual_scaled +=
988988
alpha * (qpresults.info.rho * dx + ATdy + CTdz);
989989
break;
990-
case HESSIAN_TYPE::DENSE:
990+
case HessianType::Dense:
991991
qpwork.dual_residual_scaled +=
992992
alpha * (qpresults.info.rho * dx + Hdx + ATdy + CTdz);
993993
break;
994-
case HESSIAN_TYPE::DIAGONAL:
994+
case HessianType::Diagonal:
995995
qpwork.dual_residual_scaled +=
996996
alpha * (qpresults.info.rho * dx + Hdx + ATdy + CTdz);
997997
break;
@@ -1096,7 +1096,7 @@ qp_solve( //
10961096
Workspace<T>& qpwork,
10971097
const bool box_constraints,
10981098
const DenseBackend& dense_backend,
1099-
const HESSIAN_TYPE& hessian_type,
1099+
const HessianType& hessian_type,
11001100
preconditioner::RuizEquilibration<T>& ruiz)
11011101
{
11021102
/*** TEST WITH MATRIX FULL OF NAN FOR DEBUG
@@ -1190,12 +1190,12 @@ qp_solve( //
11901190
if (qpsettings.initial_guess !=
11911191
InitialGuessStatus::WARM_START_WITH_PREVIOUS_RESULT) {
11921192
switch (hessian_type) {
1193-
case HESSIAN_TYPE::ZERO:
1193+
case HessianType::Zero:
11941194
break;
1195-
case HESSIAN_TYPE::DENSE:
1195+
case HessianType::Dense:
11961196
qpwork.H_scaled = qpmodel.H;
11971197
break;
1198-
case HESSIAN_TYPE::DIAGONAL:
1198+
case HessianType::Diagonal:
11991199
qpwork.H_scaled = qpmodel.H;
12001200
break;
12011201
}

0 commit comments

Comments
 (0)