pub struct ClarabelOptions { /* private fields */ }Expand description
Shared options for Clarabel-based optimization routines.
Field semantics:
verbosity: crate-level diagnostics switch used by this crate’s algorithms;clarabel_settings: low-level Clarabel solver configuration passed toDefaultSolver::new.allow_*: policy switches for accepting non-ideal Clarabel statuses when deciding whether an extractedaprofile is considered usable by wrapper APIs. More details inClarabelOptions::is_allow.- priority rule at build time: if
verbosity <= Verbosity::Summary, builder will forceclarabel_settings.verbose = falseto avoid duplicate logs from both layers.
Implementations§
Source§impl ClarabelOptions
impl ClarabelOptions
Sourcepub fn clarabel_settings(&self) -> &DefaultSettings<f64>
pub fn clarabel_settings(&self) -> &DefaultSettings<f64>
Get immutable reference to raw Clarabel settings.
Sourcepub fn is_allow(&self, status: SolverStatus) -> bool
pub fn is_allow(&self, status: SolverStatus) -> bool
Return whether a solver status (SolverStatus) is accepted by current policy.
Policy summary:
SolverStatus::Solvedis always accepted;- selected non-ideal statuses are accepted only if their corresponding
allow_*switch is enabled; - all other statuses are rejected.
Typical wrapper behavior based on this predicate:
- accepted status (
true) => return(Some(copp_solution), clarabel_solution); - rejected status (
false) => return(None, clarabel_solution); - regardless of acceptance, always return full Clarabel
solutionfor advanced users to inspect convergence and diagnostics. copp_solutionis typicallya: Vec<f64>in TOPP2/COPP2 orTopp3Profilein TOPP3/COPP3. You can callclarabel_to_copp2_solutionorclarabel_to_copp3_solutionto generate acopp_solutionfrom aclarabel_solutionwith a validclarabel_solution.x.clarabel_solutionis the fullDefaultSolution<f64>returned by Clarabel, which may contain useful information for expert users even when status is not ideal.
§Example
The example below shows the shared status-handling pattern for expert Clarabel APIs.
use copp::diag::CoppError;
use copp::solver::copp2_socp::{
ClarabelOptionsBuilder, Copp2Problem, copp2_socp_expert,
};
fn inspect(problem: &Copp2Problem<'_, usize>) -> Result<(), CoppError> {
let options = ClarabelOptionsBuilder::new()
.allow_almost_solved(true)
.build()?;
let (profile, solution) = copp2_socp_expert(problem, &options)?;
if options.is_allow(solution.status) {
let a = profile.expect("accepted status should provide a profile");
println!("accepted profile length = {}", a.len());
} else {
println!("solver status was not accepted: {:?}", solution.status);
}
Ok(())
}Auto Trait Implementations§
impl Freeze for ClarabelOptions
impl RefUnwindSafe for ClarabelOptions
impl Send for ClarabelOptions
impl Sync for ClarabelOptions
impl Unpin for ClarabelOptions
impl UnwindSafe for ClarabelOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.