Struct coupe::CompleteKarmarkarKarp
source · pub struct CompleteKarmarkarKarp {
pub tolerance: f64,
}
Expand description
Complete Karmarkar-Karp algorithm
Extension of the
Karmarkar-Karp number partitioning algorithm that
explores all possible solutions until the tolerance
constraint is
respected.
This algorithm is currently implemented in the bi-partitioning case only.
Example
use coupe::Partition as _;
let weights: [i32; 4] = [3, 5, 3, 9];
let mut partition = [0; 4];
coupe::CompleteKarmarkarKarp { tolerance: 0.1 }
.partition(&mut partition, weights)?;
Reference
Korf, Richard E., 1998. A complete anytime algorithm for number partitioning. Artificial Intelligence, 106(2):181 – 203. doi:10.1016/S0004-3702(98)00086-1.
Fields§
§tolerance: f64
Constraint on the normalized imbalance between the two parts.
Trait Implementations§
source§impl Clone for CompleteKarmarkarKarp
impl Clone for CompleteKarmarkarKarp
source§fn clone(&self) -> CompleteKarmarkarKarp
fn clone(&self) -> CompleteKarmarkarKarp
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CompleteKarmarkarKarp
impl Debug for CompleteKarmarkarKarp
source§impl<W> Partition<W> for CompleteKarmarkarKarpwhere
W: IntoIterator,
W::Item: CkkWeight,
impl<W> Partition<W> for CompleteKarmarkarKarpwhere W: IntoIterator, W::Item: CkkWeight,
impl Copy for CompleteKarmarkarKarp
Auto Trait Implementations§
impl RefUnwindSafe for CompleteKarmarkarKarp
impl Send for CompleteKarmarkarKarp
impl Sync for CompleteKarmarkarKarp
impl Unpin for CompleteKarmarkarKarp
impl UnwindSafe for CompleteKarmarkarKarp
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§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.