Skip to main content

DebRules

Struct DebRules 

Source
pub struct DebRules<P>(pub P);
Expand description

Deb’s feasibility rules (Deb 2000) as a Problem adapter.

Ranking induced: feasible by objective, then infeasible by total violation — every feasible point beats every infeasible one. Works with any forge optimizer; exact whenever feasible objectives stay below FEASIBLE_CEILING.

use forge_core::constraint::{constrained_func, DebRules};
use forge_core::{De, Optimizer, Termination};

// Minimize x + y subject to x·y ≥ 1 on [0, 10]².
let p = constrained_func(
    vec![(0.0, 10.0); 2],
    |x| x[0] + x[1],
    |x| vec![(1.0 - x[0] * x[1]).max(0.0)],
);
let report = De::default().optimize(&DebRules(p), &Termination::budget(6000));
assert!((report.best_value() - 2.0).abs() < 1e-2); // optimum at (1, 1)

Tuple Fields§

§0: P

Trait Implementations§

Source§

impl<P: ConstrainedProblem> Problem for DebRules<P>

Source§

fn dim(&self) -> usize

Number of decision variables.
Source§

fn bounds(&self) -> &[Bound]

Per-variable inclusive bounds, length Problem::dim.
Source§

fn objective(&self, x: &[f64]) -> f64

Objective value to minimize. A non-finite return marks the point as infeasible; optimizers will reject it rather than crash.

Auto Trait Implementations§

§

impl<P> Freeze for DebRules<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for DebRules<P>
where P: RefUnwindSafe,

§

impl<P> Send for DebRules<P>
where P: Send,

§

impl<P> Sync for DebRules<P>
where P: Sync,

§

impl<P> Unpin for DebRules<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for DebRules<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for DebRules<P>
where P: UnwindSafe,

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.