Skip to main content

expand_forall

class InstanceData

Instance Data class

The constructor provides type validation and conversion from user's input to valid instance data type.

Attributes

  • tensor_data(dict[str, numpy.ndarray]) : tensor value of Placheolder. The key is uuid of the corresponding Placheolder.
  • jagged_data(dict[str, list]) : jagged array value of JaggedArray. The key is uuid of the corresponding JaggedArray.
  • fixed_variables(dict[str, dict[tuple[int, ...], float]]) : fixed variable values.
  • indices(dict[str, int]) : value of Element. The attribute is changing in compile process.

__init__ (self, instance_data, fixed_vars, ph_names, indices) -> -

Parameters

  • instance_data(dict) : user input instance_data.
  • fixed_vars(dict) : user input fixed_variables.
  • ph_vars(list[name]) : Placeholder list include user defined model. This is used for validation.
  • indices(typ.Optional[dict]) : value of each Elements. Defaults to None.

Raises

  • ValueError: user's input is invalid.

get_length (self, name, subscripts, axis) -> -

get_value (self, uuid, subscripts) -> -


class SubstituteError

Substitute Error.

This error is raised when the substitute function. This class is inherited from JijModelingTranspilerException.


class VariableMap

VarialeMap

This class is used to manage the mapping between the label and the index of the decision variable.

Attributes

  • 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.

add_cont_variable (self, label, subscripts, lower, upper) -> -

Add an integer variable to the variable map.

add_int_variable (self, label, subscripts, lower, upper) -> -

Add an integer variable to the variable map.

add_variable (self, label, subscripts) -> int

Add a variable to the variable map.

Parameters

  • label(str) : label of the variable
  • subscripts(tuple[int, ...]) : subscripts of the variable

Returns

  • int : index of the variable in the variable map

from_serializable (data) -> -

to_serializable (self) -> dict

Convert to a serializable object.

Returns

  • 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": {}
# }

expand_forall (forall, data) -> -