Struct Problem

Source
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§

Source§

impl Problem<'_>

Source

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}
Source

pub fn name(&self) -> &str

Returns the name of the problem.

Source

pub fn typ(&self) -> &str

Returns the type of the problem.

Source

pub fn add_observer(&mut self, observer: &Observer)

Adds an observer to the given problem.

Source

pub fn remove_observer(&mut self, observer: &Observer)

Removes an observer to the given problem.

Source

pub fn suite_index(&self) -> ProblemIdx

Returns the problem index of the problem in its current suite.

Source

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.

Source

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.

Source

pub fn final_target_hit(&self) -> bool

Returns true if a previous evaluation hit the target value.

Source

pub fn final_target_value(&self) -> f64

Returns the optimal function value + delta of the problem

Source

pub fn best_value(&self) -> f64

Returns the optimal function value of the problem

To check whether the target has been reached use [Problem::final_target_value] or [Problem::final_target_hit] instead.

Source

pub fn best_observed_value(&self) -> f64

Returns the best observed value for the first objective.

Source

pub fn dimension(&self) -> usize

Returns the dimension of the problem.

Source

pub fn number_of_objectives(&self) -> usize

Returns the number of objectives of the problem.

Source

pub fn number_of_constraints(&self) -> usize

Returns the number of constraints of the problem.

Source

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.

Source

pub fn ranges_of_interest(&self) -> Vec<RangeInclusive<f64>>

Returns the upper and lover bounds of the problem.

Source

pub fn evaluations(&self) -> u64

Returns how often this instance has been evaluated.

Source

pub fn evaluations_constraints(&self) -> u64

Returns how often this instances constrants have been evaluated.

Source

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§

Source§

impl Drop for Problem<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Problem<'_>

Auto Trait Implementations§

§

impl<'suite> Freeze for Problem<'suite>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.