MCPcopy Create free account
hub / github.com/Simple-Robotics/aligator / randomlyModifyProblem

Function randomlyModifyProblem

tests/gar/parallel.cpp:173–183  ·  view source on GitHub ↗

Randomize some of the parameters of the problem. This simulates something like updating the LQ problem in SQP.

Source from the content-addressed store, hash-verified

171/// Randomize some of the parameters of the problem. This simulates something
172/// like updating the LQ problem in SQP.
173void randomlyModifyProblem(std::mt19937 rng, problem_t &prob) {
174 normal_unary_op normal_op{rng, 0.1};
175 auto N = size_t(prob.horizon());
176 std::vector<size_t> idx = {0, N / 3, N / 2, N / 2 + 1, N / 2 + 2, N};
177 for (auto i : idx) {
178 auto &kn = prob.stages.at(i);
179 kn.A += MatrixXs::NullaryExpr(kn.nx, kn.nx, normal_op);
180 kn.B += MatrixXs::NullaryExpr(kn.nx, kn.nu, normal_op);
181 kn.q += VectorXs::NullaryExpr(kn.nx, normal_op);
182 }
183}
184
185TEST_CASE("parallel_solver_class", "[gar]") {
186 std::mt19937 rng{Catch::getSeed()};

Callers 1

parallel.cppFile · 0.85

Calls 1

horizonMethod · 0.80

Tested by

no test coverage detected