riedelcastro / thebeast

Automatically exported from code.google.com/p/thebeast
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Formulas with more than two predicates crash #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define a Formula with two or more hidden predicates
i.e.: 
weight w_chunk: Field x Phrase_Type-> Double;
factor: for Int a, Int c, Field f if word(a,_) & word(c,_) & c>=a add 
[(in_field(a,f) & in_field(c,f)) => chunk(a,c,f)] * w_chunk(f, p);

2. The conjunction in of in_field(a,f) & in_field(c,f) in addition chunk(a,c,f) 
crashes the program when learning the weights for this formula.

3. Even, just conjunctions will reproduce the same problem:
add [in_field(a,f) & in_field(c,f) & chunk(a,c,f)]

4. But, add [in_field(c,f)) => chunk(a,c,f)] will work.

What is the expected output? What do you see instead?
A standard execution, without breaking. I see the following error:

Started Epoch 0:
java.lang.NullPointerException
    at java.lang.System.arraycopy(Native Method)
    at thebeast.nodmem.mem.MemChunk.unify(MemChunk.java:268)
    at thebeast.nodmem.mem.MemEvaluator.relation_selector(MemEvaluator.java:385)
    at thebeast.nodmem.mem.MemEvaluator.evaluate(MemEvaluator.java:213)
    at thebeast.nodmem.mem.MemEvaluator.operator_inv(MemEvaluator.java:293)
    at thebeast.nodmem.mem.MemEvaluator.evaluate(MemEvaluator.java:231)
    at thebeast.nodmem.mem.MemSearch.search(MemSearch.java:83)
    at thebeast.nodmem.mem.MemEvaluator.query(MemEvaluator.java:486)
    at thebeast.nodmem.mem.MemEvaluator.evaluate(MemEvaluator.java:195)
    at thebeast.nodmem.statement.MemInterpreter.visitInsert(MemInterpreter.java:345)
    at thebeast.nodmem.statement.MemInsert.acceptStatementVisitor(MemInsert.java:54)
    at thebeast.nodmem.statement.MemInterpreter.interpret(MemInterpreter.java:53)
    at thebeast.pml.solve.ilp.IntegerLinearProgram.update(IntegerLinearProgram.java:447)
    at thebeast.pml.solve.CuttingPlaneSolver.update(CuttingPlaneSolver.java:269)
    at thebeast.pml.solve.CuttingPlaneSolver.inspect(CuttingPlaneSolver.java:520)
    at thebeast.pml.solve.CuttingPlaneSolver.solve(CuttingPlaneSolver.java:388)
    at thebeast.pml.solve.CuttingPlaneSolver.solve(CuttingPlaneSolver.java:557)
    at thebeast.pml.training.OnlineLearner.learn(OnlineLearner.java:328)
    at thebeast.pml.training.OnlineLearner.learn(OnlineLearner.java:262)
    at thebeast.pml.parser.Shell.visitLearn(Shell.java:922)
    at thebeast.pml.parser.ParserLearn.acceptParserStatementVisitor(ParserLearn.java:16)
    at thebeast.pml.parser.Shell.execute(Shell.java:218)
    at thebeast.pml.TheBeast.main(TheBeast.java:102)

What version of the product are you using? On what operating system?
I've tried the thebeast-dev version and thebeast-0.0.2. In both cases I see the 
same behavior.

Please provide any additional information below.
Is there a way to encode this type of formulas, or is it bug in the code?

Original issue reported on code.google.com by mojica.g...@gmail.com on 16 Apr 2014 at 11:49

GoogleCodeExporter commented 9 years ago
Forgot to mention that, in the given example, the predicate word(position, 
Word) is observed and that in_field(position, Field) and chunk(position, 
position, Field) are hidden.

Original comment by mojica.g...@gmail.com on 16 Apr 2014 at 11:53