"corrupted size vs. prev_size" error when evaluating DBN in c++

The engine.
Post Reply
sverrevr
Posts: 26
Joined: Mon Aug 24, 2020 7:37 am

"corrupted size vs. prev_size" error when evaluating DBN in c++

Post by sverrevr »

Hi!
For some evidence configurations in my DBN I get a "corrupted size vs. prev_size" error when executing "UpdateBeliefs()" in c++. As it only occurs for some evidence configurations I thought it could be due to an impossible evidence configuration. To test this out I tried to insert the same evidence in Genie, which evaluated the network without any problems, so that's maybe not the problem? I have tried to change to an approximate solver, but that had no effect.

I know this is way too little information to know what my problem is, but as I'm having trouble figuring out which information that is relevant, maybe you have some ideas on the causes of this error?

Best regards
Sverre
sverrevr
Posts: 26
Joined: Mon Aug 24, 2020 7:37 am

Re: "corrupted size vs. prev_size" error when evaluating DBN in c++

Post by sverrevr »

It seems that the error was caused by giving a (temporal) node virtual evidence with 0% probability for each outcome. The SetTemporalEvidence() function returned 0 indicating no error, and the error first occurred when trying to evaluate the network. I don't know if this is the case for non-temporal nodes as well, using the SetVirtualEvidence() function.

I wonder why that resulted in a "corrupted size vs. prev_size" error 🤔 Would it be possible to give out a more informative error message when attempting to set virtual evidence not summing to 1? I understand if this is not top priority :)

Another random question, how precisely does the sum of virtual evidence have to be equal to 1? Is it robust against floating-point errors?
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: "corrupted size vs. prev_size" error when evaluating DBN in c++

Post by shooltz[BayesFusion] »

Another random question, how precisely does the sum of virtual evidence have to be equal to 1? Is it robust against floating-point errors?
The values are normalized, so it should be robust. However, the code is not checking against all zeros (or agains negative values); we'll add this test.
I wonder why that resulted in a "corrupted size vs. prev_size" error
I searched for this string in the SMILE soruce code and was unable to find it. Was it an assert, or some other type of message?
sverrevr
Posts: 26
Joined: Mon Aug 24, 2020 7:37 am

Re: "corrupted size vs. prev_size" error when evaluating DBN in c++

Post by sverrevr »

When googlig this error the only thing I found was this answer in a stackoverflow question:
A practical cause to "corrupted size vs. prev_size" is quite simple - memory chunk control structure fields in the adjacent following chunk are being overwritten due to out-of-bounds access by the code. if you allocate x bytes for pointer p but wind up writing beyond x in regards to the same pointer, you might get this error, indicating the current memory allocation (chunk) size is not the same as what's found in the next chunk control structure (due to it being overwritten).
I don't think it was an assert message.

I suspected that the values were normalized and that it might be a problem if all values were zero, to test it I added a small value to one of the virtual values, but the error persisted. But it might be that I did something else wrong aswell 🤔

Thanks for adding a test against all zero values :)
Post Reply