DiscreteVariable.asDiscretizedVar

DiscreteVariable.asDiscretizedVar()

Returns a copy of the variable as a pyagrum.DiscretizedVariable.

No conversion is done: the variable must already be a pyagrum.DiscretizedVariable. Changing the copy does not change the original variable.

Returns:

a copy of the variable

Return type:

pyagrum.DiscretizedVariable

Raises:

pyagrum.OperationNotAllowed – if the variable is not a pyagrum.DiscretizedVariable

Example

import pyagrum as gum

v = gum.fastVariable("x[0:10:5]")
w = v.asDiscretizedVar()  # a DiscretizedVariable (a copy of v)
print(w.addTick(20))
# x:Discretized(<[0;2[,[2;4[,[4;6[,[6;8[,[8;10[,[10;20]>)

Used by

DiscreteVariable, DiscretizedVariable, IntegerVariable, LabelizedVariable, NumericalDiscreteVariable, RangeVariable

Inheritance diagram of pyagrum.DiscreteVariable, pyagrum.DiscretizedVariable, pyagrum.IntegerVariable, pyagrum.LabelizedVariable, pyagrum.NumericalDiscreteVariable, pyagrum.RangeVariable