variable_map
IntegerBound dataclass ¶
IntegerBound
Attributes:
| Name | Type | Description |
|---|---|---|
lower | int | float | lower bound of integer decision variable |
upper | int | float | upper bound of integer decision variable |
Source code in jijmodeling_transpiler/core/variable_map.py
5 6 7 8 9 10 11 12 13 14 15 16 | |
VariableMap dataclass ¶
VarialeMap
This class is used to manage the mapping between the label and the index of the decision variable.
Attributes:
| Name | Type | Description |
|---|---|---|
var_map | dict[str, dict[tuple[int, ...], int]] | label, subscripts -> index (int) |
var_num | int | number of variables |
integer_bound | dict[str, dict[tuple[int, ...], IntegerBound]] | bounds of integer decision variables. |
Source code in jijmodeling_transpiler/core/variable_map.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
add_int_variable(label, subscripts, lower, upper) ¶
Add an integer variable to the variable map.
Source code in jijmodeling_transpiler/core/variable_map.py
56 57 58 59 60 61 62 | |
add_variable(label, subscripts) ¶
Add a variable to the variable map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label | str | label of the variable | required |
subscripts | tuple[int, ...] | subscripts of the variable | required |
Returns:
| Name | Type | Description |
|---|---|---|
int | int | index of the variable in the variable map |
Source code in jijmodeling_transpiler/core/variable_map.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
to_serializable() ¶
Convert to a serializable object.
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | serializable object |
Examples:
varmap = VariableMap()
varmap.add_variable("x", (0, 0))
varmap.add_variable("x", (0, 1))
varmap.to_serializable()
# {
# "class": "VariableMap",
# "var_map": {
# "x": {
# "subscripts": [
# [0, 0],
# [0, 1]
# ],
# "index": [0, 1]
# }
# },
# "var_num": 2,
# "integer_bound": {}
# }
Source code in jijmodeling_transpiler/core/variable_map.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |