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 Default for MyOracle3
impl Default for MyOracle3
Source§fn default() -> Self
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
impl OracleFeas<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for MyOracle3
Source§fn assess_feas(&mut self, xc: &Array1<f64>) -> Option<(Array1<f64>, f64)>
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 parameterxc
is an array of size 2, representing the coordinates of a point in a 2-dimensional space. The first elementxc[0]
represents the x-coordinate, and the second elementxc[1]
represents the y-coordinate.
Returns:
The function assess_feas
returns an Option
containing a tuple (Arr, f64)
.