This property returns the basis status of the variable, if any. The variable must be continuous, otherwise an exception is raised.
Returns: An enumerated value from the enumerated type docplex.constants.BasisStatus.
for the model to hold basis information, the model must have been solved as a LP problem. In some cases, a model which failed to solve may still have a basis available. Use Model.has_basis() to check whether the model has basis information or not.
This property is used to get or set the Benders annotation of a variable. The value of the annotation must be a positive integer
This method is used to test equality to an expression. Because of the overloading of operator == through the redefinition of the __eq__ method, you cannot use == to test for equality. In order to test that two decision variables ar ethe same, use th` Python is operator; use the equals method to test whether a given expression is equivalent to a variable: for example, calling equals with a linear expression which consists of this variable only, with a coefficient of 1, returns True.
Parameters: other – an expression or a variable. Returns: A boolean value, True if the passed variable is this very variable, or if the passed expression is equivalent to the variable, else False.
Returns the key used to create the variable, or None.
When the variable is part of a list or dictionary of variables created from a sequence of keys, returns the key associated with the variable.
xs = m.continuous_var_dict(keys=[‘a’, ‘b’, ‘c’]) xa = xs[‘a’] assert xa.get_key() == ‘a’
Returns: a Python object, possibly None.
Checks if the variable is binary.
Returns: True if the variable is of type Binary. Return type: Boolean
Checks if the variable is continuous.
Returns: True if the variable is of type Continuous. Return type: Boolean
Checks if the variable is discrete.
Returns: True if the variable is of type Binary or Integer. Return type: Boolean
Checks if the variable is integer.
Returns: True if the variable is of type Integer. Return type: Boolean
Returns an iterator traversing all constraints in which the variable is used.
Returns: An iterator.
This property is used to get or set the lower bound of the variable.
Possible values for the lower bound depend on the variable type. Binary variables accept only 0 or 1 as bounds. An integer variable will convert the lower bound value to the ceiling integer value of the argument.
This property is used to get or set the name of the modeling object.
Returns the reduced cost of the variable.
This method will raise an exception if the model has not been solved as a LP.
- For a large number of variables (> 100), using the Model.reduced_costs() method can be much faster.
- The reduced cost of the variable (a float value).
This property returns the solution value of the variable.
DOCplexException– if the model has not been solved succesfully.
Same as solution_value but shorter
Converts a variable value to True or False.
Assuming the variable is discrete (integer or binary), returns True if the variable value is set a non-zero integer, taking into account precision. For binary variables, returns TRue if the variable value equals 1, taking into account precision.
DOCplexException– if the model has not been solved successfully.
DOCplexException– if the variable is not discrete
True if the variable value is nonzero, else False.
This property is used to get or set the upper bound of the variable.
Possible values for the upper bound depend on the variable type. Binary variables accept only 0 or 1 as bounds. An integer variable will convert the upper bound value to the floor integer value of the argument.
To reset the upper bound to its default infinity value, use
This property returns the variable type, an instance of