๐ฆ Variables: The Unknowns in Your Problem
In Qaekwy, variables are the placeholders for the unknown values you want the solver to find. Think of them as the empty squares in a Sudoku puzzle. Each empty square is a variable, and the goal is to find a value for each one.
What’s a Variable Made Of?
Every variable in Qaekwy has two important parts:
- A Name: A unique name for the variable (e.g., “x”, “my_variable”).
- A Domain: The set of possible values that the variable can have.
Some variables can be define using an expression rather than an interval domain.
Why are Variables Important?
Variables and their domains define the “search space” of your problem. The smaller the domain, the less work the solver has to do. So, it’s always a good idea to make the domains as small as possible.
Types of Variables in Qaekwy
Qaekwy has a variable type for every occasion:
IntegerVariable
For whole numbers. The domain can be a range (e.g., all integers from 1 to 100) or a specific set of values (e.g., [2, 3, 5, 7, 11]).
IntegerExpressionVariable
For whole numbers. The value is defined according to the specified expression rather than an interval domain.
FloatVariable
For numbers with decimal points. The domain is a range of real numbers (e.g., from 0.0 to 1.0).
FloatExpressionVariable
For numbers with decimal points. The value is defined according to the specified expression rather than an interval domain.
BooleanVariable
For true/false decisions (0 or 1).
BooleanExpressionVariable
For true/false decisions (0 or 1). The value is defined according to the specified expression.
IntegerVariableArray
, FloatVariableArray
& BooleanVariableArray
A list of variables of the same type. This is super useful for modeling things like a row of houses, a group of people, or a sequence of events.
Learn More!
To see all the details about how to create and use variables, check out the API Reference for Variables.