Randomize some of the parameters of the problem. This simulates something like updating the LQ problem in SQP.
| 171 | /// Randomize some of the parameters of the problem. This simulates something |
| 172 | /// like updating the LQ problem in SQP. |
| 173 | void 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 | |
| 185 | TEST_CASE("parallel_solver_class", "[gar]") { |
| 186 | std::mt19937 rng{Catch::getSeed()}; |