Curious why one way of setting outcomes fails.

The engine.
Post Reply
gund
Posts: 15
Joined: Wed Sep 09, 2009 9:02 am

Curious why one way of setting outcomes fails.

Post by gund »

SMILE allows me to use AddOutcome() but doesn't allow me to use SetNumberOfOutcomes(int). It returns a -19 DSL_WRONG_NUM_STATES error.

It's a decision node with no parents. Anybody know why the code does not let me set an arbitrary number of outomes with SetNumberOfOutcomes(int) but allows me to do so with AddOutcome()?

Just curious.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Curious why one way of setting outcomes fails.

Post by shooltz[BayesFusion] »

gund wrote:It's a decision node with no parents. Anybody know why the code does not let me set an arbitrary number of outomes with SetNumberOfOutcomes(int) but allows me to do so with AddOutcome()?
DSL_WRONG_NUM_STATES is returned when node for which SetNumberOfOutcomes was called has at least one child.

Changing the outcome set of the parent node (creation, removal, reordering of the outcomes) also changes the structure of its children nodes. The children nodes are notified when AddOutcome or RemoveOutcome methods are called on the parent and must respond accordingly to keep the network in a consistent state.

This process is more difficult to implement when the entire set of outcomes changes at once. We decided to keep SetNumberOfOutcomes in SMILE, but limit its application to childless nodes; the method is here mainly for the benefit of file format readers.
gund
Posts: 15
Joined: Wed Sep 09, 2009 9:02 am

Post by gund »

Ah ok thanks that clears it up.
Post Reply