Author Topic: Segmentation fault while loading the network with JAVA API  (Read 14757 times)

Offline dechouxb_AAU

  • Newbie
  • *
  • Posts: 5
    • View Profile
Hi,

I am building a network with the JAVA API and I managed to compile and saved to a *.net file with success regardless of the size of the variables state spaces.

My issue arise when I try to load the network again. If the state space of the variables customer and movie are 5000 and 200, it is fine but if I augment them to 50000 and 2000, I get a segmentation fault.

Using the JAVA-builded network without saving it first in a *.net  file might work (I have to test it) but I would like to be able to save my network (using *.net file or anything else).

Bertrand


The following JAVA code describe the model and how to reproduce the error.
Code: [Select]
public class Main {

public static void main(String[] args) throws ExceptionHugin {
final String domainName = "biaspect.net";
createBiAspectModel().saveAsNet(domainName);
doSomeInference(new Domain(domainName, new DefaultClassParseListener()));
}

public static Domain createBiAspectModel() throws ExceptionHugin {
Domain myDomain = new Domain();

NumberedDCNode customer = new NumberedDCNode(myDomain);
customer.setLabel("customer");
customer.setName("customer");
customer.setNumberOfStates(50000);
customer.setPosition(new Point2D.Float(300,250));

NumberedDCNode movie = new NumberedDCNode(myDomain);
movie.setLabel("movie");
movie.setName("movie");
movie.setNumberOfStates(2000);
movie.setPosition(new Point2D.Float(100,250));

NumberedDCNode cAspect = new NumberedDCNode(myDomain);
cAspect.setLabel("cAspect");
cAspect.setName("cAspect");
cAspect.addParent(customer);
cAspect.setNumberOfStates(20);
cAspect.setPosition(new Point2D.Float(300,150));

NumberedDCNode mAspect = new NumberedDCNode(myDomain);
mAspect.setLabel("mAspect");
mAspect.setName("mAspect");
mAspect.addParent(movie);
mAspect.setNumberOfStates(20);
mAspect.setPosition(new Point2D.Float(100,150));

NumberedDCNode rating = new NumberedDCNode(myDomain);
rating.setLabel("rating");
rating.setName("rating");
rating.addParent(cAspect);
rating.addParent(mAspect);
rating.setNumberOfStates(5);
rating.setPosition(new Point2D.Float(200,50));

myDomain.compile();
return myDomain;
}

public static void doSomeInference(Domain domain) throws ExceptionHugin {
//domain.compile();

}
}

Offline Frank Jensen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: Segmentation fault while loading the network with JAVA API
« Reply #1 on: April 17, 2009, 14:43:05 »
I have no problems running your code, and loading and compiling the resulting NET file.

I have tested this on a Linux system.

Offline dechouxb_AAU

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Segmentation fault while loading the network with JAVA API
« Reply #2 on: April 17, 2009, 19:16:03 »
Which means that It might be due to my environment or my configuration.
I am using the API 6.7 and GUI 6.9 (hgui_64 build 6900).

Actually,the code is not using the gui but if I do try to open the file 'by hand' with the ui, I also get the segmentation fault.

Offline Frank Jensen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: Segmentation fault while loading the network with JAVA API
« Reply #3 on: April 20, 2009, 16:31:44 »
I also get the segmentation fault when I try to open the file using the Hugin GUI on a Linux system.  The error is a stack overflow problem.

The problem disappears if I add "-Xss8m" to the invocation of the "java" interpreter in the "hugin" script.