pub struct SimpleScore { /* private fields */ }Expand description
A simple score with a single integer value.
This is the simplest score type, useful when there’s only one type of constraint to optimize.
§Examples
use solverforge_core::{SimpleScore, Score};
let score1 = SimpleScore::of(-5);
let score2 = SimpleScore::of(-3);
assert!(score2 > score1); // -3 is better than -5
assert!(!score1.is_feasible()); // Negative scores are not feasibleImplementations§
Source§impl SimpleScore
impl SimpleScore
Trait Implementations§
Source§impl Add for SimpleScore
impl Add for SimpleScore
Source§impl Clone for SimpleScore
impl Clone for SimpleScore
Source§fn clone(&self) -> SimpleScore
fn clone(&self) -> SimpleScore
Returns a duplicate 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 SimpleScore
impl Debug for SimpleScore
Source§impl Default for SimpleScore
impl Default for SimpleScore
Source§fn default() -> SimpleScore
fn default() -> SimpleScore
Returns the “default value” for a type. Read more
Source§impl Display for SimpleScore
impl Display for SimpleScore
Source§impl From<i64> for SimpleScore
impl From<i64> for SimpleScore
Source§impl Hash for SimpleScore
impl Hash for SimpleScore
Source§impl Neg for SimpleScore
impl Neg for SimpleScore
Source§impl Ord for SimpleScore
impl Ord for SimpleScore
Source§impl ParseableScore for SimpleScore
impl ParseableScore for SimpleScore
Source§impl PartialEq for SimpleScore
impl PartialEq for SimpleScore
Source§impl PartialOrd for SimpleScore
impl PartialOrd for SimpleScore
Source§impl Score for SimpleScore
impl Score for SimpleScore
Source§fn is_feasible(&self) -> bool
fn is_feasible(&self) -> bool
Returns true if this score represents a feasible solution. Read more
Source§fn levels_count() -> usize
fn levels_count() -> usize
Returns the number of score levels. Read more
Source§fn from_level_numbers(levels: &[i64]) -> Self
fn from_level_numbers(levels: &[i64]) -> Self
Creates a score from level numbers. Read more
Source§fn compare(&self, other: &Self) -> Ordering
fn compare(&self, other: &Self) -> Ordering
Compares two scores, returning the ordering. Read more
Source§fn is_better_than(&self, other: &Self) -> bool
fn is_better_than(&self, other: &Self) -> bool
Returns true if this score is better than the other score. Read more
Source§fn is_worse_than(&self, other: &Self) -> bool
fn is_worse_than(&self, other: &Self) -> bool
Returns true if this score is worse than the other score.
Source§fn is_equal_to(&self, other: &Self) -> bool
fn is_equal_to(&self, other: &Self) -> bool
Returns true if this score is equal to the other score.
Source§impl Sub for SimpleScore
impl Sub for SimpleScore
impl Copy for SimpleScore
impl Eq for SimpleScore
impl StructuralPartialEq for SimpleScore
Auto Trait Implementations§
impl Freeze for SimpleScore
impl RefUnwindSafe for SimpleScore
impl Send for SimpleScore
impl Sync for SimpleScore
impl Unpin for SimpleScore
impl UnwindSafe for SimpleScore
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