Reference - Variables

IntegerVariable Module

This module defines classes related to integer variables.

Classes:

  • IntegerVariable: Represents an integer variable.
  • IntegerExpressionVariable: Represents an integer variable defined by an expression.
  • IntegerVariableArray: Represents an array of integer variables.

Module Structure:

  • IntegerVariable
  • IntegerExpressionVariable
  • IntegerVariableArray

IntegerVariable

Represents a single integer variable.

Args:

  • var_name (str): The name of the variable.
  • domain_low (int, optional): The lower bound of the variable’s domain.
  • domain_high (int, optional): The upper bound of the variable’s domain.
  • specific_domain (list, optional): A specific domain for the variable.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

x = IntegerVariable(
    var_name="x",
    domain_low=1,
    domain_high=10,
    branch_val=BranchIntegerVal.VAL_RND
)

IntegerExpressionVariable

Represents an integer variable defined by an expression.

Args:

  • var_name (str): The name of the variable.
  • expression: The expression defining the variable.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

x = IntegerVariable(
    var_name="x",
    domain_low=1,
    domain_high=10,
    branch_val=BranchIntegerVal.VAL_RND
)

y = IntegerExpressionVariable(
    var_name="y",
    expression=Expression(3 * x + 2),
    branch_val=BranchIntegerVal.VAL_MIN
)

IntegerVariableArray

Represents an array of integer variables.

Args:

  • var_name (str): The name of the variable.
  • length (int): The length of the array.
  • domain_low (int, optional): The lower bound of the variables’ domain.
  • domain_high (int, optional): The upper bound of the variables’ domain.
  • specific_domain (list, optional): A specific domain for the variables.
  • branch_var (BranchVar, optional): The brancher variable strategy.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

arr = IntegerVariableArray(
    var_name="arr",
    length=5,
    domain_low=0,
    domain_high=100,
    branch_var=BranchIntegerVar.VAR_MAX
    branch_val=BranchIntegerVal.VAL_MAX
)

FloatVariable Module

This module defines classes related to float variables.

Classes:

  • FloatVariable: Represents a float variable.
  • FloatExpressionVariable: Represents a float variable defined by an expression.
  • FloatVariableArray: Represents an array of float variables.

Module Structure:

  • FloatVariable
  • FloatExpressionVariable
  • FloatVariableArray

FloatVariable

Represents a single float variable.

Args:

  • var_name (str): The name of the variable.
  • domain_low (float, optional): The lower bound of the variable’s domain.
  • domain_high (float, optional): The upper bound of the variable’s domain.
  • specific_domain (list, optional): A specific domain for the variable.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

x = FloatVariable(
    var_name="x",
    domain_low=0.0,
    domain_high=1.0,
    branch_val=BranchFloatVal.VAL_RND
)

FloatExpressionVariable

Represents a float variable defined by an expression.

Args:

  • var_name (str): The name of the variable.
  • expression: The expression defining the variable.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

x = FloatVariable(
    var_name="x",
    domain_low=0.0,
    domain_high=1.0,
    branch_val=BranchFloatVal.VAL_RND
)

y = FloatExpressionVariable(
    var_name="y",
    expression=Expression(0.5 * x + 0.2),
    branch_val=BranchFloatVal.VAL_MAX
)

FloatVariableArray

Represents an array of float variables.

Args:

  • var_name (str): The name of the variable.
  • length (int): The length of the array.
  • domain_low (float, optional): The lower bound of the variables’ domain.
  • domain_high (float, optional): The upper bound of the variables’ domain.
  • branch_var (BranchFloatVar, optional): The brancher variable strategy.
  • branch_val (BranchVal, optional): The brancher value strategy.

Example:

arr = FloatVariableArray(
    var_name="arr",
    length=5,
    domain_low=0.0,
    domain_high=10.0,
    branch_var=BranchFloatVar.VAR_RND
    branch_val=BranchFloatVar.VAR_MIN
)

BooleanVariable Module

This module defines classes related to boolean variables.

Classes:

  • BooleanVariable: Represents a boolean variable.
  • BooleanExpressionVariable: Represents a boolean variable defined by an expression.
  • BooleanVariableArray: Represents an array of boolean variables.

Module Structure:

  • BooleanVariable
  • BooleanExpressionVariable
  • BooleanVariableArray

BooleanVariable

Represents a single boolean variable.

Args:

  • var_name (str): The name of the variable.
  • branch_val (BranchVal): The brancher value strategy.

Example:

