Struct MyOracle3

Source
pub struct MyOracle3 {
    pub idx: i32,
    pub target: f64,
}
Expand description

A struct representing a custom oracle for some optimization problem.

This oracle is used to evaluate the feasibility of a given solution. It keeps track of an index idx and a target value target.

Fields§

§idx: i32

The index of the current solution being evaluated.

§target: f64

The target value for the optimization problem.

Trait Implementations§

Source§

impl Debug for MyOracle3

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MyOracle3

Source§

fn default() -> Self

Creates a new MyOracle3 instance with the index set to 0 and the target value set to a very small negative number.

This is the default implementation for the MyOracle3 struct, which is used to represent a custom oracle for some optimization problem. The oracle is used to evaluate the feasibility of a given solution, and this default implementation initializes the index to 0 and the target value to a very small negative number.

Source§

impl OracleFeas<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for MyOracle3

Source§

fn assess_feas(&mut self, xc: &Array1<f64>) -> Option<(Array1<f64>, f64)>

The function assess_feas takes in an array xc and checks if it satisfies two constraints, returning an optional tuple of an array and a float if any constraint is violated.

Arguments:

  • xc: The parameter xc is an array of size 2, representing the coordinates of a point in a 2-dimensional space. The first element xc[0] represents the x-coordinate, and the second element xc[1] represents the y-coordinate.

Returns:

The function assess_feas returns an Option containing a tuple (Arr, f64).

Source§

type CutChoice = f64

Source§

impl OracleFeas2<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for MyOracle3

Source§

fn update(&mut self, gamma: f64)

Auto Trait Implementations§

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.