Reference - Constraints

ConstraintAbs

The ConstraintAbs class represents an absolute value constraint between two variables.

Class Details

  • ConstraintAbs(var_1: Variable, var_2: Variable, constraint_name=None): Represents an absolute value constraint between two variables.

    Parameters:

    • var_1 (Variable): The first variable in the constraint.
    • var_2 (Variable): The second variable in the constraint.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    abs_constraint = ConstraintAbs(var_x, var_y, "abs_constraint")
    

ConstraintASin

The ConstraintASin class represents an arcsine constraint between two variables.

Class Details

  • ConstraintASin(var_1: Variable, var_2: Variable, constraint_name=None): Represents an arcsine constraint between two variables.

    Parameters:

    • var_1 (Variable): The first variable in the constraint.
    • var_2 (Variable): The second variable in the constraint.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    asin_constraint = ConstraintASin(var_angle, var_value, "asin_constraint")
    

ConstraintATan

The ConstraintATan class represents an arctangent constraint between two variables.

Class Details

  • ConstraintATan(var_1: Variable, var_2: Variable, constraint_name=None): Represents an arctangent constraint between two variables.

    Parameters:

    • var_1 (Variable): The first variable in the constraint.
    • var_2 (Variable): The second variable in the constraint.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    atan_constraint = ConstraintATan(var_angle, var_value, "atan_constraint")
    

ConstraintCos

The ConstraintCos class represents a cosine constraint between two variables.

Class Details

  • ConstraintCos(var_1: Variable, var_2: Variable, constraint_name=None): Represents a cosine constraint between two variables.

    Parameters:

    • var_1 (Variable): The first variable in the constraint.
    • var_2 (Variable): The second variable in the constraint.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    cos_constraint = ConstraintCos(var_angle, var_value, "cos_constraint")
    

ConstraintDistinctArray

The ConstraintDistinctArray class represents a constraint to ensure distinctness within an array.

Class Details

  • ConstraintDistinctArray(var_1: ArrayVariable, constraint_name=None): Represents a constraint to ensure distinctness within an array.

    Parameters:

    • var_1 (ArrayVariable): The array variable to enforce distinctness for.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    distinct_array_constraint = ConstraintDistinctArray(array_var, "distinct_array_constraint")
    

ConstraintDistinctRow

The ConstraintDistinctRow class represents a constraint to ensure distinctness within a specific row of an array.

Class Details

  • ConstraintDistinctRow(var_1: ArrayVariable, size: int, idx: int, constraint_name=None): Represents a constraint to ensure distinctness within a specific row of an array.

    Parameters:

    • var_1 (ArrayVariable): The array variable to enforce distinctness within a row.
    • size (int): The width of the matrice to consider.
    • idx (int): The index of the row to enforce distinctness for.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    distinct_row_constraint = ConstraintDistinctRow(array_var, size=3, idx=1, constraint_name="distinct_row_constraint")
    

ConstraintDistinctCol

The ConstraintDistinctCol class represents a constraint to ensure distinctness within a specific column of an array.

Class Details

  • ConstraintDistinctCol(var_1: ArrayVariable, size: int, idx: int, constraint_name=None): Represents a constraint to ensure distinctness within a specific column of an array.

    Parameters:

    • var_1 (ArrayVariable): The array variable to enforce distinctness within a column.
    • size (int): The width of the matrice to consider.
    • idx (int): The index of the column to enforce distinctness for.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    distinct_col_constraint = ConstraintDistinctCol(array_var, size=3, idx=0, constraint_name="distinct_col_constraint")
    

ConstraintDistinctSlice

The ConstraintDistinctSlice class represents a constraint to ensure distinctness within a specific slice of an array.

Class Details

  • ConstraintDistinctSlice(var_1: ArrayVariable, size: int, offset_start_x: int, offset_start_y: int, offset_end_x: int, offset_end_y: int, constraint_name=None): Represents a constraint to ensure distinctness within a specific slice of an array.

    Parameters:

    • var_1 (ArrayVariable): The array variable to enforce distinctness within a slice.
    • size (int): The width of the matrice to consider.
    • offset_start_x (int): The starting offset along the x-axis for the slice.
    • offset_start_y (int): The starting offset along the y-axis for the slice.
    • offset_end_x (int): The ending offset along the x-axis for the slice.
    • offset_end_y (int): The ending offset along the y-axis for the slice.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    distinct_slice_constraint = ConstraintDistinctSlice(array_var, size=6, offset_start_x=1, offset_start_y=1, offset_end_x=3, offset_end_y=2, constraint_name="distinct_slice_constraint")
    

