-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor linear programming in convex optimization test #5122
Refactor linear programming in convex optimization test #5122
Conversation
+@david-german-tri for feature review. Review status: 0 of 13 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
+(status: curate commits before merging) Reviewed 9 of 13 files at r1. drake/solvers/BUILD, line 342 at r1 (raw file):
Rather that repeat these utils in a bunch of drake/solvers/test/add_solver_util.cc, line 16 at r1 (raw file):
BTW why not just use a (Since you're just moving pre-existing code, feel free not to change it in this PR) drake/solvers/test/CMakeLists.txt, line 32 at r1 (raw file):
BTW, I don't really care too much about CMake code health at this point, but it seems like you could make a library here too, and then use drake/solvers/test/mosek_solver_test.cc, line 16 at r1 (raw file):
BTW extra whitespace here drake/solvers/test/nonlinear_program_test.cc, line 156 at r1 (raw file):
BTW META for file: consider drake/solvers/test/optimization_examples.cc, line 26 at r1 (raw file):
"Variables of class type with static storage duration are forbidden" Consider either allocating this object with https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables drake/solvers/test/optimization_examples.cc, line 824 at r1 (raw file):
BTW Am I correctly understanding that this change adds a lot of coverage for symbolic costs and constraints? Nice! drake/solvers/test/optimization_examples.cc, line 880 at r1 (raw file):
This approach rolls up a ton of test coverage into one GTest case, which means that failures will not be very diagnostic: future developers will have a hard time determining which program, cost, and constraint form they broke. To fix this, I'd suggest replacing this function with a value-parameterized base class test fixture. For each solver, you'd then have
I know that sounds a little hairy, but I think it's actually a pretty small change from what you already have. Essentially your
|
Review status: 6 of 13 files reviewed at latest revision, 8 unresolved discussions. drake/solvers/BUILD, line 342 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. Thanks! I did not know we can add a testonly library. drake/solvers/test/add_solver_util.cc, line 16 at r1 (raw file): Previously, david-german-tri (David German) wrote…
I agree, but I am going to remove this file after another one or two PRs (https://github.com/RobotLocomotion/drake/pull/5122/files#diff-d0303f4358e2c08dc7c37920a852a20d), so I did not change this code drake/solvers/test/CMakeLists.txt, line 32 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. drake/solvers/test/mosek_solver_test.cc, line 16 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. drake/solvers/test/nonlinear_program_test.cc, line 156 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. drake/solvers/test/optimization_examples.cc, line 26 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. drake/solvers/test/optimization_examples.cc, line 824 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. Yes, that is the purpose, and I actually find bugs in our code with this coverage. Will fix these bugs in my next PR. drake/solvers/test/optimization_examples.cc, line 880 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. Thanks for the suggestion! Comments from Reviewable |
@drake-jenkins-bot linux-gcc-experimental-matlab please Review status: 6 of 13 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. Comments from Reviewable |
Review status: 6 of 13 files reviewed at latest revision, 4 unresolved discussions. drake/solvers/test/optimization_examples.cc, line 880 at r1 (raw file): Previously, hongkai-dai (Hongkai Dai) wrote…
@david-german-tri , I used Comments from Reviewable |
Reviewed 7 of 7 files at r2. drake/solvers/BUILD, line 126 at r2 (raw file):
META: this is no longer needed post #5155 drake/solvers/test/optimization_examples.cc, line 880 at r1 (raw file): Previously, hongkai-dai (Hongkai Dai) wrote…
This is an improvement, but wasn't quite what I meant. I was proposing that the parameter is a tuple of
Either of these avoids the Comments from Reviewable |
Review status: 8 of 13 files reviewed at latest revision, 2 unresolved discussions. drake/solvers/BUILD, line 126 at r2 (raw file): Previously, david-german-tri (David German) wrote…
Done. drake/solvers/test/optimization_examples.cc, line 880 at r1 (raw file): Previously, david-german-tri (David German) wrote…
Done. Thanks for the suggestion, I used enum approach. Comments from Reviewable |
Reviewed 5 of 5 files at r3. drake/solvers/test/mosek_solver_test.cc, line 28 at r3 (raw file):
BTW weird indent here (not worth re-running CI just for this, though) Comments from Reviewable |
+@jwnimmer-tri for platform review. Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
I can look, but would probably be on Friday (my on-call day). |
@david-german-tri , would you like to serve as a platform reviewer for this PR? Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
I think a second review is appropriate, but feel free to pick someone who isn't a platform reviewer. |
+@sammy-tri for platform review. -@jwnimmer-tri for platform review. Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Partial pass completed. Will resume later this afternoon. Reviewed 5 of 13 files at r1, 1 of 7 files at r2, 3 of 5 files at r3. drake/solvers/test/CMakeLists.txt, line 27 at r3 (raw file):
Why are we creating an empty variable here? Comments from Reviewable |
Reviewed 1 of 13 files at r1, 1 of 7 files at r2, 2 of 5 files at r3. Comments from Reviewable |
Review status: 10 of 13 files reviewed at latest revision, 2 unresolved discussions. drake/solvers/test/CMakeLists.txt, line 27 at r3 (raw file): Previously, sammy-tri (Sam Creasey) wrote…
Done. drake/solvers/test/mosek_solver_test.cc, line 28 at r3 (raw file): Previously, david-german-tri (David German) wrote…
Done. Comments from Reviewable |
Reviewed 3 of 3 files at r4. Comments from Reviewable |
-(status: curate commits before merging) Review status: all files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
…ion#5122) * WIP: refactor tests * refactor linear program tests, get segfault * more LP tests refactored * cmake compiles and runs, the linear program is refactored * minor change * WIP: bazel build fix * Bazel builds * add bazel test for gurobi_solver_test * cpplint * forgot to upload some files * minor fix * Address David's comments * Use parameter test * cpplint * fix a bug * Address David's comments * Address reviewers' comments
The goal is to have separate test scripts
gurobi_solver_test.cc
andmosek_solver_test.cc
, as mentioned in https://github.com/RobotLocomotion/drake/blob/master/drake/solvers/BUILD#L233. This is the first step, just refactored the linear programs inconvex_optimization_test
. I will continue to refactor the QP, SOCP and SDP in the test.This PR exceeds 500 lines. But many of them are existing code, no math is changed.
This change is