pub struct PermutationSolution {
pub sequence: Vec<usize>,
pub rotations: Vec<usize>,
pub rotation_options: usize,
pub mirrors: Vec<bool>,
/* private fields */
}Expand description
Permutation-based solution for SA.
Fields§
§sequence: Vec<usize>The permutation (indices).
rotations: Vec<usize>Additional rotation/orientation values.
rotation_options: usizeNumber of rotation options per item.
mirrors: Vec<bool>Mirror flag per item (allow_flip support, 2D nesting only — see
NeighborhoodOperator::MirrorFlip).
Implementations§
Source§impl PermutationSolution
impl PermutationSolution
Sourcepub fn random<R: Rng>(size: usize, rotation_options: usize, rng: &mut R) -> Self
pub fn random<R: Rng>(size: usize, rotation_options: usize, rng: &mut R) -> Self
Creates a random permutation solution.
Sourcepub fn apply_swap<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_swap<R: Rng>(&self, rng: &mut R) -> Self
Applies swap operator: swaps two elements in sequence.
Sourcepub fn apply_relocate<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_relocate<R: Rng>(&self, rng: &mut R) -> Self
Applies relocate operator: moves an element to a new position.
Sourcepub fn apply_inversion<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_inversion<R: Rng>(&self, rng: &mut R) -> Self
Applies inversion operator: reverses a segment.
Sourcepub fn apply_rotation<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_rotation<R: Rng>(&self, rng: &mut R) -> Self
Applies rotation operator: changes rotation of one element.
Sourcepub fn apply_mirror_flip<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_mirror_flip<R: Rng>(&self, rng: &mut R) -> Self
Applies mirror-flip operator: flips one element’s mirror bit
(allow_flip support). Same shape as apply_rotation — unconditional
on the gene, the consuming problem masks it against its own
per-item mirror-eligibility (e.g. Geometry2D::allow_flip()).
Sourcepub fn apply_chain<R: Rng>(&self, rng: &mut R) -> Self
pub fn apply_chain<R: Rng>(&self, rng: &mut R) -> Self
Applies chain operator: 3-opt style move.
Trait Implementations§
Source§impl Clone for PermutationSolution
impl Clone for PermutationSolution
Source§fn clone(&self) -> PermutationSolution
fn clone(&self) -> PermutationSolution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PermutationSolution
impl Debug for PermutationSolution
Source§impl SaSolution for PermutationSolution
impl SaSolution for PermutationSolution
Auto Trait Implementations§
impl Freeze for PermutationSolution
impl RefUnwindSafe for PermutationSolution
impl Send for PermutationSolution
impl Sync for PermutationSolution
impl Unpin for PermutationSolution
impl UnsafeUnpin for PermutationSolution
impl UnwindSafe for PermutationSolution
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.