ConstraintDivide

The ConstraintDivide class represents a constraint to enforce a division relationship between three variables.

Class Details

  • ConstraintDivide(var_1: Variable, var_2: Variable, var_3: Variable, constraint_name=None): Represents a constraint to enforce a division relationship between three variables.

    Parameters:

    • var_1 (Variable): The numerator variable in the division.
    • var_2 (Variable): The denominator variable in the division.
    • var_3 (Variable): The result variable of the division.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    divide_constraint = ConstraintDivide(numerator, denominator, result, "divide_constraint")
    

ConstraintElement

The ConstraintElement class represents a constraint to enforce an element-wise relationship between two variables based on a mapping array like following:

map_array[var_1] == var_2

Class Details

  • ConstraintElement(map_array: ArrayVariable, var_1: Variable, var_2: Variable, constraint_name=None): Represents a constraint to enforce an element-wise relationship between two variables.

    Parameters:

    • map_array (ArrayVariable): The mapping array that defines the element-wise relationship.
    • var_1 (Variable): The first variable in the relationship.
    • var_2 (Variable): The second variable in the relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    element_constraint = ConstraintElement(mapping_array, variable_1, variable_2, "element_constraint")
    

ConstraintExponential

The ConstraintExponential class represents a constraint to enforce an exponential relationship between two variables.

Class Details

  • ConstraintExponential(var_1: Variable, var_2: Variable, constraint_name=None): Represents a constraint to enforce an exponential relationship between two variables.

    Parameters:

    • var_1 (Variable): The base variable in the exponential relationship.
    • var_2 (Variable): The result variable of the exponential relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    exponential_constraint = ConstraintExponential(base_variable, result_variable, "exponential_constraint")
    

ConstraintLogarithme

The ConstraintLogarithme class represents a constraint to enforce a logarithmic relationship between two variables .

Class Details

  • ConstraintLogarithme(var_1: Variable, var_2: Variable, constraint_name=None): Represents a constraint to enforce a logarithmic relationship between two variables.

    Parameters:

    • var_1 (Variable): The variable for which the logarithm is enforced.
    • var_2 (Variable): The result variable of the logarithmic relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    logarithmic_constraint = ConstraintLogarithme(variable_to_log, result_variable, "logarithmic_constraint")
    

ConstraintMaximum

The ConstraintMaximum class represents a constraint to enforce max{var_1, var_2} == var_3.

Class Details

  • ConstraintMaximum(var_1: Variable, var_2: Variable, var_3: Variable, constraint_name=None): Represents a constraint to enforce a maximum value relationship between three variables.

    Parameters:

    • var_1 (Variable): The first variable in the maximum value relationship.
    • var_2 (Variable): The second variable in the maximum value relationship.
    • var_3 (Variable): The third variable in the maximum value relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    max_constraint = ConstraintMaximum(variable_1, variable_2, variable_3, "max_constraint")
    

ConstraintMember

The ConstraintMember class represents a constraint to enforce a membership relationship between an array variable and a variable.

Class Details

  • ConstraintMember(var_1: ArrayVariable, var_2: Variable, constraint_name=None): Represents a constraint to enforce a membership relationship between an array variable and a variable.

    Parameters:

    • var_1 (ArrayVariable): The array variable in the membership relationship.
    • var_2 (Variable): The variable to be checked for membership.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    member_constraint = ConstraintMember(array_variable, variable_to_check, "member_constraint")
    

ConstraintMinimum

The ConstraintMinimum class represents a constraint to enforce min{var_1, var_2} == var_3.

Class Details

  • ConstraintMinimum(var_1: Variable, var_2: Variable, var_3: Variable, constraint_name=None): Represents a constraint to enforce a minimum value relationship between three variables.

    Parameters:

    • var_1 (Variable): The first variable in the minimum value relationship.
    • var_2 (Variable): The second variable in the minimum value relationship.
    • var_3 (Variable): The third variable in the minimum value relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    min_constraint = ConstraintMinimum(variable_1, variable_2, variable_3, "min_constraint")
    

ConstraintModulo

The ConstraintModulo class represents a constraint to enforce a modulo relationship between three variables.

Class Details

  • ConstraintModulo(var_1: Variable, var_2: Variable, var_3: Variable, constraint_name=None): Represents a constraint to enforce a modulo relationship between three variables.

    Parameters:

    • var_1 (Variable): The dividend variable in the modulo relationship.
    • var_2 (Variable): The divisor variable in the modulo relationship.
    • var_3 (Variable): The result variable of the modulo relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    modulo_constraint = ConstraintModulo(dividend_variable, divisor_variable, result_variable, "modulo_constraint")
    

