Skip to content

Commit

Permalink
solvers: Remove uses of spruce (RobotLocomotion#12178)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri authored Oct 10, 2019
1 parent e15a497 commit a4d79f3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,9 @@ drake_cc_googletest(
deps = [
":csdp_test_examples",
":sdpa_free_format",
"//common:filesystem",
"//common:temp_directory",
"//common/test_utilities:eigen_matrix_compare",
"@spruce",
],
)

Expand Down Expand Up @@ -1347,8 +1347,8 @@ drake_cc_googletest(
":quadratic_program_examples",
":second_order_cone_program_examples",
":semidefinite_program_examples",
"//common:filesystem",
"//common:temp_directory",
"@spruce",
],
)

Expand Down Expand Up @@ -1544,10 +1544,10 @@ drake_cc_googletest(
":mathematical_program_test_util",
":optimization_examples",
":quadratic_program_examples",
"//common:filesystem",
"//common:temp_directory",
"//common/test_utilities:eigen_matrix_compare",
"//math:geometric_transform",
"@spruce",
],
)

Expand Down
10 changes: 5 additions & 5 deletions solvers/test/mosek_solver_test.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "drake/solvers/mosek_solver.h"

#include <gtest/gtest.h>
#include <spruce.hh>

#include "drake/common/filesystem.h"
#include "drake/common/temp_directory.h"
#include "drake/solvers/mathematical_program.h"
#include "drake/solvers/mixed_integer_optimization_util.h"
Expand Down Expand Up @@ -207,20 +207,20 @@ GTEST_TEST(MosekTest, TestLogFile) {
prog.AddLinearConstraint(x(0) + x(1) == 1);

const std::string log_file = temp_directory() + "/mosek.log";
EXPECT_FALSE(spruce::path(log_file).exists());
EXPECT_FALSE(filesystem::exists({log_file}));
MosekSolver solver;
MathematicalProgramResult result;
solver.Solve(prog, {}, {}, &result);
// By default, no logging file.
EXPECT_FALSE(spruce::path(log_file).exists());
EXPECT_FALSE(filesystem::exists({log_file}));
// Output the logging to the console
solver.set_stream_logging(true, "");
solver.Solve(prog, {}, {}, &result);
EXPECT_FALSE(spruce::path(log_file).exists());
EXPECT_FALSE(filesystem::exists({log_file}));
// Output the logging to the file.
solver.set_stream_logging(true, log_file);
solver.Solve(prog, {}, {}, &result);
EXPECT_TRUE(spruce::path(log_file).exists());
EXPECT_TRUE(filesystem::exists({log_file}));
}

GTEST_TEST(MosekTest, SolverOptionsTest) {
Expand Down
4 changes: 2 additions & 2 deletions solvers/test/sdpa_free_format_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <utility>

#include <gtest/gtest.h>
#include <spruce.hh>

#include "drake/common/filesystem.h"
#include "drake/common/temp_directory.h"
#include "drake/common/test_utilities/eigen_matrix_compare.h"
#include "drake/solvers/test/csdp_test_examples.h"
Expand Down Expand Up @@ -713,7 +713,7 @@ GTEST_TEST(SdpaFreeFormatTest, GenerateSDPA1) {
const std::string file_name = temp_directory() + "/sdpa";
std::cout << file_name << "\n";
EXPECT_TRUE(GenerateSDPA(prog, file_name));
EXPECT_TRUE(spruce::path(file_name + ".dat-s").exists());
EXPECT_TRUE(filesystem::exists({file_name + ".dat-s"}));

std::ifstream infile(file_name + ".dat-s");
ASSERT_TRUE(infile.is_open());
Expand Down
6 changes: 3 additions & 3 deletions solvers/test/snopt_solver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <spruce.hh>

#include "drake/common/filesystem.h"
#include "drake/common/temp_directory.h"
#include "drake/common/test_utilities/eigen_matrix_compare.h"
#include "drake/math/rotation_matrix.h"
Expand Down Expand Up @@ -139,12 +139,12 @@ GTEST_TEST(SnoptTest, TestPrintFile) {
// This is to verify we can set the print out file.
const std::string print_file = temp_directory() + "/snopt.out";
std::cout << print_file << std::endl;
EXPECT_FALSE(spruce::path(print_file).exists());
EXPECT_FALSE(filesystem::exists({print_file}));
prog.SetSolverOption(SnoptSolver::id(), "Print file", print_file);
const SnoptSolver solver;
auto result = solver.Solve(prog, {}, {});
EXPECT_TRUE(result.is_success());
EXPECT_TRUE(spruce::path(print_file).exists());
EXPECT_TRUE(filesystem::exists({print_file}));
}

GTEST_TEST(SnoptTest, TestSparseCost) {
Expand Down

0 comments on commit a4d79f3

Please sign in to comment.