pub struct Objective<S> { /* private fields */ }
Expand description
Defines the objective of an optimization problem, which is constant throughout the optimization. Afterwards an objective instance can be used to evaluate every solution object.
It is a hierarchical objective, i.e., it consists of several levels of
LinearCombinations
of Indicators
.
The objective is to be minimized with the most important level being the first entry of the
vector.
A solution is evaluated by using the evaluate
method, which consumes the solution, computes its
ObjectiveValue
and returns both as EvaluatedSolution
.
S
: the solution type for which the objective is defined.
Implementations§
Source§impl<S> Objective<S>
impl<S> Objective<S>
Sourcepub fn evaluate(&self, solution: S) -> EvaluatedSolution<S>
pub fn evaluate(&self, solution: S) -> EvaluatedSolution<S>
Consumes the solution, computes its ObjectiveValue
, and returns both as EvaluatedSolution
.
Sourcepub fn zero(&self) -> ObjectiveValue
pub fn zero(&self) -> ObjectiveValue
Returns the zero ObjectiveValue
(BaseValue::Zero
on each level).
Sourcepub fn maximum(&self) -> ObjectiveValue
pub fn maximum(&self) -> ObjectiveValue
Returns the maximum ObjectiveValue
(BaseValue::Maximum
on each level).
Sourcepub fn print_objective_value(&self, objective_value: &ObjectiveValue)
pub fn print_objective_value(&self, objective_value: &ObjectiveValue)
Prints the ObjectiveValue
.
Sourcepub fn print_objective_value_with_comparison(
&self,
objective_value: &ObjectiveValue,
comparison: &ObjectiveValue,
)
pub fn print_objective_value_with_comparison( &self, objective_value: &ObjectiveValue, comparison: &ObjectiveValue, )
Prints the ObjectiveValue
with a comparison to another ObjectiveValue
.
Sourcepub fn objective_value_to_json(&self, objective_value: &ObjectiveValue) -> Value
pub fn objective_value_to_json(&self, objective_value: &ObjectiveValue) -> Value
Converts an ObjectiveValue
to a JSON object (using serde_json
).
Source§impl<S> Objective<S>
impl<S> Objective<S>
Sourcepub fn new(hierarchy_levels: Vec<LinearCombination<S>>) -> Objective<S>
pub fn new(hierarchy_levels: Vec<LinearCombination<S>>) -> Objective<S>
Creates a new Objective
with the given LinearCombinations
as hierarchy levels.
The most important level is the first entry of the vector.
Sourcepub fn new_single_level(
linear_combination: LinearCombination<S>,
) -> Objective<S>
pub fn new_single_level( linear_combination: LinearCombination<S>, ) -> Objective<S>
Creates a new Objective
with a single LinearCombination
as the only hierarchy level.
Sourcepub fn new_single_indicator(indicator: Box<dyn Indicator<S>>) -> Objective<S>
pub fn new_single_indicator(indicator: Box<dyn Indicator<S>>) -> Objective<S>
Auto Trait Implementations§
impl<S> Freeze for Objective<S>
impl<S> !RefUnwindSafe for Objective<S>
impl<S> Send for Objective<S>
impl<S> Sync for Objective<S>
impl<S> Unpin for Objective<S>
impl<S> !UnwindSafe for Objective<S>
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> 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>
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>
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