Using PNL High API (via C++), I am having problems saving a LIMID after adding two time slices complete with chance, decision, and utility nodes plus all arcs. The network is topologically sorted. I get the following error when I try to save the network:
inconsistent size in pnlTabularDistribFun.cpp at line 457. The error description is: number of ranges of matrix should coincide with the number of nodes in domain
What does this error mean?
I should have noted that, in addition to being unable to save the network, I cannot do analysis on it, e. g. exp = net->GetExpectation() generates the same error msg.
I'm sure the bug is on my side, but this is the relevant code in pnlTabularDistribFun.cpp (it throws the exception at the end of this code snippet) :
void CTabularDistribFun::AttachMatrix( CMatrix<float>* pMatrix,
const int* parentIndices,
if( m_bUnitFunctionDistribution )
" matrices can't be attached to uniform distribution function " );
void* pObj = this;
if( ( mType != matTable ) && ( mType != matDirichlet ) )
" matrix type should be either matTable or matDirichlet " );
//check ranges of matrix
const int* ranges;
pMatrix->GetRanges( &numRanges, &ranges );
if( numRanges != m_NumberOfNodes )
" number of ranges of matrix should coincide"
" with the number of nodes in domain " );
This turned out to be due to linking 3 correctly-structured utility nodes to a single mega-utility node. While this is sometimes done in the Decision Network literature, it is not possible to do in PNL (and arguably it doesn't make sense to do so given its utility semantics).
I think the PNL High API needs its own error messages, since the ones given by the lower-level PNL library assume knowledge of its inner workings.