pub struct MinimumDiscretePlanarInverseKinematics { /* private fields */ }Expand description
The Minimum Discrete Planar Inverse Kinematics problem.
Given positive link lengths l_1, ..., l_n, a target point g in
R^2, sampled absolute orientations Phi_j = {phi_{j,0}, ..., phi_{j,m_j-1}}
for each link, and admissible-pair sets
A_j ⊆ {0, ..., m_{j-1}-1} x {0, ..., m_j-1} for j = 2, ..., n,
choose indices a_j ∈ {0, ..., m_j-1} such that (a_{j-1}, a_j) ∈ A_j
for every j = 2, ..., n, minimizing
|| Σ_{j=1}^n l_j (cos(phi_{j,a_j}), sin(phi_{j,a_j})) - g ||_2^2.
Implementations§
Source§impl MinimumDiscretePlanarInverseKinematics
impl MinimumDiscretePlanarInverseKinematics
Sourcepub fn new(
link_lengths: Vec<f64>,
target_point: (f64, f64),
orientation_samples: Vec<Vec<f64>>,
allowed_pairs: Vec<Vec<(usize, usize)>>,
) -> Self
pub fn new( link_lengths: Vec<f64>, target_point: (f64, f64), orientation_samples: Vec<Vec<f64>>, allowed_pairs: Vec<Vec<(usize, usize)>>, ) -> Self
Construct a new instance.
§Panics
Panics if the input fields are not mutually consistent (see the validation rules in the source).
Sourcepub fn link_lengths(&self) -> &[f64]
pub fn link_lengths(&self) -> &[f64]
Get the link lengths.
Sourcepub fn target_point(&self) -> (f64, f64)
pub fn target_point(&self) -> (f64, f64)
Get the target point.
Sourcepub fn orientation_samples(&self) -> &[Vec<f64>]
pub fn orientation_samples(&self) -> &[Vec<f64>]
Get the per-link orientation samples.
Sourcepub fn allowed_pairs(&self) -> &[Vec<(usize, usize)>]
pub fn allowed_pairs(&self) -> &[Vec<(usize, usize)>]
Get the admissible-pair sets for consecutive junctions.
Sourcepub fn total_configurations(&self) -> usize
pub fn total_configurations(&self) -> usize
Total number of configurations (product of per-link sample counts):
prod_{j=1}^n m_j. This is the size of the brute-force search space.
Sourcepub fn num_orientation_samples(&self) -> usize
pub fn num_orientation_samples(&self) -> usize
Total number of sampled orientations across all links:
sum_{j=1}^n m_j. This is the QUBO variable count for the one-hot
encoding used by the QUBO reduction.
Sourcepub fn is_feasible(&self, config: &[usize]) -> bool
pub fn is_feasible(&self, config: &[usize]) -> bool
Check if a configuration is feasible (one index per link, in range, and every consecutive pair lies in the corresponding admissible set).
Sourcepub fn end_effector(&self, config: &[usize]) -> Option<(f64, f64)>
pub fn end_effector(&self, config: &[usize]) -> Option<(f64, f64)>
Compute the end-effector position for a configuration.
Returns None if the configuration is infeasible.
Sourcepub fn squared_distance(&self, config: &[usize]) -> Option<f64>
pub fn squared_distance(&self, config: &[usize]) -> Option<f64>
Compute the squared end-effector distance to the target.
Returns None if the configuration is infeasible.
Sourcepub fn is_valid_solution(&self, config: &[usize]) -> bool
pub fn is_valid_solution(&self, config: &[usize]) -> bool
Whether the configuration represents a valid feasible solution.
Trait Implementations§
Source§impl Clone for MinimumDiscretePlanarInverseKinematics
impl Clone for MinimumDiscretePlanarInverseKinematics
Source§fn clone(&self) -> MinimumDiscretePlanarInverseKinematics
fn clone(&self) -> MinimumDiscretePlanarInverseKinematics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for MinimumDiscretePlanarInverseKinematics
impl<'de> Deserialize<'de> for MinimumDiscretePlanarInverseKinematics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Problem for MinimumDiscretePlanarInverseKinematics
impl Problem for MinimumDiscretePlanarInverseKinematics
Source§const NAME: &'static str = "MinimumDiscretePlanarInverseKinematics"
const NAME: &'static str = "MinimumDiscretePlanarInverseKinematics"
Source§fn variant() -> Vec<(&'static str, &'static str)>
fn variant() -> Vec<(&'static str, &'static str)>
Source§fn dims(&self) -> Vec<usize>
fn dims(&self) -> Vec<usize>
Source§fn num_variables(&self) -> usize
fn num_variables(&self) -> usize
Source§fn problem_type() -> ProblemType
fn problem_type() -> ProblemType
impl DeclaredVariant for MinimumDiscretePlanarInverseKinematics
Auto Trait Implementations§
impl Freeze for MinimumDiscretePlanarInverseKinematics
impl RefUnwindSafe for MinimumDiscretePlanarInverseKinematics
impl Send for MinimumDiscretePlanarInverseKinematics
impl Sync for MinimumDiscretePlanarInverseKinematics
impl Unpin for MinimumDiscretePlanarInverseKinematics
impl UnsafeUnpin for MinimumDiscretePlanarInverseKinematics
impl UnwindSafe for MinimumDiscretePlanarInverseKinematics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
Source§impl<T> DynProblem for T
impl<T> DynProblem for T
Source§fn evaluate_dyn(&self, config: &[usize]) -> String
fn evaluate_dyn(&self, config: &[usize]) -> String
Source§fn evaluate_json(&self, config: &[usize]) -> Value
fn evaluate_json(&self, config: &[usize]) -> Value
Source§fn serialize_json(&self) -> Value
fn serialize_json(&self) -> Value
Source§fn problem_name(&self) -> &'static str
fn problem_name(&self) -> &'static str
Problem::NAME).Source§fn num_variables_dyn(&self) -> usize
fn num_variables_dyn(&self) -> usize
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.