pub struct Problem<'suite> { /* private fields */ }
Expand description
A specific problem instance.
Instances can be optained using Suite::next_problem and Suite::problem_by_function_dimension_instance.
Implementations
sourceimpl Problem<'_>
impl Problem<'_>
sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Returns the ID of the problem.
For the toy
suite this is
{function-name}_d{dimension}
For bbob
it is
- bbob_f{function-index}_i{instance}_d{dimension}
sourcepub fn function_index(&self) -> usize
pub fn function_index(&self) -> usize
Returns the index of the problem.
sourcepub fn dimension_index(&self) -> usize
pub fn dimension_index(&self) -> usize
Returns the dimension index of the problem.
sourcepub fn instance_index(&self) -> usize
pub fn instance_index(&self) -> usize
Returns the instance of the problem.
sourcepub fn evaluate_function(&mut self, x: &[f64], y: &mut [f64])
pub fn evaluate_function(&mut self, x: &[f64], y: &mut [f64])
Evaluates the problem at x
and returns the result in y
.
The length of x
must match Problem::dimension and the
length of y
must match Problem::number_of_objectives.
sourcepub fn evaluate_constraint(&mut self, x: &[f64], y: &mut [f64])
pub fn evaluate_constraint(&mut self, x: &[f64], y: &mut [f64])
Evaluates the problem constraints in point x and save the result in y.
The length of x
must match Problem::dimension and the
length of y
must match Problem::number_of_constraints.
sourcepub fn final_target_hit(&self) -> bool
pub fn final_target_hit(&self) -> bool
Returns true if a previous evaluation hit the target value.
sourcepub fn number_of_objectives(&self) -> usize
pub fn number_of_objectives(&self) -> usize
Returns the number of objectives of the problem.
sourcepub fn number_of_constraints(&self) -> usize
pub fn number_of_constraints(&self) -> usize
Returns the number of constraints of the problem.
sourcepub fn number_of_integer_variables(&self) -> usize
pub fn number_of_integer_variables(&self) -> usize
Returns the numver of integer variables of the problem.
The first n
variables will be integers then.
Returns 0
if all variables are continuous.
sourcepub fn get_ranges_of_interest(&self) -> Vec<RangeInclusive<f64>>
pub fn get_ranges_of_interest(&self) -> Vec<RangeInclusive<f64>>
Returns the upper and lover bounds of the problem.
sourcepub fn evaluations(&self) -> u64
pub fn evaluations(&self) -> u64
Returns how often this instance has been evaluated.
sourcepub fn evaluations_constraints(&self) -> u64
pub fn evaluations_constraints(&self) -> u64
Returns how often this instances constrants have been evaluated.
sourcepub fn initial_solution(&self, x: &mut [f64])
pub fn initial_solution(&self, x: &mut [f64])
Writes a feasible initial solution into x
.
If the problem does not provide a specific solution, it will be the center of the problem’s region of interest.
Trait Implementations
Auto Trait Implementations
impl<'suite> RefUnwindSafe for Problem<'suite>
impl<'suite> !Sync for Problem<'suite>
impl<'suite> Unpin for Problem<'suite>
impl<'suite> UnwindSafe for Problem<'suite>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more