citrine.informatics.constraints.ingredient_fraction_constraint module

class citrine.informatics.constraints.ingredient_fraction_constraint.IngredientFractionConstraint(*, formulation_descriptor: FormulationDescriptor, ingredient: str, min: float, max: float, is_required: bool = True)

Bases: Serializable[IngredientFractionConstraint], Constraint

Represents a constraint on an ingredient fraction in a formulation.

Parameters:
  • formulation_descriptor (FormulationDescriptor) – descriptor to constrain

  • ingredient (str) – name of the ingredient to constrain

  • min (float) – minimum ingredient value

  • max (float) – maximum ingredient value

  • is_required (bool, optional) – whether this ingredient is required. If True, the ingredient must be present and its value must be within the specified range. if False, the ingredient 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
ingredient: str = None
is_required: bool = None
max: float = None
min: float = None
typ = 'IngredientFractionConstraint'