ConstraintMultiply

The ConstraintMultiply class represents a constraint to enforce a multiplication relationship between three variables.

Class Details

  • ConstraintMultiply(var_1: Variable, var_2: Variable, var_3: Variable, constraint_name=None): Represents a constraint to enforce a multiplication relationship between three variables.

    Parameters:

    • var_1 (Variable): The first variable in the multiplication relationship.
    • var_2 (Variable): The second variable in the multiplication relationship.
    • var_3 (Variable): The result variable of the multiplication relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    multiply_constraint = ConstraintMultiply(variable_1, variable_2, result_variable, "multiply_constraint")
    

ConstraintNRoot

The ConstraintNRoot class represents a constraint to enforce an n-th root relationship between three variables.

Class Details

  • ConstraintNRoot(var_1: Variable, var_2: int, var_3: Variable, constraint_name=None): Represents a constraint to enforce an n-th root relationship between three variables.

    Parameters:

    • var_1 (Variable): The variable for which the n-th root is enforced.
    • var_2 (int): The value of n for the n-th root.
    • var_3 (Variable): The result variable of the n-th root relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    nroot_constraint = ConstraintNRoot(variable_to_root, n_value, result_variable, "nroot_constraint")
    

ConstraintPower

The ConstraintPower class represents a constraint to enforce a power relationship between three variables.

Class Details

  • ConstraintPower(var_1: Variable, var_2: int, var_3: Variable, constraint_name=None): Represents a constraint to enforce a power relationship between three variables.

    Parameters:

    • var_1 (Variable): The base variable in the power relationship.
    • var_2 (int): The exponent variable in the power relationship.
    • var_3 (Variable): The result variable of the power relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    power_constraint = ConstraintPower(base_variable, exponent_value, result_variable, "power_constraint")
    

RelationalExpression

The RelationalExpression class represents a constraint using a relational expression between variables and values.

Class Details

  • RelationalExpression(expr: Expression, constraint_name=None): Represents a constraint using a relational expression between variables or values.

    Parameters:

    • expr (Expression): The relational expression to be enforced.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    expression = Expression(var_1 + var_2 >= var_3 + 1)
    relational_constraint = RelationalExpression(expression, "relational_constraint")
    

ConstraintSin

The ConstraintSin class represents a constraint to enforce a sine relationship between two variables.

Class Details

  • ConstraintSin(var_1: Variable, var_2: Variable, constraint_name=None): Represents a constraint to enforce a sine relationship between two variables.

    Parameters:

    • var_1 (Variable): The variable for which the sine relationship is enforced.
    • var_2 (Variable): The result variable of the sine relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    sine_constraint = ConstraintSin(variable_to_sine, result_variable, "sine_constraint")
    

ConstraintSorted and ConstraintReverseSorted

The ConstraintSorted and ConstraintReverseSorted classes represent constraints to enforce sorted and reverse-sorted relationships among elements of an array variable.

Class Details

  • ConstraintSorted(var_1: ArrayVariable, constraint_name=None): Represents a constraint to enforce a sorted relationship among elements of an array variable.

    Parameters:

    • var_1 (ArrayVariable): The array variable for which the sorted relationship is enforced.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    array_to_sort = IntegerVariableArray("array_to_sort", length=50, domain_low=0, domain_high=100)
    sorted_constraint = ConstraintSorted(array_to_sort, "sorted_constraint")
    constraint_json = sorted_constraint.to_json()
    
  • ConstraintReverseSorted(var_1: ArrayVariable, constraint_name=None): Represents a constraint to enforce a reverse-sorted relationship among elements of an array variable.

    Parameters:

    • var_1 (ArrayVariable): The array variable for which the reverse-sorted relationship is enforced.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    array_to_reverse_sort = IntegerVariableArray("array_to_sort", length=50, domain_low=0, domain_high=100)
    reverse_sorted_constraint = ConstraintReverseSorted(array_to_reverse_sort, "reverse_sorted_constraint")
    

ConstraintTan

The ConstraintTan class represents a constraint to enforce a tangent relationship between two variables.

Class Details

  • ConstraintTan(var_1: Variable, var_2: Variable, constraint_name=None): Represents a constraint to enforce a tangent relationship between two variables.

    Parameters:

    • var_1 (Variable): The variable for which the tangent relationship is enforced.
    • var_2 (Variable): The result variable of the tangent relationship.
    • constraint_name (str, optional): A name for the constraint.

    Example:

    tangent_constraint = ConstraintTan(variable_to_tangent, result_variable, "tangent_constraint")