CTBN.add

CTBN.add(var)

Add a new variable to the Ctbn.

Parameters:

var (pyagrum.DiscreteVariable) – The variable to add to the CTBN.

Returns:

The id given to the variable.

Return type:

int

Raises:
  • NameError – If a variable with the same name already exists.

  • ValueError – If the variable is None.

Example

import pyagrum as gum
import pyagrum.ctbn as ct

ctbn = ct.CTBN()
ctbn.add(gum.LabelizedVariable("A", "A", ["a0", "a1"]))
# 0
ctbn.add(gum.LabelizedVariable("B", "B", ["b0", "b1"]))
# 1
ctbn.CIM("A").varNames
# ('A#j', 'A#i')

Class

CTBN