pub struct IndicatorConstraint<S: Stage<Self> = Created> {
pub indicator_variable: VariableID,
pub equality: Equality,
pub stage: S::Data,
}Expand description
An indicator constraint: indicator_variable = 1 → f(x) <= 0 (or = 0).
When the binary indicator variable is 0, the constraint is unconditionally satisfied.
When it is 1, the constraint f(x) <= 0 (or f(x) = 0) must hold.
The constraint’s IndicatorConstraintID is not stored in this struct — it is held
by the enclosing collection (e.g. the BTreeMap key in Instance).
Modeling labels and provenance live on the enclosing collection’s
ConstraintContextStore; per-element
context storage was retired in the v3 redesign.
Fields§
§indicator_variable: VariableIDThe binary decision variable that activates this constraint.
equality: Equality§stage: S::DataImplementations§
Source§impl IndicatorConstraint<Created>
impl IndicatorConstraint<Created>
Sourcepub fn new(
indicator_variable: VariableID,
equality: Equality,
function: Function,
) -> Self
pub fn new( indicator_variable: VariableID, equality: Equality, function: Function, ) -> Self
Create a new indicator constraint.
Sourcepub fn function_mut(&mut self) -> &mut Function
pub fn function_mut(&mut self) -> &mut Function
Mutable access to the constraint function.
Trait Implementations§
Source§impl<S: Clone + Stage<Self>> Clone for IndicatorConstraint<S>
impl<S: Clone + Stage<Self>> Clone for IndicatorConstraint<S>
Source§fn clone(&self) -> IndicatorConstraint<S>
fn clone(&self) -> IndicatorConstraint<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConstraintType for IndicatorConstraint
impl ConstraintType for IndicatorConstraint
Source§type ID = IndicatorConstraintID
type ID = IndicatorConstraintID
The ID type for this constraint family.
Source§type Created = IndicatorConstraint
type Created = IndicatorConstraint
The constraint as defined in the problem.
Source§type Evaluated = IndicatorConstraint<Evaluated>
type Evaluated = IndicatorConstraint<Evaluated>
The constraint after evaluation against a single state.
Source§type Sampled = IndicatorConstraint<Sampled>
type Sampled = IndicatorConstraint<Sampled>
The constraint after evaluation against multiple samples.
Source§impl Display for IndicatorConstraint<Created>
impl Display for IndicatorConstraint<Created>
Source§impl Evaluate for IndicatorConstraint<Created>
impl Evaluate for IndicatorConstraint<Created>
type Output = IndicatorConstraint<Evaluated>
type SampledOutput = IndicatorConstraint<Sampled>
Source§fn evaluate(&self, state: &State, atol: ATol) -> Result<Self::Output>
fn evaluate(&self, state: &State, atol: ATol) -> Result<Self::Output>
Evaluate to return the output with used variable ids
Source§fn evaluate_samples(
&self,
samples: &Sampled<State>,
atol: ATol,
) -> Result<Self::SampledOutput>
fn evaluate_samples( &self, samples: &Sampled<State>, atol: ATol, ) -> Result<Self::SampledOutput>
Evaluate for each sample
Source§fn partial_evaluate(&mut self, state: &State, atol: ATol) -> Result<()>
fn partial_evaluate(&mut self, state: &State, atol: ATol) -> Result<()>
Partially evaluate the function to return the used variable ids
Source§fn required_ids(&self) -> VariableIDSet
fn required_ids(&self) -> VariableIDSet
Decision variable IDs required for evaluation
Source§impl From<IndicatorConstraint<Evaluated>> for EvaluatedIndicatorConstraint
impl From<IndicatorConstraint<Evaluated>> for EvaluatedIndicatorConstraint
Source§fn from(constraint: EvaluatedIndicatorConstraint) -> Self
fn from(constraint: EvaluatedIndicatorConstraint) -> Self
Converts to this type from the input type.
Source§impl From<IndicatorConstraint<Sampled>> for SampledIndicatorConstraint
impl From<IndicatorConstraint<Sampled>> for SampledIndicatorConstraint
Source§fn from(constraint: SampledIndicatorConstraint) -> Self
fn from(constraint: SampledIndicatorConstraint) -> Self
Converts to this type from the input type.
Source§impl From<IndicatorConstraint> for IndicatorConstraint
impl From<IndicatorConstraint> for IndicatorConstraint
Source§fn from(constraint: IndicatorConstraint<Created>) -> Self
fn from(constraint: IndicatorConstraint<Created>) -> Self
Converts to this type from the input type.
Source§impl Propagate for IndicatorConstraint<Created>
impl Propagate for IndicatorConstraint<Created>
type Transformed = Constraint
Source§impl Stage<IndicatorConstraint<Sampled>> for Sampled
impl Stage<IndicatorConstraint<Sampled>> for Sampled
type Data = IndicatorSampledData
Source§impl Stage<IndicatorConstraint> for Created
impl Stage<IndicatorConstraint> for Created
type Data = CreatedData
impl<S: PartialEq + Stage<Self>> StructuralPartialEq for IndicatorConstraint<S>
Auto Trait Implementations§
impl<S> Freeze for IndicatorConstraint<S>
impl<S> RefUnwindSafe for IndicatorConstraint<S>
impl<S> Send for IndicatorConstraint<S>
impl<S> Sync for IndicatorConstraint<S>
impl<S> Unpin for IndicatorConstraint<S>
impl<S> UnsafeUnpin for IndicatorConstraint<S>
impl<S> UnwindSafe for IndicatorConstraint<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more