Specific Constraints
The Specific Constraints module defines specific constraint classes for minimizing and maximizing variables’ value.
SpecificMinimum
Represents a constraint to minimize a specific variable.
Constructor:
SpecificMinimum(variable: Variable, constraint_name=None) -> None
variable
(Variable): The variable to be minimized.constraint_name
(str, optional): The name of the constraint.
Example:
from qaekwy.model.modeller import Modeller
from qaekwy.model.variable.variable import IntegerVariable
from qaekwy.model.constraint.specific_constraints import SpecificMinimum
my_variable = IntegerVariable("x", domain_low=5, domain_high=10)
specific_min = SpecificMinimum(my_variable)
my_model = Modeller()
# ...
my_model.add_variable(my_variable)
my_model.add_objective(specific_min)
SpecificMaximum
Represents a constraint to maximize a specific variable.
Constructor:
SpecificMaximum(variable: Variable, constraint_name=None) -> None
variable
(Variable): The variable to be maximized.constraint_name
(str, optional): The name of the constraint.
Example:
from qaekwy.model.modeller import Modeller
from qaekwy.model.variable.variable import IntegerVariable
from qaekwy.model.constraint.specific_constraints import SpecificMinimum
my_variable = IntegerVariable("x", domain_low=5, domain_high=10)
specific_min = SpecificMinimum(my_variable)
my_model = Modeller()
# ...
my_model.add_variable(my_variable)
my_model.add_objective(specific_min)