encode_constraints¶
- encode_constraints(
- constraints: amplify.ConstraintList | Iterable[amplify.Constraint],
- mapping: Mapping[amplify.Poly, amplify.Poly | float],
Encode the constraints using the provided mapping.
Note that Amplify SDK’s ``custom’’ penalty formulation method is not supported yet.
- Parameters:
constraints (amplify.ConstraintList | Iterable[amplify.Constraint]) – The constraints to encode.
mapping (Mapping[amplify.Poly, amplify.Poly | float]) – The mapping to use for encoding.
- Raises:
ValueError – If the constraints are invalid.
- Returns:
The encoded constraints.
- Return type:
amplify.ConstraintList