citrine.informatics.constraints.label_fraction_constraint module
- class citrine.informatics.constraints.label_fraction_constraint.LabelFractionConstraint(*, formulation_descriptor: FormulationDescriptor, label: str, min: float, max: float, is_required: bool = True)
Bases:
Serializable
[LabelFractionConstraint
],Constraint
Represents a constraint on the total amount of ingredients with a given label.
- Parameters:
formulation_descriptor (FormulationDescriptor) – descriptor to constrain
label (str) – ingredient label to constrain
min (float) – minimum value
max (float) – maximum value
is_required (bool, optional) – whether this ingredient is required. If
True
, the label must be present and its value must be within the specified range. ifFalse
, the label must be within the specified range only if it’s present in the formulation, i.e., the value can be 0 or on the range[min, max]
.
- classmethod build(data: dict) Self
Build an instance of this object from given data.
- dump() dict
Dump this instance.
- classmethod get_type(data)
Return the subtype.
- formulation_descriptor: FormulationDescriptor = None
- is_required: bool = None
- label: str = None
- max: float = None
- min: float = None
- typ = 'LabelFractionConstraint'