Skip to content

Commit

Permalink
[workspace] Upgrade Clarabel.rs to latest release 0.7.0
Browse files Browse the repository at this point in the history
[workspace] Upgrade crate_universe to latest releases
  • Loading branch information
jwnimmer-tri committed Apr 15, 2024
1 parent 3b6e5e5 commit d32eb35
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 44 deletions.
34 changes: 2 additions & 32 deletions solvers/clarabel_solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,7 @@ class SettingsConverter {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(SettingsConverter);

// When `use_nerfed_default_tolerances` is true, we use looser tolerance
// defaults to help reduce the possiblity of Clarabel crashing the entire
// process due to https://github.com/oxfordcontrol/Clarabel.rs/issues/66.
// We should remove this nerf after Clarabel is fixed.
SettingsConverter(const SolverOptions& solver_options,
bool use_nerfed_default_tolerances) {
// N.B. We must adjust our default values before starting to process the
// user's requested `solver_options`.
if (use_nerfed_default_tolerances) {
drake::log()->debug(
"ClarabelSolver is using loosened default tolerances due to the "
"presence of SDP and Exponential Cone Constraints. This is done to "
"prevent numerical issues from potentially crashing your program "
"due to https://github.com/oxfordcontrol/Clarabel.rs/issues/66. "
"If you need to solve your program to high precision, consider "
"manually setting SolverOptions for 'tol_gap_abs', 'tol_gap_rel', "
"and 'tol_feas'. Values set in SolverOptions take prececence over "
"the defaults");
settings_.tol_gap_abs *= 100.0;
settings_.tol_gap_rel *= 100.0;
settings_.tol_feas *= 100.0;
}

explicit SettingsConverter(const SolverOptions& solver_options) {
// Propagate Drake's common options into `settings_`.
settings_.verbose = solver_options.get_print_to_console();
// TODO(jwnimmer-tri) Handle get_print_file_name().
Expand Down Expand Up @@ -469,15 +447,7 @@ void ClarabelSolver::DoSolve(const MathematicalProgram& prog,
A.setFromTriplets(A_triplets.begin(), A_triplets.end());
const Eigen::Map<Eigen::VectorXd> b_vec{b.data(), ssize(b)};

// When the program mixes PSD cones with either Exponential or Power cones, we
// must loosen the default tolerance to help reduce the possiblity of crashing
// the entire process. Since we never add power cones (nor generialized power
// cones), the only case we need to guard is PSD mixed with Exponential.
const bool use_nerfed_default_tolerances =
psd_cone_length.size() && prog.exponential_cone_constraints().size();

const SettingsConverter settings_converter(merged_options,
use_nerfed_default_tolerances);
const SettingsConverter settings_converter(merged_options);
clarabel::DefaultSettings<double> settings = settings_converter.settings();

clarabel::DefaultSolver<double> solver(P, q_vec, A, b_vec, cones, settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

[dependencies]
-clarabel = { path = "../Clarabel.rs" }
+clarabel = "0.6.0"
+clarabel = "0.7.0"

4 changes: 2 additions & 2 deletions tools/workspace/crate_universe/lock/Cargo.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "clarabel"
version = "0.6.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb77b79847293795eb71eb995ea2222af9c67c6f13c8734bd56b02b8415164b6"
checksum = "e4c0e3ebbd6441dcc7f879e89e727fe90b4e4fcecf6295f283a0d02077fb8365"
dependencies = [
"amd",
"blas",
Expand Down
10 changes: 5 additions & 5 deletions tools/workspace/crate_universe/lock/archives.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ ARCHIVES = [
build_file = Label("@drake//tools/workspace/crate_universe/lock/details:BUILD.cfg-if-1.0.0.bazel"),
),
dict(
name = "crate__clarabel-0.6.0",
name = "crate__clarabel-0.7.1",
patches = [
"@drake//tools/workspace/crate_universe:patches/clarabel_blas.patch",
],
sha256 = "fb77b79847293795eb71eb995ea2222af9c67c6f13c8734bd56b02b8415164b6",
sha256 = "e4c0e3ebbd6441dcc7f879e89e727fe90b4e4fcecf6295f283a0d02077fb8365",
type = "tar.gz",
urls = ["https://static.crates.io/crates/clarabel/0.6.0/download"],
strip_prefix = "clarabel-0.6.0",
build_file = Label("@drake//tools/workspace/crate_universe/lock/details:BUILD.clarabel-0.6.0.bazel"),
urls = ["https://static.crates.io/crates/clarabel/0.7.1/download"],
strip_prefix = "clarabel-0.7.1",
build_file = Label("@drake//tools/workspace/crate_universe/lock/details:BUILD.clarabel-0.7.1.bazel"),
),
dict(
name = "crate__darling-0.14.4",
Expand Down
2 changes: 1 addition & 1 deletion tools/workspace/crate_universe/lock/details/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ filegroup(
# Workspace Member Dependencies
alias(
name = "clarabel",
actual = "@crate__clarabel-0.6.0//:clarabel",
actual = "@crate__clarabel-0.7.1//:clarabel",
tags = ["manual"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package_info(
name = "package_info",
package_name = "clarabel",
package_url = "https://github.com/oxfordcontrol/Clarabel.rs",
package_version = "0.6.0",
package_version = "0.7.1",
)

license(
Expand Down Expand Up @@ -106,7 +106,7 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-none": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.6.0",
version = "0.7.1",
deps = [
"@crate__amd-0.2.2//:amd",
"@crate__blas-0.22.0//:blas",
Expand Down
2 changes: 1 addition & 1 deletion tools/workspace/crate_universe/lock/details/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def aliases(
_NORMAL_DEPENDENCIES = {
"": {
_COMMON_CONDITION: {
"clarabel": Label("@crate__clarabel-0.6.0//:clarabel"),
"clarabel": Label("@crate__clarabel-0.7.1//:clarabel"),
},
},
}
Expand Down

0 comments on commit d32eb35

Please sign in to comment.