VariableType Class Reference
GAMS Variable Types. More...
GAMS Variable Types.
This class holds the possible GAMS variable types similar to an enumeration class. Note that it is not an enumeration class due to compatibility (e.g. for Octave).
- See also
- Variable
Static Public Member Functions | |
static function | int2str (in value_int) |
Converts a variable type identifier to string. More... | |
static function | str2int (in value_str) |
Converts a variable type name to an identifier. More... | |
static function | isValid (in value) |
Checks if a variable type name or identifier is valid. More... | |
Public Attributes | |
Constant Property | BINARY = 1 |
identifier for binary variable | |
Constant Property | INTEGER = 2 |
identifier for integer variable | |
Constant Property | POSITIVE = 3 |
identifier for positive variable | |
Constant Property | NEGATIVE = 4 |
identifier for negative variable | |
Constant Property | FREE = 5 |
identifier for free variable | |
Constant Property | SOS1 = 6 |
identifier for SOS1 variable | |
Constant Property | SOS2 = 7 |
SOS2 identifier for SOS2 variable. | |
Constant Property | SEMICONT = 8 |
identifier for semi-continuous variable | |
Constant Property | SEMIINT = 9 |
identifier for semi-integer variable | |
Member Function Documentation
◆ int2str()
|
static |
Converts a variable type identifier to string.
s = VariableType.int2str(i)
returns a string with the variable type name for the given variable type identifieri
. Ifi
is an invalid identifier, this function raises an error.
Example:
s = VariableType.int2str(VariableType.BINARY)
s
equals "binary"
◆ isValid()
|
static |
Checks if a variable type name or identifier is valid.
b = VariableType.isValid(s)
returnstrue
ifs
is a valid variable type name or variable type identifier andfalse
otherwise.
Example:
VariableType.isValid('binary') % is true
VariableType.isValid(VariableType.BINARY) % is true
VariableType.isValid('not_a_valid_name') % is false
◆ str2int()
|
static |
Converts a variable type name to an identifier.
i = VariableType.str2int(s)
returns an integer identifier for the given variable type names
. Ifs
is an invalid type name, this function raises an error.
Example:
i = VariableType.str2int('binary')
i
equals VariableType.BINARY