InfluenceDiagram.toFast

InfluenceDiagram.toFast(filename=None)

Export the influence diagram in fast syntax (the structure and the variables, not the parameters), read back by pyagrum.fastID. A name is quoted if it would not be read back as is otherwise (see pyagrum.quoteFastName).

Parameters:

filename (str, optional) – if given, a Python file which builds the model with pyagrum.fastID is written

Returns:

the fast description of the model (if filename is None)

Return type:

str

Example

import pyagrum as gum

diag = gum.fastID("C->*D->$U<-C")
diag.toFast()
# 'C[2]->*D[2];C->$U[1];D->U'

# a name is quoted when it would not be read back as is otherwise
gum.fastID("'my state'->*'my-decision'").toFast()
# "my state[2]->*'my-decision'[2]"

Class

InfluenceDiagram