my_bool_var = BooleanVariable(var_name="b1", branch_val=BranchVal.VAL_MIN)

BooleanExpressionVariable

Represents a boolean variable defined by an expression.

Args:

  • var_name (str): The name of the variable.
  • expression: The expression defining the variable.
  • branch_val (BranchVal): The brancher value strategy.

Example:

b2 = BooleanExpressionVariable(
    var_name"b2",
    expression=Expression(x[3] > 5),
    branch_val=BranchVal.VAL_MAX
)

BooleanVariableArray

Represents an array of boolean variables.

Args:

  • var_name (str): The name of the variable.
  • length (int): The length of the array.
  • branch_var (BranchVar): The brancher variable strategy.
  • branch_val (BranchVal): The brancher value strategy.

Example:

bool_arr = BooleanVariableArray(
    var_name"bool_arr",
    length=3,
    branch_var=BranchVar.VAR_MIN,
    branch_val=BranchVal.VAL_RND
)

Branch Module: Branching Strategies

The “Branch” module in Qaekwy defines a variety of branching strategies that guide the branching decisions made during the search process of an optimization or constraint problem. These strategies play a crucial role in efficiently exploring the solution space and improving convergence to an optimal solution. Let’s delve into the different branching strategies available:

BranchVal: Brancher Value Strategies

The BranchVal class represents strategies for selecting brancher values during the search process. These strategies determine how values for variables are chosen when branching decisions are made.

The following strategies are available:

  • VAL_RND: Select a value randomly.
  • VAL_MIN: Select the minimum value.
  • VAL_MED: Select the median value.
  • VAL_MAX: Select the maximum value.
  • VALUES_MIN: Select the value with the smallest domain.
  • VALUES_MAX: Select the value with the largest domain.
  • VAL_RANGE_MIN: Select the value with the smallest range.
  • VAL_RANGE_MAX: Select the value with the largest range.
  • VAL_SPLIT_MIN: Select a value by splitting the domain into two halves and choosing from the smaller half.
  • VAL_SPLIT_MAX: Select a value by splitting the domain into two halves and choosing from the larger half.

BranchVar: Brancher Variable Strategies

The BranchVar class represents strategies for selecting brancher variables during the search process. These strategies determine which variables are chosen for branching decisions.

The available strategies are as follows:

  • VAR_NONE: No variable is selected (termination strategy).
  • VAR_RND: Select a variable randomly.
  • VAR_SIZE_MIN: Select the variable with the smallest domain.
  • VAR_SIZE_MAX: Select the variable with the largest domain.
  • VAR_REGRET_MIN_MIN: Select the variable with the smallest minimum regret.
  • VAR_REGRET_MIN_MAX: Select the variable with the largest minimum regret.
  • VAR_DEGREE_MIN: Select the variable with the minimum degree.
  • VAR_DEGREE_MAX: Select the variable with the maximum degree.
  • VAR_MIN_MIN: Select the variable with the smallest minimum value.
  • VAR_MIN_MAX: Select the variable with the largest minimum value.
  • VAR_MAX_MIN: Select the variable with the smallest maximum value.
  • VAR_MAX_MAX: Select the variable with the largest maximum value.
  • VAR_DEGREE_SIZE_MIN: Select the variable with the smallest degree and smallest domain.
  • VAR_DEGREE_SIZE_MAX: Select the variable with the largest degree and largest domain.

BranchIntegerVal: Integer Value Strategies

The BranchIntegerVal class extends the BranchVal class and is specifically tailored to integer variables. It provides strategies for selecting values for integer variables during the branching process.

BranchFloatVal: Float Value Strategies

The BranchFloatVal class extends the BranchVal class and is designed for float variables. It offers strategies for selecting values for float variables during branching.

BranchBooleanVal: Boolean Value Strategies

The BranchBooleanVal class extends the BranchVal class and caters to boolean variables. It offers strategies for selecting values for boolean variables during branching.

BranchIntegerVar: Integer Variable Strategies

The BranchIntegerVar class extends the BranchVar class and is specific to integer variables. It provides strategies for selecting integer variables for branching decisions.

BranchFloatVar: Float Variable Strategies

The BranchFloatVar class extends the BranchVar class and is tailored for float variables. It offers strategies for selecting float variables for branching decisions.

BranchBooleanVar: Boolean Variable Strategies

The BranchBooleanVar class extends the BranchVar class and is designed for boolean variables. It provides strategies for selecting boolean variables for branching decisions.