alpaqa 0.0.1
Nonconvex constrained optimization
problem.cpp
Go to the documentation of this file.
2
3namespace alpaqa {
4
6 work.resize(original.m);
7 this->n = original.n;
8 this->m = original.m + original.n;
9 this->f = [this](crvec x) { return original.f(x); };
10 this->grad_f = [this](crvec x, rvec grad) { original.grad_f(x, grad); };
11 this->g = [this](crvec x, rvec gg) {
12 original.g(x, work);
13 gg.topRows(original.m) = work;
14 gg.bottomRows(original.n) = x;
15 };
16 this->grad_g_prod = [this](crvec x, crvec y, rvec gg) {
17 work = y.topRows(original.m);
19 gg += y.bottomRows(original.n);
20 };
21 this->grad_gi = [](crvec, unsigned, rvec) {
22 throw std::logic_error("ProblemOnlyD::grad_gi: Not implemented");
23 };
24 this->hess_L_prod = [](crvec, crvec, crvec, rvec) {
25 throw std::logic_error("ProblemOnlyD::hess_L_prod: Not implemented");
26 };
27 this->hess_L = [](crvec, crvec, rmat) {
28 throw std::logic_error("ProblemOnlyD::hess_L: Not implemented");
29 };
30 this->C.lowerbound = vec::Constant(original.n, -inf);
31 this->C.upperbound = vec::Constant(original.n, +inf);
32 this->D.lowerbound.resize(this->m);
33 this->D.upperbound.resize(this->m);
34 this->D.lowerbound.topRows(original.m) = original.D.lowerbound;
35 this->D.lowerbound.bottomRows(original.n) = original.C.lowerbound;
36 this->D.upperbound.topRows(original.m) = original.D.upperbound;
37 this->D.upperbound.bottomRows(original.n) = original.C.upperbound;
38}
39
40} // namespace alpaqa
Eigen::Ref< const vec > crvec
Default type for immutable references to vectors.
Definition: vec.hpp:18
constexpr real_t inf
Definition: vec.hpp:26
vec upperbound
Definition: box.hpp:8
vec lowerbound
Definition: box.hpp:9
Eigen::Ref< mat > rmat
Default type for mutable references to matrices.
Definition: vec.hpp:22
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Definition: vec.hpp:16
Box C
Constraints of the decision variables, .
std::function< hess_L_sig > hess_L
Hessian of the Lagrangian function .
std::function< f_sig > f
Cost function .
std::function< grad_gi_sig > grad_gi
Gradient of a specific constraint .
unsigned int m
Number of constraints, dimension of g(x) and z.
std::function< grad_f_sig > grad_f
Gradient of the cost function .
unsigned int n
Number of decision variables, dimension of x.
std::function< hess_L_prod_sig > hess_L_prod
Hessian of the Lagrangian function times vector .
std::function< g_sig > g
Constraint function .
Box D
Other constraints, .
std::function< grad_g_prod_sig > grad_g_prod
Gradient of the constraint function times vector .