MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / tiny_set_bound_constraints

Function tiny_set_bound_constraints

src/tinympc/tiny_api.cpp:149–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149int tiny_set_bound_constraints(TinySolver* solver,
150 tinyMatrix x_min, tinyMatrix x_max,
151 tinyMatrix u_min, tinyMatrix u_max) {
152 if (!solver) {
153 std::cout << "Error in tiny_set_bound_constraints: solver is nullptr" << std::endl;
154 return 1;
155 }
156
157 // Make sure all bound constraint matrix sizes are self-consistent
158 int status = 0;
159 status |= check_dimension("Lower state bounds (x_min)", "rows", x_min.rows(), solver->work->nx);
160 status |= check_dimension("Lower state bounds (x_min)", "cols", x_min.cols(), solver->work->N);
161 status |= check_dimension("Lower state bounds (x_max)", "rows", x_max.rows(), solver->work->nx);
162 status |= check_dimension("Lower state bounds (x_max)", "cols", x_max.cols(), solver->work->N);
163 status |= check_dimension("Lower input bounds (u_min)", "rows", u_min.rows(), solver->work->nu);
164 status |= check_dimension("Lower input bounds (u_min)", "cols", u_min.cols(), solver->work->N-1);
165 status |= check_dimension("Lower input bounds (u_max)", "rows", u_max.rows(), solver->work->nu);
166 status |= check_dimension("Lower input bounds (u_max)", "cols", u_max.cols(), solver->work->N-1);
167
168 solver->work->x_min = x_min;
169 solver->work->x_max = x_max;
170 solver->work->u_min = u_min;
171 solver->work->u_max = u_max;
172
173 return 0;
174}
175
176int tiny_set_cone_constraints(TinySolver* solver,
177 VectorXi Acx, VectorXi qcx, tinyVector cx,

Callers 6

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 3

check_dimensionFunction · 0.85
rowsMethod · 0.45
colsMethod · 0.45

Tested by

no test coverage detected