#210 Problem with incremental tabling

Performance problem
closed-fixed
nobody
5
2013-12-05
2013-11-27
No

Hello!

I am Javier Romero, from Potsdam University.
I am using XBS with incremental tabling, and
I dont know if i found a bug or i am doing something wrong.
I appreciate your help.

The program is:

%%%%%%%%%%%%%%%%%%%%%%%%%%
:- import incr_assert/1,incr_retractall/1,incr_assert_inval/1,
incr_table_update/0,incr_retract_inval/1 from increval.

% general declarations
:- table legal/1 as incremental.
:- table tnext/1, fnext/1 as incremental.
:- dynamic true/1 as incremental.
:- dynamic does/1 as incremental.
:- dynamic ffnext/1, ttnext/1 as incremental.

true(cell(3,2,b)).
true(cell(3,3,b)).

tnext(cell(Vm,Vn,x)) :- does(mark(Vm,Vn)), true(cell(Vm,Vn,b)).
tnext(cell(Vm,Vn,o)) :- does(mark(Vm,Vn)), true(cell(Vm,Vn,b)).
fnext(cell(Vm,Vn,b)) :- does(mark(Vm,Vn)).

legal(mark(Vx,Vy)) :- true(cell(Vx,Vy,b)).

test :- test1, test2,fail.
test :- test1, test2.
test1 :- legal(X), write([X]), writeln(.), incr_assert_inval(does(X)),!.
test2 :- tnext(X), write('assert: '), writeln(X), assert(ttnext(X)),fail.
test2 :- fnext(X), write('retract: '), writeln(X), assert(ffnext(X)),fail.
test2 :- ttnext(X), incr_assert_inval(true(X)),fail.
test2 :- ffnext(X), not ttnext(X), incr_retract_inval(true(X)),fail.
test2 :- ttnext(X), retract(ttnext(X)), fail.
test2 :- ffnext(X), retract(ffnext(X)), fail.
test2.

%%%%%%%%%%%%%%%%%%%%%%%%%%

And this is the execution:

%%%%%%%%%%%%%%%%%%%%%%%%%
[xsb_configuration loaded]
[sysinitrc loaded]

XSB Version 3.4.0 (Soy mILK) of May 1, 2013
[x86-pc-windows; mode: optimal; engine: slg-wam; scheduling: local]
[Patch date: 2013-05-02 17:42:32]

| ?- [tic3].
[tic3 loaded]

yes
| ?- test.
[mark(3,3)].
assert: cell(3,3,o)
assert: cell(3,3,x)
retract: cell(3,3,b)
[mark(3,2)].
assert: cell(3,2,o)
assert: cell(3,2,x)
retract: cell(3,2,b)
retract: cell(3,3,b)

yes
| ?- legal(X).

X = mark(3,2) %%% Here legal(mark(3,2)) is true

yes
| ?- legal(mark(3,2)). %%% Here it is not true

no
| ?- import incr_table_update/0 from increval. %%% And the same with this

yes
| ?- incr_table_update.

yes
| ?- legal(X).

X = mark(3,2)

yes
| ?- legal(mark(3,2)).

no
%%%%%%%%%%%%%%%%%%%%%%%%%

Thanks for your time and your program.

Best regards, javier

Discussion

  • Theresa Swift

    Theresa Swift - 2013-11-27

    I'll try to take a look in the next day or so. However, I note that incr_assert and assert are mixed for the same incr dynamic predicate, so that could contribute to the problem.

     
  • Theresa Swift

    Theresa Swift - 2013-12-01

    I had a bit more time to look at this, and there is definitely a bug. I hope to have it fixed in a couple of days.

     
  • Theresa Swift

    Theresa Swift - 2013-12-05

    Fixed in SVN version 7850. The problematic program was added to XSB's test suite so the fix will stick.

     
  • Theresa Swift

    Theresa Swift - 2013-12-05
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks