Author Topic: domain.compile  (Read 12198 times)

Offline ykchen

  • Newbie
  • *
  • Posts: 11
    • View Profile
domain.compile
« on: July 30, 2010, 15:34:39 »
Hello, Hugin Experts

Could you please tell me that in which kind of situation, I can get a exception says:"HAPI::ExceptionUsage at memory location" when I calling domain.compile.

I got such kind of error depending on the various input.

Thank you.

Offline Frank Jensen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 575
    • View Profile
Re: domain.compile
« Reply #1 on: July 30, 2010, 16:07:47 »
The Domain.compile() method only has two usage conditions:

(1) The domain must not already be compiled.

(2) The domain must contain at least one (chance or decision) node.

Offline ykchen

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: domain.compile
« Reply #2 on: July 30, 2010, 16:22:37 »
what i did is :
1. change the number of state
2. change the cpts
In a word, edit the net.
not only compile,  propagate will induce the same exception as well.  [i didn't set any evidence. ]

Unhandled exception at 0x75c29617 in IDID.exe: Microsoft C++ exception: HAPI::ExceptionUsage at memory location 0x0012f70c..
Unhandled exception at 0x75c29617 in IDID.exe: Microsoft C++ exception: HAPI::ExceptionNotCompiled at memory location 0x0012f954..
« Last Edit: July 30, 2010, 16:40:04 by ykchen »

Offline ykchen

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: domain.compile
« Reply #3 on: July 30, 2010, 16:39:16 »
The Domain.compile() method only has two usage conditions:

(1) The domain must not already be compiled.

(2) The domain must contain at least one (chance or decision) node.


Thank you for you reply.  
1.The domain is comiled when i load the net file.
2.There are more than 1 node.

This problem is depanding on the input, and I am sure that there is a bug in my program.

And, If I save the net as a file before the compile or propagate. Then load it and do the following task. Everything is OK.
There is no inconsistent evidence [on evidence entered till then].
« Last Edit: July 30, 2010, 16:47:39 by ykchen »

Offline Frank Jensen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 575
    • View Profile
Re: domain.compile
« Reply #4 on: July 30, 2010, 18:26:11 »
Can you post the code?

Offline ykchen

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: domain.compile
« Reply #5 on: July 30, 2010, 23:15:32 »
Hello Frank.
Thanks again.
It seems that I have fixed it. But I am not sure about this.

The main task of the function in trouble is change the number of state and update the corresponding CPTs in order to keep the joint distribution unchanged.  They are "static" operations.
But before and after this function, I need to get some node's belief and utility, i called them "dynamic" ones.

My solution is that uncompile the net at the begining and compile it again at the end.  
That is, the net will be uncompiled if the change is coming, and be compiled again after the modification.  

Could you please tell me that is it a reasonable way to use  Hugin API?  I found there is a "Edit" and "Compile" button in GUI. Thank you.

Good night and enjoy the rest of the summer.

yingke
« Last Edit: July 30, 2010, 23:17:23 by ykchen »

Offline Frank Jensen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 575
    • View Profile
Re: domain.compile
« Reply #6 on: August 01, 2010, 22:46:57 »
The "setNumberOfStates" method performs an uncompile operation (that is, the domain will be in "uncompiled" state after this method has been called).  Moreover, it has to resize all tables containing the node in question.  See Section 2.5 in the Hugin API Reference Manual for all details.

Offline ykchen

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: domain.compile
« Reply #7 on: August 02, 2010, 11:56:11 »
Good to know this. Thank you very much.